I want to create a custom view with react-native-modal in my custom view:
type Props = {isVisible: boolean;setVisible: void }<Modal isVisible={props.visible}......><Button title="colse" onPress={()=> props.setVisible}>
Then in my page:
const [isVisible,setVisible]= React.useState(false)const onClick= () =>{setVisible(!isVisible)}<MyView visible={isVisible} setVisible={onClick}/>
But when I click the button, nothing happens and there is no error.
If I change the code like this:
const [isVisible,setVisible]= React.useState(true)
the dialog will be shown at first, but cannot close.
I hope someone can give me an example of how to do that.