如何在反应本机模态上设置 borderRadius?
How to set borderRadius on a react-native modal?
我有一个 react-native Modal
,我想用这样的圆角渲染它:
但是如果我这样定义它:
<Modal
style={{
borderTopLeftRadius: 10,
borderTopRightRadius: 10,
overflow: 'hidden',
}}
没有任何反应(至少在 Android 上)。我还尝试用相同样式的 View
包装 Modal
,但没有成功。
我做错了什么?
解决方案是将 View
放在 Modal
中(紧跟其声明之后),样式如下:
<Modal>
<View
style={{
borderTopLeftRadius: 10,
borderTopRightRadius: 10,
overflow: 'hidden',
}}
>
</Modal>
我有一个 react-native Modal
,我想用这样的圆角渲染它:
但是如果我这样定义它:
<Modal
style={{
borderTopLeftRadius: 10,
borderTopRightRadius: 10,
overflow: 'hidden',
}}
没有任何反应(至少在 Android 上)。我还尝试用相同样式的 View
包装 Modal
,但没有成功。
我做错了什么?
解决方案是将 View
放在 Modal
中(紧跟其声明之后),样式如下:
<Modal>
<View
style={{
borderTopLeftRadius: 10,
borderTopRightRadius: 10,
overflow: 'hidden',
}}
>
</Modal>