admin管理员组文章数量:1391925
I might be missing something small here but I can't seem to get my <Modal>
ponent to center in my React Native app. Here is the code for the modal:
...
<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>
...
I tried doing this as well:
<Modal
visible={modalVisible}
onDismiss={hideModal}
contentContainerStyle={{
backgroundColor:'white',
padding:20,
width:'90%',
flex: 1,
alignItems: 'center',
justifyContent: 'center'
}}
>
Unsure what I'm missing here.
I might be missing something small here but I can't seem to get my <Modal>
ponent to center in my React Native app. Here is the code for the modal:
...
<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>
...
I tried doing this as well:
<Modal
visible={modalVisible}
onDismiss={hideModal}
contentContainerStyle={{
backgroundColor:'white',
padding:20,
width:'90%',
flex: 1,
alignItems: 'center',
justifyContent: 'center'
}}
>
Unsure what I'm missing here.
Share Improve this question asked Mar 23, 2022 at 19:37 patataskrpatataskr 3531 gold badge6 silver badges17 bronze badges1 Answer
Reset to default 7Try adding alignSelf:"center" to contentContainerStyle
本文标签: javascriptCenter React Native Paper ModalStack Overflow
版权声明:本文标题:javascript - Center React Native Paper Modal - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744738691a2622483.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论