javascript - 如何创建固定覆盖反应原生
问题描述
我想让灰盒的位置是固定的,所以当我scrolldown
或者scrollup
灰盒静止不动的时候。
有可能在 React Native 中做这样的事情吗?
这是我的代码:
<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',
}
解决方案
试试下面的代码。您只需将视图添加到滚动视图之外。
<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',
}
推荐阅读
- android - android Logcat 中的错误消息
- graphics - 提高 JavaFx 3d 形状的透明度和光照
- javascript - 如何仅使用 javascript 将数据添加或推送到本地 JSON 文件
- react-native-android - 将 cloudinary 与 react-native 应用程序集成
- vue.js - 努力使用代码来使用手机硬件检测突然停止。
- python - 无法在scrapy脚本中禁用日志记录消息
- java - 在 macOS 上运行 Scala 和 Java 时加载 AnnotatedElement 和 CharSequence 时出错
- reactjs - 组件没有收到新的道具
- c# - 无法加载文件或程序集异常 HRResult: 0x80131044
- angular - 使用带有 Angular 6 的模型驱动模板显示选择组合