Skip to content
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

NativeViewGestureHandler must be used as a descendant of GestureHandlerRootView #3325

Open
eharmshoagie opened this issue Jan 10, 2025 · 2 comments
Labels
Missing repro Platform: iOS This issue is specific to iOS

Comments

@eharmshoagie
Copy link

eharmshoagie commented Jan 10, 2025

Description

Hi,

I am being plagued with the following error, it seems to come out of nowhere. When it starts happening on one device, every other device and simulator I use gets affected.

ERROR Error: NativeViewGestureHandler must be used as a descendant of GestureHandlerRootView. Otherwise the gestures will not be recognized. See https://docs.swmansion.com/react-native-gesture-handler/docs/installation for more details.

This error is located at:
in NativeViewGestureHandler (created by RNGestureHandlerButton)
in RNGestureHandlerButton (created by InnerBaseButton)
in InnerBaseButton
in Unknown (created by GenericTouchable)
in GenericTouchable
in Unknown (created by CrashPage)
in RCTView (created by View)
in View
in StyledNativeComponent (created by Styled(View))
in Styled(View) (created by CrashPage)
in CrashPage (created by ErrorBoundary)
in ErrorBoundary (created by App)
in RecoilRoot_INTERNAL (created by RecoilRoot)
in RecoilRoot (created by App)
in QueryClientProvider (created by App)
in ThemeProvider (created by App)
in DatadogProvider (created by App)
in App
in RCTView (created by View)
in View (created by AppContainer)
in RCTView (created by View)
in View (created by AppContainer)
in AppContainer
in POC(RootComponent), js engine: hermes

We use the GestureHandlerRootView in one screen that looks like this, but the error appears everywhere else in our app.

image

I've done the following with unpredictable results.

  • delete npm modules
  • delete pods, podfile.lock
  • xcode clean project
  • delete DerivedData folder
  • android studio clean project
  • reboot computer, all devices

In this instance today, I have the following code

  • in my screen
    const safe = safeToLowerCase(email);

  • in a helper file string.ts
    export const safeToLowerCase = (str: string) => str?.toLowerCase() || '';

If I remove the safeToLowerCase() in my screen, the error does not happen. It makes no sense - If i leave the code in, when I try my other devices and simulators it starts to happen in the same place, even though it was not happening on that device previously. Moving safeToLowerCase to my screen .tsx has no effect.

This happens with iOS and Android.

I've viewed the 1 issue on this repo that mentions a similar issue
#2488

Ive removed all TouchableOpacity's and ScrollViews that import from react-native-gesture-handler, only the one instance in my screenshot above is using the library.

Also moved the RootView to our App.tsx

image

I feel like once the error happens, something is getting stored or cached in the codebase, as it infects all my other devices at exactly the same place once it starts happening on one device or simulator.

Any help would be amazing, I'm losing so much time fighting this.

Steps to reproduce

I don't have a reproducible scenario

Snack or a link to a repository

I cannot reproduce the issue it happens randomly

Gesture Handler version

2.18.0

React Native version

0.73.9

Platforms

iOS

JavaScript runtime

Hermes

Workflow

React Native (without Expo)

Architecture

Paper (Old Architecture)

Build type

Debug mode

Device

Real device

Device model

iphone 13, samsung galaxy s9, pixel 3

Acknowledgements

Yes

Copy link

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

@github-actions github-actions bot added Missing repro Platform: iOS This issue is specific to iOS labels Jan 10, 2025
@m-bert
Copy link
Contributor

m-bert commented Jan 10, 2025

Hi @eharmshoagie! Please provide reproducible example. Unfortunately those screenshots do not show much of your code.

Are you sure you've wrapped your app with GestureHandlerRootView? It looks like there's a piece of code that uses Gesture Handler that is not inside GestureHandlerRootView (maybe a modal?).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Missing repro Platform: iOS This issue is specific to iOS
Projects
None yet
Development

No branches or pull requests

2 participants