react-native-gesture-handler not working in my project(s)?

Please provide the following:

  1. SDK Version: 44
  2. Platforms(Android/iOS/web/all): Android (only?)
  3. Add the appropriate “Tag” based on what Expo library you have a question on.

I found a very nice pinch to zoom example by wcandillon [1]. When I run that example on my device it works smoothly, however, when I use the code in my personal project (out commented almost everything it contains), the gesture handler does not work. I am new to react-native-gesture-handler and react-native-reanimated, but the documentation [2] does not mention anything else for installation (other than expo install and import at top of App.js). Any help is very welcome.

You can find my project here [3]. As far as I can see, I don’t do anything different, but since the original project works and mine doesn’t, I have to be missing a small detail.

[1] can-it-be-done-in-react-native/playground/src/Pinch at master · wcandillon/can-it-be-done-in-react-native · GitHub
[2] Sorry, new users can only post two links. Imagine the expo documentation here :slight_smile:
[3] GitHub - tomwaitforitmy/mangi-bevi at GestureHandlerNotWorking

I would like to edit my post, but I can’t find any edit button? I created a minimal not working example
on github

I found a solution:
You have to wrap your main app with <GestureHandlerRootView>. Any idea why the project of wcandillon (see github.com/wcandillon/can-it-be-done-in-react-native/tree/…) works on android without GestureHandlerRootView / gestureHandlerRootHOC ?

1 Like

I don’t know, but the installation docs here imply that you don’t have to use GestureHandlerRootView, but that if you don’t you’ll need to do “extra configuration”.

this is because it is using an old version where it wasn’t necessary to do so, it was previously set up natively

1 Like

That’s what I thought as well, but look at the package.json:
Mine:

"react-native": "0.64.3",
"react-native-gesture-handler": "~2.1.0", 
"react-native-reanimated": "~2.3.1",
"react-native-safe-area-context": "3.3.2",
"react-native-screens": "~3.10.1",

wcandillon:

"react-native": "0.64.3",
"react-native-gesture-handler": "~2.1.0",
"react-native-reanimated": "~2.3.1",
"react-native-safe-area-context": "3.3.2",
"react-native-screens": "~3.10.1",

My theory is:

  • It works for wcandillon, because he got lucky and react-navigation is wrapping his stuff for him
  • My example does not contain react-nativagtion
1 Like