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

Native module cannot be null #9

Open
lorenzozanotto opened this issue Jan 30, 2019 · 5 comments
Open

Native module cannot be null #9

lorenzozanotto opened this issue Jan 30, 2019 · 5 comments

Comments

@lorenzozanotto
Copy link

After having followed the installation guide, linked the react-native-reanimated dependency and rebuilt the project, I get an error message saying "Native module cannot be null".

I'm creating a switch navigator with the react-navigation-switch-transitioner's createSwitchNavigator as follows. Is there a way to make this work?

import { createSwitchNavigator, withFadeTransition } from 'react-navigation-switch-transitioner';
import barNavigator from "./barNavigator";

export default createSwitchNavigator(
  {
    Main: withFadeTransition(barNavigator)
  }
);

simulator screen shot - iphone x - 2019-01-30 at 16 03 02

@elyalvarado
Copy link
Owner

Since version 0.1 you need to wrap the main navigator in a createAppContainer call AppContainers

This is because since react-navigation v3 that is the recommended default.

Note: In v2 and earlier, the containers in React Navigation are automatically provided by the create*Navigator functions. As of v3, you are required to use the container directly. In v3 we also renamed createNavigationContainer to createAppContainer.

If you're using an older version of react-navigation, you can call createContainedSwitchNavigator to have the container be created automatically if you're using it as a top level navigator.

Other than that, I've not seen your error before, but I've found sometimes that after recompiling is also a good thing to clear the metro cache, restart watchman with delete all, and delete all temporary files.

@lorenzozanotto
Copy link
Author

@elyalvarado thank you for the prompt response. Anyways I'm already wrapping the main navigator using the createAppContainer function. In fact all the navigation hierarchy works flawlessly with react-navigation 3. All the file caches have been deleted as well. I'll investigate tomorrow and report back.

@geekdevs
Copy link

@lorenzozanotto Were you able to solve it? I am having the same issue.

@lorenzozanotto
Copy link
Author

lorenzozanotto commented Feb 12, 2019

@lorenzozanotto Were you able to solve it? I am having the same issue.

I have not, so I decided to switch to a custom solution. Anyway, since this library depends on react-native-reanimated I would try to install it via manual linking the iOS and Android projects and without using the react-native link command.

@elyalvarado please note that no information on react-native-reanimated dependency is stated in the readme, hence no instruction on how to configure it properly.

@LuisRodriguezLD
Copy link

This fork fixes the issue.

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

No branches or pull requests

4 participants