I would like set button on the bottom right corner width fixed position in React Native.
position: fixed
don't work in React Native and stickyHeaderIndices
method in ScrollView does not allow to position an element above the others component.
Anyone have already test this feature ?
You can set buttons display to inline-block or inline. This will make the button to behave like normal text. After the above step set the buttons immediate divs text-align property to right. Hope this helps.
If you want the button fixed at the lower right bottom, you can use position: absolute instead of fixed. It dissapear after scrolling down. Okay, if your container height is dynamic then try to use position: sticky or relative.
Try this:
render() {
return (
<View style={{flex:1}}>
<View style={{borderWidth:1,position:'absolute',bottom:0,alignSelf:'flex-end'}}>
<Button
title="Press"
color="#841584"
accessibilityLabel="Press"/>
</View>
</View>
);
}
Output:
<View style={{flex: 1}}>
<ScrollView style={{backgroundColor:'yellow'}}>
<Text>body</Text>
</ScrollView>
<View><Text>sticky footer</Text></View>
</View>
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