question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't be used with React Navigation/Drawer V6

See original GitHub issue

Description

Can’t be used with Drawer Navigator in React Navigation.

Expected behavior

Able to create and use Drawer Navigator with no exception.

Actual behavior & steps to reproduce

Just trying to create Drawer object.

import {createDrawerNavigator} from '@react-navigation/drawer';
const Drawer = createDrawerNavigator();

And it throws an error.

 ERROR  TypeError: null is not an object (evaluating '_ReanimatedModule.default.createNode')
 ERROR  Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect. 
      This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.
 ERROR  Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect. 
      This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.

Snack or minimal code example

// source: https://reactnavigation.org/docs/drawer-based-navigation

import * as React from 'react';
import {Button, View} from 'react-native';
import {createDrawerNavigator} from '@react-navigation/drawer';
import {NavigationContainer} from '@react-navigation/native';

function HomeScreen({navigation}) {
  return (
    <View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}>
      <Button
        onPress={() => navigation.navigate('Notifications')}
        title="Go to notifications"
      />
    </View>
  );
}

function NotificationsScreen({navigation}) {
  return (
    <View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}>
      <Button onPress={() => navigation.goBack()} title="Go back home" />
    </View>
  );
}

const Drawer = createDrawerNavigator(); // error

export default function App() {
  return (
    <NavigationContainer>
      <Drawer.Navigator initialRouteName="Home">
        <Drawer.Screen name="Home" component={HomeScreen} />
        <Drawer.Screen name="Notifications" component={NotificationsScreen} />
      </Drawer.Navigator>
    </NavigationContainer>
  );
}

Package versions

  • React Native: 0.65.1
  • React Native Reanimated: 2.2.0
  • React Navigation Drawer: 6.1.4
  • React Navigation Native: 6.0.2
  • React Navigation Gesture Handler: 1.10.3
  • NodeJS: v16.6.2
  • Xcode:
  • Java & Gradle: 11.0.12

Affected platforms

  • Android
  • iOS
  • Web

Temporary Resolve Method

It works with "react-native-reanimated": "^1.13.2".

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:19
  • Comments:27 (5 by maintainers)

github_iconTop GitHub Comments

16reactions
piaskowykcommented, Aug 24, 2021

Hey @efefurkankarakaya
We are working on a solution to this problem.

14reactions
Manil-SoftNEPcommented, Jun 6, 2022

This worked for me.

  1. npm i react-native-reanimated
  2. Add plugins: ['react-native-reanimated/plugin'], below presets in ‘<your_app_root_folder>/babel.config.js’.
  3. Add import 'react-native-gesture-handler'; to the top of ‘<your_app_root_folder>/App.js’.
  4. Reset the cache using npx react-native start --reset-cache.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Drawer Navigator | React Navigation
The Drawer Navigator supports both Reanimated 1 and Reanimated 2. If you want to use Reanimated 2, make sure to configure it following...
Read more >
Drawer navigation
Common pattern in navigation is to use drawer from left (sometimes right) side for navigating between screens.
Read more >
Troubleshooting | React Navigation
Troubleshooting. This section attempts to outline issues that users frequently encounter when first getting accustomed to using React Navigation.
Read more >
Getting started - React Navigation
Install the required packages in your React Native project: ... React Navigation is made up of some core utilities and those are then...
Read more >
Configuring links | React Navigation
It's not possible to pass params to the initial screen through the URL. So make sure that your initial route doesn't need any...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found