React native 在scrollView中反应本机100%宽度视图
我有一个水平滚动视图 在这个滚动视图中,我想显示多个全高和全宽视图 我不知道如何将每个视图的宽度设置为100% 实际上,它们的自动宽度大约为70%React native 在scrollView中反应本机100%宽度视图,react-native,view,scrollview,React Native,View,Scrollview,我有一个水平滚动视图 在这个滚动视图中,我想显示多个全高和全宽视图 我不知道如何将每个视图的宽度设置为100% 实际上,它们的自动宽度大约为70% <SafeAreaView style={styles.container}> <ScrollView style={styles.info} horizontal={true} > {this.state.list.map(item => ( <
<SafeAreaView style={styles.container}>
<ScrollView
style={styles.info}
horizontal={true}
>
{this.state.list.map(item => (
<View style={styles.item}>...</View>
))}
</ScrollView>
</SafeAreaView>
我试图把宽度:100%,但它当然没有工作作为例外
谢谢您需要计算设备或容器的宽度 从“react native”导入{Dimensions}; const screenWidth=尺寸。获取“窗口”。宽度;
您必须计算设备或容器的宽度 从“react native”导入{Dimensions}; const screenWidth=尺寸。获取“窗口”。宽度;
谢谢现在看来很明显…^^^我会接受答案的,很乐意帮忙。顺便说一句,这看起来像是一种黑客的方法,但我实际上一直在使用这种方法,包括在生产中。谢谢!现在看来很明显…^^^我会接受答案的,很乐意帮忙。顺便说一句,这看起来像是一种黑客的方法,但我实际上一直在使用这种方法,包括在生产中。
info: {
width: "100%",
height: "100%",
display: "flex"
},
item: { // props for the items in my views
display: "flex",
alignItems: "center",
justifyContent: "space-between",
height: "100%",
paddingTop: 30,
paddingBottom: 10
}