react-navigation-switch-transitioner
react-navigation-switch-transitioner copied to clipboard
Native module cannot be null
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)
}
);

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.
@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.
@lorenzozanotto Were you able to solve it? I am having the same issue.
@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.
This fork fixes the issue.