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

Unsupported top level event type "onGestureHandlerStateChange" dispatched #320

Closed
punksta opened this issue Oct 21, 2018 · 205 comments
Closed

Comments

@punksta
Copy link

punksta commented Oct 21, 2018

I am getting crash when I touch the PanGestureHandler.

return (
			<PanGestureHandler
				onGestureEvent={this.onGestureEvent}
				onHandlerStateChange={this.onHandlerStateChange}
			>
				<Animated.View style={[style, panStyle]} {...rest}>
					{children}
				</Animated.View>
			</PanGestureHandler>
		);

package.json

    "react-native-gesture-handler": "1.0.8",
    "react": "^16.5.0",
    "react-native": "^0.57.2",

android versions:

  compileSdkVersion 27
    buildToolsVersion '27.0.3'

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 27
  }

    implementation "com.android.support:appcompat-v7:27.1.1"

crash log

Unsupported top level event type "onGestureHandlerStateChange" dispatched
extractEvents
    ReactNativeRenderer-dev.js:2471:6
extractEvents
    ReactNativeRenderer-dev.js:1016:8
runExtractedEventsInBatch
    ReactNativeRenderer-dev.js:1070:4
<unknown>
    ReactNativeRenderer-dev.js:2713:6
batchedUpdates$1
    ReactNativeRenderer-dev.js:15311:14
batchedUpdates
    ReactNativeRenderer-dev.js:2616:31
_receiveRootNodeIDEvent
    ReactNativeRenderer-dev.js:2711:17
receiveEvent
    ReactNativeRenderer-dev.js:2731:26
__callFunction
    MessageQueue.js:349:47
<unknown>
    MessageQueue.js:106:26
__guard
    MessageQueue.js:297:10
callFunctionReturnFlushedQueue
    MessageQueue.js:105:17

related issue: expo/expo#2067

@osdnk
Copy link
Contributor

osdnk commented Oct 22, 2018

Hi, @punksta
Thanks for the issue. Please, update react to '6.6.0-alpha.8af6728and react-native to 0.57.3 and if it won't help, write here again :)

@osdnk osdnk closed this as completed Oct 22, 2018
@punksta
Copy link
Author

punksta commented Oct 22, 2018

same here

Unsupported top level event type "onGestureHandlerStateChange" dispatched
extractEvents
    ReactNativeRenderer-dev.js:2530:6
extractEvents
    ReactNativeRenderer-dev.js:1073:8
runExtractedEventsInBatch
    ReactNativeRenderer-dev.js:1127:4
<unknown>
    ReactNativeRenderer-dev.js:2772:6
batchedUpdates$1
    ReactNativeRenderer-dev.js:15568:14
batchedUpdates
    ReactNativeRenderer-dev.js:2675:31
_receiveRootNodeIDEvent
    ReactNativeRenderer-dev.js:2770:17
receiveEvent
    ReactNativeRenderer-dev.js:2790:26
__callFunction
    MessageQueue.js:349:47
<unknown>
    MessageQueue.js:106:26
__guard
    MessageQueue.js:297:10
callFunctionReturnFlushedQueue
    MessageQueue.js:105:17

@osdnk
Copy link
Contributor

osdnk commented Oct 22, 2018

@punksta
Did you try my code with these versions?

@osdnk
Copy link
Contributor

osdnk commented Oct 22, 2018

Could you build a showcase repo?

@punksta
Copy link
Author

punksta commented Oct 22, 2018

@osdnk no, it's my opensource project actually.
recent code in dev branch. I use your library here: https://github.com/punksta/Cat-or-dog/blob/dev/src/containers/DraddingFallingV2.js#L187

steps to reproduce:

  1. start the app in debug mode on android
  2. press "play"
  3. press "start game"
  4. try to touch any falling image

if you need minimal example I can try to make it later.

@punksta
Copy link
Author

punksta commented Oct 23, 2018

@osdnk if you need more info or smaller example, let me know.

@Jyrno42
Copy link

Jyrno42 commented Nov 14, 2018

Having the same problem on react-native 0.57.5. I am using this library through react-navigation, if that makes a difference.

E: Fixed it by doing the patch of UIManager.RCTView.directEventTypes in my code as well. The patch is here in the codebase if anyone is wondering: https://github.com/kmagiera/react-native-gesture-handler/blob/master/GestureHandler.js#L46

@balthazar
Copy link

@osdnk Getting the same issue with a Drawer component using:

  • react-native 0.57.7
  • react-navigation 3.0.2
  • react-native-gesture-handler 1.0.10

@Jyrno42 what versions are you using?

@Jyrno42
Copy link

Jyrno42 commented Dec 3, 2018

  • react-native: 0.57.5
  • react-navigation: 3.0.0
  • react-native-gesture-handler: 1.0.9

E: So I am a bit behind your versions.

@enahum
Copy link

enahum commented Dec 3, 2018

Same issue here I'm using

  • react-native-navigation: 1.1.492
  • react-native: 0.57.5
  • React: 16.6.3
  • react-native-gesture-handler: 1.0.10

the packager also crashes with

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0x10003a08d node::Abort() [/Users/enahum/.nvm/versions/node/v10.11.0/bin/node]
 2: 0x10003a297 node::OnFatalError(char const*, char const*) [/Users/enahum/.nvm/versions/node/v10.11.0/bin/node]
 3: 0x1001d2455 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/Users/enahum/.nvm/versions/node/v10.11.0/bin/node]
 4: 0x10059d6d2 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/Users/enahum/.nvm/versions/node/v10.11.0/bin/node]
 5: 0x1005a01a5 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [/Users/enahum/.nvm/versions/node/v10.11.0/bin/node]
 6: 0x10059c04f v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/Users/enahum/.nvm/versions/node/v10.11.0/bin/node]
 7: 0x10059a224 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/Users/enahum/.nvm/versions/node/v10.11.0/bin/node]
 8: 0x10059a725 v8::internal::Heap::CollectAllAvailableGarbage(v8::internal::GarbageCollectionReason) [/Users/enahum/.nvm/versions/node/v10.11.0/bin/node]
 9: 0x1005a6b81 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/Users/enahum/.nvm/versions/node/v10.11.0/bin/node]
10: 0x1005789c4 v8::internal::Factory::NewRawTwoByteString(int, v8::internal::PretenureFlag) [/Users/enahum/.nvm/versions/node/v10.11.0/bin/node]
11: 0x10089051b v8::internal::IncrementalStringBuilder::Extend() [/Users/enahum/.nvm/versions/node/v10.11.0/bin/node]
12: 0x100678d0b v8::internal::JsonStringifier::SerializeString(v8::internal::Handle<v8::internal::String>) [/Users/enahum/.nvm/versions/node/v10.11.0/bin/node]
13: 0x10067c258 v8::internal::JsonStringifier::Result v8::internal::JsonStringifier::Serialize_<true>(v8::internal::Handle<v8::internal::Object>, bool, v8::internal::Handle<v8::internal::Object>) [/Users/enahum/.nvm/versions/node/v10.11.0/bin/node]
14: 0x10067b684 v8::internal::JsonStringifier::Result v8::internal::JsonStringifier::Serialize_<false>(v8::internal::Handle<v8::internal::Object>, bool, v8::internal::Handle<v8::internal::Object>) [/Users/enahum/.nvm/versions/node/v10.11.0/bin/node]
15: 0x10067ab3d v8::internal::JsonStringifier::Result v8::internal::JsonStringifier::Serialize_<false>(v8::internal::Handle<v8::internal::Object>, bool, v8::internal::Handle<v8::internal::Object>) [/Users/enahum/.nvm/versions/node/v10.11.0/bin/node]
16: 0x10067ce2c v8::internal::JsonStringifier::Result v8::internal::JsonStringifier::Serialize_<true>(v8::internal::Handle<v8::internal::Object>, bool, v8::internal::Handle<v8::internal::Object>) [/Users/enahum/.nvm/versions/node/v10.11.0/bin/node]
17: 0x10067b684 v8::internal::JsonStringifier::Result v8::internal::JsonStringifier::Serialize_<false>(v8::internal::Handle<v8::internal::Object>, bool, v8::internal::Handle<v8::internal::Object>) [/Users/enahum/.nvm/versions/node/v10.11.0/bin/node]
18: 0x100676f8f v8::internal::JsonStringifier::Stringify(v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>) [/Users/enahum/.nvm/versions/node/v10.11.0/bin/node]
19: 0x100290df6 v8::internal::Builtin_Impl_JsonStringify(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/Users/enahum/.nvm/versions/node/v10.11.0/bin/node]
20: 0x2777add5c17d 
21: 0x2777add0a5a3 
22: 0x2777adde8d5f 
23: 0x2777add118b5 
24: 0x2777add0a5a3 
Abort trap: 6
events.js:167
      throw er; // Unhandled 'error' event
      ^

Error: write EPIPE
    at WriteWrap.afterWrite [as oncomplete] (net.js:788:14)
Emitted 'error' event at:
    at onwriteError (_stream_writable.js:431:12)
    at onwrite (_stream_writable.js:456:5)
    at _destroy (internal/streams/destroy.js:40:7)
    at Socket._destroy (net.js:613:3)
    at Socket.destroy (internal/streams/destroy.js:32:8)
    at WriteWrap.afterWrite [as oncomplete] (net.js:790:10)

@enahum
Copy link

enahum commented Dec 3, 2018

can we re-opened this issue please?

@osdnk osdnk reopened this Dec 3, 2018
@balthazar
Copy link

Because my navigators were created asynchronously, the handler was registered too late and thus throwing this error. I fixed the issue by simply doing:

import 'react-native-gesture-handler'

at the top of my index.js 🙂

@enahum
Copy link

enahum commented Dec 3, 2018

Awesome @balthazar that seems to have done it

@enahum
Copy link

enahum commented Dec 3, 2018

perhaps I should open another issue, but after this was no longer throwing the error no the PanGestureHandler works but after the gesture finishes it won't start again unless I re-mount the component

@jamsch
Copy link

jamsch commented Dec 12, 2018

Upgrading to 0.58.0-rc.1 gives me this issue when trying to open my drawer

@osdnk
Copy link
Contributor

osdnk commented Dec 13, 2018

@jamsch
Could you clarify a bit? Which drawer do you use? How do you import it?

@jamsch
Copy link

jamsch commented Dec 13, 2018

@osdnk Using the React Navigation v3 DrawerNavigator which is apparently using this library. I have a production build running on 0.57.6 and it works fine though.

@yqz0203
Copy link

yqz0203 commented Dec 15, 2018

Because my navigators were created asynchronously, the handler was registered too late and thus throwing this error. I fixed the issue by simply doing:

import 'react-native-gesture-handler'

at the top of my index.js 🙂

Resovled it, but how this happens. Module code is always running when code have been loaded, doesn't it?

Can you tell me why? Thank you.

============================

I make a terrible mistake, I export module by using get xxx(){}, so it makes module code lazy running while it is required by other modules.

@sinhpn92
Copy link

sinhpn92 commented Jan 31, 2019

I have same issue with:

"react-navigation": "^3.1.0",
"react-native-gesture-handler": "^1.0.15",

I did put import 'react-native-gesture-handler' on top of index.js but it's doesn't work :(

@brendandestefano
Copy link

I'm also still seeing this error. I put import 'react-native-gesture-handler'; in my file that has createAppContainer but still seeing the error.

I'm using:
"react-navigation": "3.0.9", "react-native-gesture-handler": "^1.0.12",

Any ideas @yqz0203 ?

@fsmaiorano
Copy link

@brendandestefano

Try put this import in the first index.js of your application.

Like this:

import "react-native-gesture-handler";

import { AppRegistry } from "react-native";  

import App from "./src/App";

import { name as appName } from "./app.json";

@sinhpn92
Copy link

sinhpn92 commented Feb 7, 2019

@fsmaiorano Downgrade to "react-native-gesture-handler": "^1.0.9" will working fine.

@Jyrno42
Copy link

Jyrno42 commented Feb 13, 2019

On react-native 0.58.3 this occurs for me only in a production build with Android. Tried to work around it by doing the following in my codebase but it did not help. My current theory is that it is somehow related to minification of javascript which breaks the patching logic.

E: Nope, disabled minification, issue still occurs.
E2: Saw the message of this commit and updated my patch accordingly. All good now :)

index.js:

import './thepatch';
import './App/index'; // AppRegistry.registerComponent in here

thepatch.js:

import { NativeModules } from 'react-native';

const { UIManager } = NativeModules;

if (UIManager) {
// Add gesture specific events to genericDirectEventTypes object exported from UIManager
// native module.
// Once new event types are registered with react it is possible to dispatch these
// events to all kind of native views.
    UIManager.genericDirectEventTypes = {
        ...UIManager.genericDirectEventTypes,
        onGestureHandlerEvent: { registrationName: 'onGestureHandlerEvent' },
        onGestureHandlerStateChange: {
            registrationName: 'onGestureHandlerStateChange',
        },
    };
}

@osdnk
Copy link
Contributor

osdnk commented Feb 13, 2019

Thanks for attaching context! I’ll try to figure out what’s going on soon

@MarinaAmy
Copy link

Bonjour @NickCain ,
j'ai le même problème que vous actuellement: /
Avez-vous réussi à résoudre?
Si oui, pouvez-vous partager votre solution s'il vous plaît.
Je vous remercie

Salut @MarinaArimany ,
Non, j'ai toujours le problème et j'ai cherché partout une solution, Si jamais vous découvrez la solution, pouvez-vous partager avec moi?
Il arrive à un point où je pourrais avoir à envisager une réécriture
Merci,

@NickCain Oui pas de soucis actuellement je cherche une solution: /
Merci

@NickCain I found the solution to my problem, it was because of a method in my page that made everything bug. Review each line of your code, I hope you find the solution.

Have a good day :)

@NickCain
Copy link

NickCain commented Jul 9, 2020

Thanks @MarinaArimany for getting back to me... looks like a big debugging session is coming up haha.

@mikehardy
Copy link

If you follow the bisect strategy the error is on average 4 tests away from discovery and a maximum of 6 I think? Stay organized in your bughunt and you'll find it :)

@Tinmania2018
Copy link

I had this problem as well. The app crashed in release mode when opening the drawer menu. Everything else worked fine.
Fixed with the following suggestions stated above;
import 'react-native-gesture-handler' at the top of app.js and index.js
Updating react-native-gesture-handler to 1.5.2

@Beamanator
Copy link

I updated react-native-gesture-handler from 1.5.0 to 1.5.2, also not experiencing those crashes anymore.

RN version 0.61.4

Note: I only experienced this crash on iOS, after updating Xcode to v12

@iamabdulhaseeb
Copy link

Because my navigators were created asynchronously, the handler was registered too late and thus throwing this error. I fixed the issue by simply doing:

import 'react-native-gesture-handler'

at the top of my index.js 🙂

This didnt work for me!

@abdymm
Copy link

abdymm commented Mar 27, 2021

already add

import 'react-native-gesture-handler'

still crashed on release mode, when i remove NavigationContainer it running well

:(

@NicholasLoh
Copy link

Because my navigators were created asynchronously, the handler was registered too late and thus throwing this error. I fixed the issue by simply doing:

import 'react-native-gesture-handler'

at the top of my index.js slightly_smiling_face

This didnt work for me!

did you clear the cache of the app? I clear the cache of the application and it works

@abdymm
Copy link

abdymm commented Apr 19, 2021

oh ya it works now, i just re create brand new RN app, and it work now :)
@NicholasLoh

@TNicholson11
Copy link

TNicholson11 commented Apr 29, 2021

Just a heads up to anyone migrating to React Native 0.64.* that inlineRequires are now enabled by default in metro.config.js causing the "solution" to this issue to no longer function.

...
getTransformOptions: async () => ({
  transform: {
    experimentalImportSupport: false,
    inlineRequires: false, // set to FALSE .. RN64 has as TRUE
  },
}),
...

Please advise if there is another solution out there... we would love to get the startup performance enhancements from enabling inlineRequires.

Original reference: #439 (comment)

@SudoPlz
Copy link

SudoPlz commented Jun 14, 2021

I think we could also use a blockList in inline requires (like so) so that we don't have to lose the benefits of inline requires 100% (and just disable it for react-native-gesture-handler)

@TNicholson11
Copy link

TNicholson11 commented Jun 14, 2021

I think we could also use a blockList in inline requires (like so) so that we don't have to lose the benefits of inline requires 100% (and just disable it for react-native-gesture-handler)

The reason we were even upgrading to RN64 in the first place was to enable Hermes cross-platform so unfortunately this isn't an option for us, but might works for others!

From your link:

Note: If you are using Hermes JS Engine, you should not have RAM bundles feature enabled. In Hermes, when loading the bytecode, mmap ensures that the entire file is not loaded. Using Hermes with RAM bundles might lead to issues, because those mechanisms are not compatible with each other.

@kj800x
Copy link

kj800x commented Jun 18, 2021

Reading the React Native docs on event sending, my understanding is that the native side should not be sending events to the JS side if there are no JS listeners attached. I think what adding the import 'react-native-gesture-handler' statement to the top of index.js does is ensure that there is a JS listener registered as soon as possible, but based on the discussion above around Hermes, that might not work long-term.

The React Native docs mention the native side being able to have startObserving and stopObserving methods. Would it be possible to have react-native-gesture-handler support those startObserving and stopObserving and then not send the events to the JS if there are no listeners observing those events?

I may also be completely misinterpreting the issue. The RN docs mention triggering a warning when sending an event with no listeners, but nothing about throwing an Error in that case. Maybe this is something else?

@jgillick
Copy link

We're also experiencing the issue with RN64 and need the performance benefits of Hermes. Sounds like this issue should be reopened?

@Hless
Copy link

Hless commented Jul 6, 2021

I think we could also use a blockList in inline requires (like so) so that we don't have to lose the benefits of inline requires 100% (and just disable it for react-native-gesture-handler)

This is right. If you read the docs carefully it actually states that preloading improves performance, because it bundles modules that needed to be loaded initially anyway. You can also use the preloadedModules/blockList to make sure react-native-gesture-handler is imported before any other modules. With this in mind you can keep inline requires enabled, improve startup performance even further and fix the error at the same.

I've solved it by creating a modulePaths.js using the method in the linked documentation. Make sure that it includes the following files:

  "node_modules/react-native-gesture-handler/src/Directions.ts",
  "node_modules/react-native-gesture-handler/src/State.ts",
  "node_modules/react-native-gesture-handler/src/gestureHandlerRootHOC.tsx",
  "node_modules/react-native-gesture-handler/src/GestureHandlerRootView.tsx",
  "node_modules/react-native-gesture-handler/src/handlers/gestureHandlers.ts",
  "node_modules/react-native-gesture-handler/src/handlers/createHandler.ts",
  "node_modules/react-native-gesture-handler/node_modules/fbjs/lib/areEqual.js",
  "node_modules/react-native-gesture-handler/src/RNGestureHandlerModule.ts",
  "node_modules/react-native-gesture-handler/src/PlatformConstants.ts",
  "node_modules/react-native-gesture-handler/src/handlers/createNativeWrapper.tsx",
  "node_modules/react-native-gesture-handler/src/handlers/NativeViewGestureHandler.ts",
  "node_modules/react-native-gesture-handler/src/components/GestureButtons.tsx",
  "node_modules/react-native-gesture-handler/src/components/GestureHandlerButton.tsx",
  "node_modules/react-native-gesture-handler/src/components/touchables/index.ts",
  "node_modules/react-native-gesture-handler/src/components/touchables/TouchableNativeFeedback.tsx",
  "node_modules/react-native-gesture-handler/src/components/touchables/TouchableWithoutFeedback.tsx",
  "node_modules/react-native-gesture-handler/src/components/touchables/GenericTouchable.tsx",
  "node_modules/react-native-gesture-handler/src/components/touchables/TouchableOpacity.tsx",
  "node_modules/react-native-gesture-handler/src/components/touchables/TouchableHighlight.tsx",
  "node_modules/react-native-gesture-handler/src/components/GestureComponents.tsx",
  "node_modules/react-native-gesture-handler/src/components/Swipeable.tsx",
  "node_modules/react-native-gesture-handler/src/components/DrawerLayout.tsx",
  "node_modules/react-native-gesture-handler/src/index.ts"

After creating the file, return the configuration in getTransformOptions property of your metro.config.js file with your moduleMap as described in the documentation. import 'react-native-gesture-handler; should still be the first line in your index.js

Note that the list above works with RNGH version 1.10.3 in combination with TypeScript, not sure how the list looks without typescript

@Hless
Copy link

Hless commented Jul 6, 2021

@TNicholson11 I see no problem with using Hermes and inline requires in combination with the blockList option. If anything, it should speed up your Hermes-enabled app even further. RAM bundles should be disabled when using Hermes, so the quote you linked should also not have any effect on the blockList functionality. Or am I missing something here?

Edit: Upon rereading the docs one more time, I see where the confusion arises. It says that the inline requires part is meant for RAM bundles only, but AFAIK the preloading/blockList functionality also works with Hermes when you don't have RAM bundles enabled. (e.g. Hermes is the alternative to RAM bundles)

@TNicholson11
Copy link

Upon rereading the docs one more time, I see where the confusion arises. It says that the inline requires part is meant for RAM bundles only, but AFAIK the preloading/blockList functionality also works with Hermes when you don't have RAM bundles enabled. (e.g. Hermes is the alternative to RAM bundles)

Emphasis mine.. but yes, this was indeed where my confusion / concern came from @Hless ... I read that as if RAM Bundles are a prerequisite to using a blockList for inline requires but I'm thrilled to be wrong on that one. I will experiment with our app and report back when I get the time.

Thanks for the info!

@elsurudo
Copy link

Because my navigators were created asynchronously, the handler was registered too late and thus throwing this error. I fixed the issue by simply doing:

import 'react-native-gesture-handler'

at the top of my index.js 🙂

This worked for me on the prod build with:

"react-native": "0.64.1",
"react-native-gesture-handler": "1.10.3",

but it seems really ugly and "magical" IMO.

@daniel-nagy
Copy link

If you want to use inlineRequires and don't want to hardcode a bunch of paths

const RNGestureHandlerModule = "react-native-gesture-handler";

const preloadedModules = new Proxy(
  {},
  {
    get(_target, prop, _receiver) {
      return prop.includes(RNGestureHandlerModule);
    },
    has(_target, prop) {
      return prop.includes(RNGestureHandlerModule);
    }
  }
);

module.exports = {
  transformer: {
    getTransformOptions: () => ({
      transform: {
        inlineRequires: {
          blockList: preloadedModules
        },
        preloadedModules
      }
    })
  }
};

Would be nice if inlineRequires and preloadedModules could be a function.

@mikehardy
Copy link

mikehardy commented Jul 30, 2021

Of note: hermes did not used to have Proxy support but it does now, for anyone curious if this is compatible. There should be no issues here (though they that may not matter a bit at the bundler level...)

@surhidamatya
Copy link

Because my navigators were created asynchronously, the handler was registered too late and thus throwing this error. I fixed the issue by simply doing:

import 'react-native-gesture-handler'

at the top of my index.js 🙂

This worked for me. I was facing this issue on iOS build but however I was not facing this issue in android build

"react-native": "0.65.1",
"react-native-gesture-handler": "1.10.3",

@ferdicus
Copy link

ferdicus commented Dec 7, 2021

Is this workaround still required with version 2.x.x?
build with this config:

"react-native": "0.66.3",
"@react-navigation/material-top-tabs": "^6.0.6",
"@react-navigation/native": "^6.0.6",
"@react-navigation/stack": "^6.0.11",
"react-native-gesture-handler": "^2.1.0",

Seems to work fine 🤔

@isotopeee
Copy link

@brendandestefano

Try put this import in the first index.js of your application.

Like this:

import "react-native-gesture-handler";

import { AppRegistry } from "react-native";  

import App from "./src/App";

import { name as appName } from "./app.json";

Worked for me too! Thanks @fsmaiorano

@ahaseeb001
Copy link

I guess this issue is because of index.js file , I fixed this issue by adding ON TOP in my index.js file ,
import 'react-native-gesture-handler' -> index.js
HAPPY CODING :)

acarioni added a commit to Lightstreamer/Lightstreamer-example-StockList-client-reactnative that referenced this issue Mar 3, 2022
@amirbhz86
Copy link

amirbhz86 commented Mar 23, 2022

For building ios application , if you have index.ios.js file
You should put bottom code in top of that file

import 'react-native-gesture-handler'

@raykle
Copy link

raykle commented Aug 2, 2022

If you want to use inlineRequires and don't want to hardcode a bunch of paths

const RNGestureHandlerModule = "react-native-gesture-handler";

const preloadedModules = new Proxy(
  {},
  {
    get(_target, prop, _receiver) {
      return prop.includes(RNGestureHandlerModule);
    },
    has(_target, prop) {
      return prop.includes(RNGestureHandlerModule);
    }
  }
);

module.exports = {
  transformer: {
    getTransformOptions: () => ({
      transform: {
        inlineRequires: {
          blockList: preloadedModules
        },
        preloadedModules
      }
    })
  }
};

Would be nice if inlineRequires and preloadedModules could be a function.

This worked for me! Thanks! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet