1
votes

Issue Description

I installed the library via npx react-native link react-native-navigation (and modifying the minSdkVersion in andoid/build.gradle).

When I run npx react-native run-android, the app is built and works fine, though I get the following error in the terminal:

error React Native CLI uses autolinking for native dependencies, but the following modules are linked manually: 
  - react-native-navigation (to unlink run: "react-native unlink react-native-navigation")

Since the lib has been linked manually, I add an entry in the react-native.config.js file to prevent react native to try to autolink the lib, as in:

module.exports = {
    dependencies: {
        'react-native-navigation': {
            platforms: {
                android: null, // disable Android platform, other platforms will still autolink if provided
            },
        }
    }
  };

Now, the CLI error is not longer shown and the app is successfully built, but I get an error in the emulator:

TypeError: null is not an object (evaluating "this.nativeCommandsModule.setRoot()").

Which comes about at my first Navigation.setRoot(...); call:

[index.js]

const start = () => {
    Navigation.events().registerAppLaunchedListener(() => {
        registerScreens();
        gotoInitialising();
        // gotoLogin();
    });
};

start();

My question is, what extra step should I take to get the lib to work and to not have a React Native CLI error, at the same time.

Environment

React Native Navigation version: 6.0.1 React Native version: 0.61.5 Platform(s) (iOS, Android, or both?): Android Device info (Simulator/Device? OS version? Debug/Release?): Android emulator API 28 - (emulator version 29.2.1-5889189) - Debug build

2
The TypeError you're getting is thrown since RNN has not been linked. The issue with minSdk should be resolved in 6.1.0guy.gc

2 Answers

0
votes

FYI, since [email protected], the link script has been fixed to update the minSDK for android as well.

Also you should not add react-native-navigation in react-native.config.js as the RNN library is required to be used in your native code. The team has updated the documentation to make the installation guide clearer: https://wix.github.io/react-native-navigation/docs/installing. If you follow the guide, it should be quite straightforward.

0
votes

run the following command: react-native unlink react-native-navigation