最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

navigation drawer - React Native: "TurboModuleRegistry.getEnforcing(...): 'RNGestureHandlerModule' coul

programmeradmin1浏览0评论

Question:

(I don't use IOS) I am working on a React Native project and encountering the following error when trying to run the app on an Android emulator:

ERROR  Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNGestureHandlerModule' could not be found. Verify that a module by this name is registered in the native binary., js engine: hermes

Additionally, I get this error:

ERROR  Invariant Violation: "EveryThink" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.

Project Setup & Versions:

  • React Native Version: 0.74.0

  • react-native-gesture-handler Version: 2.24.0

  • react-navigation Version: 7.1.1

  • @react-navigation/drawer Version: 7.1.1

  • @react-navigation/native Version: 6.1.8

  • Android Emulator: API Level 33

  • Java Version: 17

  • Node.js Version: 18.x

  • NPM Version: 9.x

  • OS: Windows 10


Question:

How can I resolve this issue? Is there anything else I need to check or configure to make react-native-gesture-handler work correctly?

Reinstalled react-native-gesture-handler

  1. npm uninstall react-native-gesture-handler
    npm install react-native-gesture-handler 
    
  2. Cleared Metro Bundler cache and restarted the server

    npx react-native start --reset-cache
    
  3. Cleaned the Android build

    cd android && ./gradlew clean && cd ..
    
  4. Ensured react-native-gesture-handler is imported at the top of index.js

    import 'react-native-gesture-handler';
    
  5. Checked MainActivity.java for necessary imports

    import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
    
  6. Rebuilt the project

    npx react-native run-android
    

Despite these steps, I am still encountering the same issue.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论