I have a react-native Modal
, I would like to render it with rounded corners like this:
but if I define it like this:
<Modal
style={{
borderTopLeftRadius: 10,
borderTopRightRadius: 10,
overflow: 'hidden',
}}
nothing happens (at least on Android). I also tried to wrap the Modal
with a View
with the same style but with no more success.
What am I doing wrong?
You can just use rounded-0 bootstrap class. Show activity on this post. Show activity on this post. border-radius removes the rounded corners while border removes all borders (left, right, top, bottom) around the modal.
In your components folder, create a file called Modal. tsx and add the following code: import React from "react"; import { StyleSheet, View, Text, Button } from "react-native"; import RNModal from "react-native-modal"; type ModalProps = { isVisible: boolean; children: React.
You must add statusBarTranslucent props to Modal component and set it to true. Then you will get your desired output. No need to set transparent props to true or any other tedious styles.
The solution is to put a View
inside the Modal
(right after its decalration) with this style:
<Modal>
<View
style={{
borderTopLeftRadius: 10,
borderTopRightRadius: 10,
overflow: 'hidden',
}}
>
</Modal>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With