I want to make the grey box position is fixed, so when I scrolldown
or scrollup
the grey box is stay still on it position.
Is it possible to do such thing in React Native ?
Here's my code:
<View>
<ScrollView>
<View style={styles.continueToPaymentContainer}>
</View>
</ScrollView>
</View>
container: {
flex: 1,
// justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#fff'
},
continueToPaymentContainer:{
width:width,
height: 100,
position:'absolute',
bottom:0,
backgroundColor: 'grey',
}
I want to make the grey box position is fixed, so when I scrolldown
or scrollup
the grey box is stay still on it position.
Is it possible to do such thing in React Native ?
Here's my code:
<View>
<ScrollView>
<View style={styles.continueToPaymentContainer}>
</View>
</ScrollView>
</View>
container: {
flex: 1,
// justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#fff'
},
continueToPaymentContainer:{
width:width,
height: 100,
position:'absolute',
bottom:0,
backgroundColor: 'grey',
}
Share
Improve this question
asked May 11, 2018 at 4:54
kurniawan26kurniawan26
8234 gold badges17 silver badges36 bronze badges
2 Answers
Reset to default 5Try below code. You just have to add your view outside the scroll view.
<View>
<ScrollView>
// Do your stuff
</ScrollView>
<View style={styles.continueToPaymentContainer}>
</View>
</View>
container: {
flex: 1,
// justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#fff'
},
continueToPaymentContainer:{
width:width,
height: 100,
position:'absolute',
bottom:0,
backgroundColor: 'grey',
}
I just found it
All I need to do is just put my grey box
on the outside of <ScrollView>
<View>
<ScrollView>
<Another element>
</ScrollView>
<View style={styles.continueToPaymentContainer}>
</View>
</View>
I hope this will helps for future search