I am trying to display a youtube video inside a modal in react native.
Video gets displayed in the normal view(I.e., without a modal window) ,but I am not display the same video when it’s inside a modal.
Things I have tried so far:
//screen1.js
const [isVisible, setVisible] = useState(false);
<Touchable
onPress={() => setVisible(true)}
style={{
minHeight: 200,
backgroundColor: Colors.Black
}}>
<Text></Text>
</Touchable>
<Modal isVisible={isVisible} onBackdropPress={() => setVisible(false)}>
<View style={{ maxHeight: 400, backgroundColor: 'white' }}>
<WebView
javaScriptEnabled={true}
source={{
uri: 'https://www.youtube.com/embed/RJa4kG1N3d0'
}}
/>
</View>
</Modal>
PS : I have used modal from ‘'react-native-modal';