[英]How to produce a modal bottom to top animation with react-native-paper Modal?
[英]Center React Native Paper Modal
我可能在這里遺漏了一些小東西,但我似乎無法讓我的<Modal>
組件在我的 React Native 應用程序中居中。 這是模式的代碼:
...
<Portal>
<Modal
visible={modalVisible}
onDismiss={hideModal}
contentContainerStyle={{
backgroundColor:'white',
padding:20,
width:'90%'
}}
>
<ScrollView>
<Text>A long chunk of text</Text>
<Button
onPress={hideModal}
color='#5F9DA5'
mode='contained'
dark={true}
>
Cool!
</Button>
</ScrollView>
</Modal>
</Portal>
...
我也嘗試這樣做:
<Modal
visible={modalVisible}
onDismiss={hideModal}
contentContainerStyle={{
backgroundColor:'white',
padding:20,
width:'90%',
flex: 1,
alignItems: 'center',
justifyContent: 'center'
}}
>
不確定我在這里缺少什么。
嘗試將 alignSelf:"center" 添加到 contentContainerStyle
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.