react-native - Modal always visible

Viewed 228

I know there is a question here in stackoverflow react native modal always visible but didn't solve my problem.

My code:

import * as React from 'react'
import {Text, View, Modal} from 'react-native'

export default function App() {
    return (
        <Modal animationType="slide" visible={false}>
            <Text>Hello World :)</Text>
        </Modal>
    )
}

the problem is I hardcoded visible to false but again it is visible. How can this be fixed?

1 Answers

I have created an example here for you with react-native modal and using you code,

https://snack.expo.io/@waheed25/modalexample

You are rendering only modal

if it still not works for you add your code in the same snack.

Related