I wanna render a button in react native like this:

Hear is my code :
class Test extends Component {
render() {
return (
<View>
<TouchableHighlight style={{marginBottom:20,height:40,backgroundColor:'blue',justifyContent:'center'}}>
<Text style={{alignSelf:'center',color:'white'}}>Login</Text>
</TouchableHighlight>
</View>
);
}
}
But the render result for mentioned above is :

How to modify my code?
Use position: 'absolute' in this case, like:
loginButton: {
position:'absolute',
bottom: 0,
height:40,
backgroundColor:'blue',
justifyContent:'center',
width: width
}
and render should be:
render() {
return (
<View style={styles.loginButton}>
<TouchableHighlight>
<Text style={styles.loginButtonText}>Login</Text>
</TouchableHighlight>
</View>
);
}
Here is the full working code: https://rnplay.org/apps/6qMTdA
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With