-
-
Notifications
You must be signed in to change notification settings - Fork 986
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Panning gesture cannot working with Webview component #2454
Comments
any solution? |
Same problem here |
Hi! I've just looked into it. First of all, I'm pretty sure that the problem lies in iOSNagranie.z.ekranu.2024-01-4.o.14.21.44.movAndroidNagranie.z.ekranu.2024-01-4.o.14.23.01.movAs you can see on
It looks like it's a bit more complicated. In the case above, is it true that "Android works fine"? I have yet to find whether this difference is caused by Gesture Handler logic, or is it difference in The other question is, what is expected behavior in the case above, should it be only scrolling, only panning, or both of them active at the same time? Right now on native platforms if you wrap items with |
I'm having the same issue, posting here for visibility in case someone found a solution. Will keep looking myself as well. |
Hi! I've come back to this issue and it seems that the problem lies in the fact that Gesture Handler on iOS is designed to use native recognizers. I've looked into view hierarchy in Xcode and there's I know it's not the best solution, but have you tried to disable scrolling inside <WebView
scrollEnabled={false}
...
/> Note This prop works only on Warning This may not work on new architecture (at least it doesn't in my case) |
…wGestureHandler` (#3244) ## Description Currently wrapping `WebView` into `NativeViewGestureHandler` doesn't work as expected - events from `native` gesture do not reach `WebView`. This happens because inside `NativeViewGestureHandler` we call `onTouchEvent` method. In native hierarchy `WebView` is nested inside `ViewGroup`, which means that calling `onTouchEvent` instead of `dispatchTouchEvent` won't do anything to the `WebView`. Should fix #2454 Fixes #3196 ## Test plan Tested on example app and the code below: <details> <summary>Test code</summary> ```jsx import * as React from 'react'; import { View, StyleSheet } from 'react-native'; import { WebView } from 'react-native-webview'; import { Gesture, GestureDetector, GestureHandlerRootView, } from 'react-native-gesture-handler'; function WebViewScreen() { const native = Gesture.Native() .shouldActivateOnStart(true) .disallowInterruption(true); const pan = Gesture.Pan().onChange(console.log); const g = Gesture.Simultaneous(native, pan); return ( <View style={styles.webViewContainer}> <GestureDetector gesture={g}> <WebView source={{ uri: 'https://templates.tiptap.dev/nw6Cmz6HfD' }} style={styles.webView} javaScriptEnabled={true} domStorageEnabled={true} startInLoadingState={true} onError={(syntheticEvent) => { const { nativeEvent } = syntheticEvent; console.warn('WebView error: ', nativeEvent); }} /> </GestureDetector> </View> ); } export default function BuggyApp() { return ( <GestureHandlerRootView> <WebViewScreen /> </GestureHandlerRootView> ); } const styles = StyleSheet.create({ container: { flex: 1, alignItems: 'center', justifyContent: 'center', }, text: { fontSize: 18, }, webView: { flex: 1, }, webViewContainer: { flex: 1, width: '100%', }, }); ``` </details>
Description
Unable to detect panning gestures for the Webview(
react-native-webview
) component.Only onFinalize event is triggered in vertical panning.
Horizontal panning works normally.
Example:
Steps to reproduce
Above code.
Snack or a link to a repository
https://snack.expo.dev/XvDJr8BQq
Gesture Handler version
2.8.0
React Native version
0.70.5
Platforms
iOS
JavaScript runtime
None
Workflow
None
Architecture
None
Build type
None
Device
None
Device model
No response
Acknowledgements
Yes
The text was updated successfully, but these errors were encountered: