For some reason in this view the justify Content tag does not apply in my view ? I have tried applying it in the modalScreen view but that does not work either. Any ideas ?
function BottomPopup() {
return (
<View style={styles.modalScreen}>
<View style={styles.topbar}>
<MaterialCommunityIcons name="arrow-left" size={24} color="black" />
<Text>Create Post</Text>
<MaterialCommunityIcons name="content-save" size={24} color="black" />
</View>
<View>
<Text>hey</Text>
<Text>hey</Text>
</View>
</View>
);
}
const styles = StyleSheet.create({
modalScreen: {
alignItems: "center",
},
topbar: {
display: "flex",
flexDirection: "row",
justifyContent: "space-around",
},
});
在 modalScreen 样式中添加flex:1 ,如Snack.IO
import { Dimensions } from 'react-native'; const { width, height } = Dimensions.get('window'); const styles = StyleSheet.create({ modalScreen: { flex:1, alignItems: "center", backgroundColor: "yellow", }, topbar: { width: width, flexDirection: "row", justifyContent: "space-around", backgroundColor: "green", }, });
我不得不添加宽度:“100%”然后它就起作用了
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.