Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

help needed: Convert uni-modules to expo-modules

See original GitHub issue

Looks like Expo has deprecated uni-modules: And switched to expo-modules:

Now I was trying to get it to work for Android with react-native-navigation and i was able to migrate the code to get the app to compile successfully, but with no luck, the navigation is not working. I think the part where it gets stuck is in

As you can see, the code inside public class MainActivity extends NavigationActivity is not working and if I omit the code the app is compiled successfully, but the navigation is not working.

The following code is not working

package com.myApp;

import com.reactnativenavigation.NavigationActivity;

import com.facebook.react.ReactActivityDelegate;
import expo.modules.ReactActivityDelegateWrapper;

public class MainActivity extends NavigationActivity {
  protected String getMainComponentName() {
    return "MyApp";

  protected ReactActivityDelegate createReactActivityDelegate() {
    return new ReactActivityDelegateWrapper(this,
      new ReactActivityDelegate(this, getMainComponentName())

Some help would be appreciated.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

julianklumperscommented, Oct 29, 2021

I got it working for Android.

In leave it as it is

package com.myApp;

import com.reactnativenavigation.NavigationActivity;

public class MainActivity extends NavigationActivity {}

The key to get it working is in In the expo docs they explain you have to add new ReactNativeHostWrapper just skip this part and add the rest of the changes in and everything works fine! you can now use the new expo-modules.

package com.myApp;


import android.content.Context;
import android.content.res.Configuration;
import androidx.annotation.NonNull;
import com.facebook.react.PackageList;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.bridge.JSIModulePackage;
import com.reactnativenavigation.NavigationApplication;
import com.reactnativenavigation.react.NavigationReactNativeHost;
import com.facebook.react.ReactPackage;
import java.lang.reflect.InvocationTargetException;
import java.util.List;

import expo.modules.ApplicationLifecycleDispatcher;
import com.reactnativemmkv.MmkvModulePackage;

public class MainApplication extends NavigationApplication {

  private final ReactNativeHost mReactNativeHost = new NavigationReactNativeHost(this) {
        public boolean getUseDeveloperSupport() {
          return BuildConfig.DEBUG;

        protected List<ReactPackage> getPackages() {
          List<ReactPackage> packages = new PackageList(this).getPackages();
          // Packages that cannot be autolinked yet can be added manually here, for example:
          // packages.add(new RNVersionCheckPackage());
          packages.add(new LottiePackage());

          return packages;

        protected String getJSMainModuleName() {
          return "index";

        protected JSIModulePackage getJSIModulePackage() {
          return new MmkvModulePackage();

  public ReactNativeHost getReactNativeHost() {
    return mReactNativeHost;

  public void onCreate() {
    initializeFlipper(this, getReactNativeHost().getReactInstanceManager());

  public void onConfigurationChanged(@NonNull Configuration newConfig) {
    ApplicationLifecycleDispatcher.onConfigurationChanged(this, newConfig);

   * Loads Flipper in React Native templates. Call this in the onCreate method with something like
   * initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
   * @param context
   * @param reactInstanceManager
  private static void initializeFlipper(
      Context context, ReactInstanceManager reactInstanceManager) {
    if (BuildConfig.DEBUG) {
      try {
         We use reflection here to pick up the class that initializes Flipper,
        since Flipper library is not available in release mode
        Class<?> aClass = Class.forName("com.natutecscout.ReactNativeFlipper");
            .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
            .invoke(null, context, reactInstanceManager);
      } catch (ClassNotFoundException e) {
      } catch (NoSuchMethodException e) {
      } catch (IllegalAccessException e) {
      } catch (InvocationTargetException e) {

Hope this helps for others that are using rnn-starter and want to use expo-modules.

julianklumperscommented, Oct 27, 2021

Cool, I’m happy to help

Read more comments on GitHub >

github_iconTop Results From Across the Web

Migrate from react-native-unimodules to Expo modules
In this article you can read how to migrate from the old react-native-unimodules to the brand new Expo modules wth the expo package....
Read more >
Embracing Expo Modules in your React Native Projects
Are you looking for high-quality React Native native modules? Expo modules might be a good fit for you! Expo maintains about 70 native ......
Read more >
How to use expo module in react-native app? - Stack Overflow
I have existing react-native project and I want to use expo-in-app-purchases module, and can't find clear doc how to do that. unimodules ......
Read more >
brent on Twitter: "@sebastienlorber @expo i think it's too early for ...
react-native-unimodules is a library that lets you use Expo APIs in any React Native app. We first released support for automatically linking Expo...
Read more >
How to implement over the air updates with expo ... - Red Shift
Unimodules lets us use most Expo modules in a regular ol' React Native app. If you're implementing this into a non-Ignite app, you'll...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found