1

I have a project that I have recently upgraded to React 17 and RN 0.68.0. I have upgraded most of my dependencies, but have left React-Navigation at 4.4.4. Everything used to work fine before the upgrade and now seems to work fine with my iOS build. Android, however, is another story. When I replace this code in app/src/main/MainActivity.java

public class MainActivity extends ReactActivity {
 @Override
  protected ReactActivityDelegate createReactActivityDelegate() {
    return new MainActivityDelegate(this, getMainComponentName());
  }
  ...

with the following (as specified in the install for React-Navigation)

import com.facebook.react.ReactActivityDelegate;
import com.facebook.react.ReactRootView;
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
...
public class MainActivity extends ReactActivity {
  protected ReactActivityDelegate createReactActivityDelegate() {
    return new ReactActivityDelegate(this, getMainComponentName()) {
      @Override
      protected ReactRootView createRootView() {
        return new RNGestureHandlerEnabledRootView(MainActivity.this);
      }
    };
  }
  ...

then my Android build crashes at start-up (no specific error, just that it "stopped working"). If I leave the original function, then the app runs – with some problems (a "Render Error" that I think occurs when navigating to my switch navigators).

I'd really like to avoid having to go through the process of updating all my code to React-Navigation 5 or 6 right now. It's going to take me days and I'd rather save it for a (very) rainy day. Does anyone have any advice to help make this work or to help me figure out how to troubleshoot this?

0 Answers0