question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

react-native-modal doesn't behave well with react-native-webview

See original GitHub issue

react-native-modal works fine but when trying to render <WebView> inside the <Modal> the backdropColor is white instead of black and the modal cover the whole screen till I scroll the <WebView>. Once I scroll the <WebView> everything works fine!

before scrolling screenshot_2019-01-24-19-14-37-011_com growthhack after scrolling screenshot_2019-01-24-19-14-46-847_com growthhack

Modal <Modal isVisible={this.state.modalVisible} onBackButtonPress={() => this.setModalVisible(false)} onBackdropPress={() => this.setModalVisible(false)} > <View style={styles.modal}> <View style={styles.modalTop}> <Image source={require('../../assets/icons/logo.png')} style={styles.smallIcon} /> <Text style={styles.modalTopText} >About App</Text> </View> <About /> <View style={styles.modalBottom}> <Text style={styles.modalBottomText} onPress={() => this.setModalVisible(false)}>CLOSE</Text> </View> </View> </Modal>

modal: { flex: 1, backgroundColor: '#fff', borderRadius: 5 }, modalTop: { height: 50, flexDirection: 'row', marginTop: 15, marginLeft: 20, }, modalTopText: { color: '#000', fontSize: 20, fontWeight: '300', marginTop: 8, }, modalBottom: { height: 35, marginTop: 15, }, modalBottomText: { color: '#b13230', textAlign: 'right', marginRight: 10, fontSize: 15 }

About here is what is inside <About /> in the Modal <WebView ref={(ref) => { this.webview = ref; }} source={{ uri: 'https://growthhacktoolkit.com/android/about.html' }} style={{ flex: 1 }} scalesPageToFit={true} />

  • “react-native”: “0.57.8”
  • “react”: “16.6.3”
  • “react-native-webview”: “^3.1.2”
  • “react-native-modal”: “^7.0.2”
  • android
  • redmi note 4 - android version 7.0
  • windows 10

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
c19354837commented, May 14, 2019

Update react-native-webview to 5.8.2 will fix these issue.

1reaction
Nermin-Kcommented, Jan 25, 2019

@mmazzarolo Thanks for the help. I changed webview style as you said and also modal style but it is the same thing. It still covers the entire screen before scrolling. The only thing that has changed that the Modal appears to occupy less space due to margin. unfortunately, for now, it isn’t available to try it on a different Android device. But I will try and then let you know.

Read more comments on GitHub >

github_iconTop Results From Across the Web

react-native-modal doesn't behave well with react ... - GitHub
react-native-modal works fine but when trying to render <WebView> inside the <Modal> the backdropColor is white instead of black and the ...
Read more >
React Native Webview not loading any url ... - Stack Overflow
What I observed is that WebView doesn't work if it's nested. If component returns just WebView, then everything is fine. Share.
Read more >
20 Best React Native Calendars Libraries to Ease your App ...
Date picker for react native, light and does not use modals (will work on all ... React Native WebView is a modern, well-supported,...
Read more >
react-native-modal - npm
I can't show multiple modals one after another. Unfortunately right now react-native doesn't allow multiple modals to be displayed at the same ...
Read more >
React Native WebView: A complete guide - LogRocket Blog
But what if you wanted to include some functionality that requires JavaScript to be included, like dynamic features? Well, React Native WebView ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found