I have a problem with my btn component, I am using react-native-linear-gradient lib...
btn.js
import React,{ Component } from 'react';
import {View,Text,StyleSheet, TouchableOpacity} from 'react-native';
import {Button,Item} from 'native-base';
import LinearGradient from 'react-native-linear-gradient';
class GradientBtn extends Component {
constructor(props){
super(props);
}
render(){
return(
<LinearGradient colors={['#d7d7d7', '#fafafa', '#e8e8e8']}
style={[styles.btnContainer,{height:this.props.h,width:this.props.w}]}>
<Text style={styles.btn}>{this.props.name}</Text>
</LinearGradient>
);
}
}
var styles = StyleSheet.create({
btnContainer:{
backgroundColor:'#f0f0f0',
justifyContent:'center',
marginLeft:1
},
btn:{
textAlign:'center',
color:'#000',
fontWeight:'700',
fontSize:12
}
});
export default GradientBtn;
app.js
<View style={{flexDirection:'row',justifyContent:'space-between',marginTop:5}}>
<TouchableOpacity>
<GradientBtn h={35} w={'24.55%'} name="Open Corrective"/>
</TouchableOpacity>
<TouchableOpacity>
<GradientBtn h={35} w={'24.55%'} name="Open Corrective"/>
</TouchableOpacity>
<TouchableOpacity>
<GradientBtn h={35} w={'24.55%'} name="Open Corrective"/>
</TouchableOpacity>
<TouchableOpacity>
<GradientBtn h={35} w={'24.55%'} name="Open Corrective"/>
</TouchableOpacity>
</View>
when I remove TouchableOpacity tag from component then the view will ok, but I want touch opacity on that btn when I placed this tag then my view will compress means out the width and didn't see proper btn..