我有一个模式,我希望它在打开时占据设备的全屏。但它正在向右移动,而不是全屏。它的外观如下:
<Modal
animationType="slide"
transparent={true}
visible={isImageModalVisible}
onRequestClose={() => {
setIsImageModalVisible(false);
}}
>
<AvatarMediaSelection setModalVisible={setIsImageModalVisible}/>
</Modal>
这是模态,在这个模态中我有一个带有以下代码的组件:
<View style={styles.container}>
<ScrollView>
{ photos.length > 0 &&
<FlatList
data={photos}
numColumns={3}
keyExtractor={(item) => item.node.image.uri}
// onEndReached={() => setPhotosNum((prevState) => prevState + 50)}
onEndReached={({ distanceFromEnd }) => {
if (distanceFromEnd < 0) return;
return setPhotosNum((prevState) => prevState + 50)
}}
renderItem={({item}) => {
return(
<TouchableOpacity style={styles.imageContainer} onPress={() => handleImageChoosen(item.node.image)}>
<Image
style={styles.image}
source={{uri: item.node.image.uri}}
/>
</TouchableOpacity>
)
}}
/>
}
</ScrollView>
</View>
并具有以下样式:
container: {
backgroundColor: 'white',
flex: 1,
width: wp(100),
height: hp(100),
},
image: {
width: wp(33),
height: hp(25),
}