admin管理员组文章数量:1401954
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
本文标签: javascriptHow to create fixed overlay ltViewgt React NativeStack Overflow
版权声明:本文标题:javascript - How to create fixed overlay <View> React Native - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744326357a2600746.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论