React-native-navigation: [v3] installation guide 0.60

Created on 12 Oct 2019  ·  18Comments  ·  Source: wix/react-native-navigation

Issue Description

Can we have installation guide for RNN v3+ and RN 0.60.
Is RNN support autolinking if so then why in this doc we linking it manualy https://wix.github.io/react-native-navigation/#/docs/Installing?

🏚 stale

Most helpful comment

As @jinshin1013 points out, autolinking stores packages within PackageList class, which you must import if you're upgrading to 0.60. Current RNN documentation does not mention this. Took me days to figure out this was the root of many of my problems.

Before 0.60:

protected List<ReactPackage> getPackages() {
   // No need to add RnnPackage and MainReactPackage
   return Arrays.<ReactPackage>asList(
     // eg. new RNPackage()
   );
 }

@Override
public List<ReactPackage> createAdditionalReactPackages() {
        return getPackages();
}

After 0.60:

@Nullable
@Override
public List<ReactPackage> createAdditionalReactPackages() {
   List<ReactPackage> packages = new PackageList(this).getPackages();
    // Packages that might not support autolinking can still go here
    // packages.add(new RNPackage());
    return packages;
 }

All 18 comments

@rendomnet I think by default linking doesn't change MyActivity.java and MainActivity.java. In order to use React Native Navigation We have to modified those files.

Check this repo for fresh installation.

@AndreiCalazans Do you have any other native modules in your project?

can you send the errors stack?

I have a few like react-native-maps, react-native-reanimated, react-native-firebase.

error.txt
Screen Shot 2019-10-13 at 09 02 42

To fix this error I have to manually link my native modules inside the MainApplication file.

return Arrays.<ReactPackage>asList(
    // eg. new VectorIconsPackage()
      new ReactNativeFirebaseAppPackage(),
      new ReactNativeFirebaseFirestorePackage(),
      new MapsPackage()

    );

Note, it looks like automatic linking works half way since I don't need to add the dependencies inside build.gradle

what version of RNN should we use now? 3.2.0?

If you like to use RN 0.60 and higher versions use V3. i will try to update that repo as soon as possible when RNN & RN release new updates.

I have a few like react-native-maps, react-native-reanimated, react-native-firebase.

error.txt
Screen Shot 2019-10-13 at 09 02 42

To fix this error I have to manually link my native modules inside the MainApplication file.

return Arrays.<ReactPackage>asList(
    // eg. new VectorIconsPackage()
      new ReactNativeFirebaseAppPackage(),
      new ReactNativeFirebaseFirestorePackage(),
      new MapsPackage()

    );

I have the same problem, noticed that when was trying to install firebase crashlytics, solved just linking manually too. RNN should fix the autolinking problem as soon as possible.

@Gerlison @AndreiCalazans It's normal thing when you use react native navigation. you have to normally link every native module.

@syedabuthahirm RNN v3 breaks RN0.60+ autolinking? Its breaks main feature of RN0.60+?

In old versions of react-native we have react-native link command. but that one is also sometimes break the application. whenever i tried to link with the above command i got issues with them after run that command.

Add this in your MainApplication.java to enable React Native's autolinking feature

import com.facebook.react.PackageList;

@Nullable
@Override
public List<ReactPackage> createAdditionalReactPackages() {
  @SuppressWarnings("UnnecessaryLocalVariable")
  List<ReactPackage> packages = new PackageList(this).getPackages();
  return packages;
}

As @jinshin1013 points out, autolinking stores packages within PackageList class, which you must import if you're upgrading to 0.60. Current RNN documentation does not mention this. Took me days to figure out this was the root of many of my problems.

Before 0.60:

protected List<ReactPackage> getPackages() {
   // No need to add RnnPackage and MainReactPackage
   return Arrays.<ReactPackage>asList(
     // eg. new RNPackage()
   );
 }

@Override
public List<ReactPackage> createAdditionalReactPackages() {
        return getPackages();
}

After 0.60:

@Nullable
@Override
public List<ReactPackage> createAdditionalReactPackages() {
   List<ReactPackage> packages = new PackageList(this).getPackages();
    // Packages that might not support autolinking can still go here
    // packages.add(new RNPackage());
    return packages;
 }

Couldn't set up RNN with auto-linking(RN 0.61, RNN 3.0.0). However could make it work with manual linking for RNN.

However there are so many bugs in 3.x.x so updating to RN 0.60+ is blocked by them

Couldn't set up RNN with auto-linking(RN 0.61, RNN 3.0.0). However could make it work with manual linking for RNN.

However there are so many bugs in 3.x.x so updating to RN 0.60+ is blocked by them

What bugs you're refering to?
I have a inital setup on RN 0.61.2 that works fine for while. But I would like to know the issues that can jump to my face

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.

The issue has been closed for inactivity.

Was this page helpful?
0 / 5 - 0 ratings