Embedded WebViews are not interactive on Android
See original GitHub issueBug
WebView is not interactive on Android (works fine on iOS) even with NativeViewGestureHandler
. Cannot scroll, and tapping works occasionally but usually just selects text. Perhaps related to WebView moving out of react-native and into its own library? See https://github.com/software-mansion/react-native-gesture-handler/issues/648.
Environment info
Library | Version |
---|---|
@gorhom/bottom-sheet | ^2 |
react-native | 0.63.4 |
react-native-reanimated | ^1.13.2 |
react-native-gesture-handler | ^1.10.1 |
react-native-webview | ^11.4.3 |
Steps To Reproduce
- Embed a webview into a bottom sheet component
- Try scrolling or tapping items in the webview
Describe what you expected to happen:
- WebView gestures should work
Reproducible sample code
<BottomSheet index={1} snapPoints={[0, '85%']}>
<NativeViewGestureHandler disallowInterruption={true}>
<WebView
originWhitelist={['*']}
scalesPageToFit={true}
source={{
uri: 'https://news.ycombinator.com/',
}}
contentMode="mobile"
/>
</NativeViewGestureHandler>
</BottomSheet>
Android (doesn’t work):
https://user-images.githubusercontent.com/695981/122829982-8b603000-d29c-11eb-8bf5-04f3aca6a0de.mov
iOS (does work):
https://user-images.githubusercontent.com/695981/122830019-9adf7900-d29c-11eb-9006-f726f5775ce3.mov
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:10
Top Results From Across the Web
Android webview containing hyperlinks inside IFRAME not ...
As a workaround I implemented a new WebChromeClient class and overrode the onCreateWindow method. This method is triggered when the link is ...
Read more >Build web apps in WebView - Android Developers
Build web apps in WebView · On this page · Add a WebView to your app. Add a WebView in the activity layout;...
Read more >Upcoming security changes to Google's OAuth 2.0 ...
Embedded webviews implementing or extending Android WebView do not comply with Google's secure browser policy for its OAuth 2.0 ...
Read more >Communication from WebView to Native iOS/ Android App
Many mobile applications have common features like login with third party vendor in which, native layer should interact with embedded webview.
Read more >Embedded Youtube video not working on WebView - Treehouse
My app is a simple android WebView for mobile websites. I have problem with playing youtube embedded video. It only shows blackscreen.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
My workaround for such cases using
waitFor
prop as belowI have a hacky solution that works! You need to set
nestedScrollEnabled
on your WebView. However, it disables the pull to dismiss feature. In order to recreate this behavior you need to do the following:Let me know if you refine this solution. Happy coding!