wix/react-native-navigation

There is an error "Module AppRegistry is not a registered callable module (calling runApplication)" when reload js.

Closed this issue ยท 31 comments

Issue Description

There is an error "Module AppRegistry is not a registered callable module (calling runApplication)" when reload js. But it's ok when normal start app.

Steps to Reproduce / Code Snippets / Screenshots

  1. start app with react-native run ios
  2. reload js with Command + R

Environment

  • React Native Navigation version: 2.0.0-experimental.266
  • React Native version: 0.42.3
  • Platform(s) (iOS, Android, or both?): iOS
  • Device info (Simulator/Device? OS version? Debug/Release?): iOS 9.3, iPhone 5s simulator

have you slove that?

@jaggerwang any news on that?
I get the same error when I reload the first time, then it works.

I don't remember how did I solve it, but It's ok with the latest version.

I'm using version 1.1.116, which is the latest and first time I boot the app (in debug mode), I can see a red screen saying Module AppRegistry is not a registered callable module (calling runApplication) for a split second, then it loads correctly. If I refresh, it always refreshes right.

However, in release mode, the error is there and it never boots. I'm not sure what I'm doing wrong but I've tried anything I've been able to think of.

+1, I seem to get this randomly. Reloading a few times until it works is the only work around I've got atm. Any fixes?

Dismissing the error and using the app as normal appears to have no ill effects, either.

@ghost - Suffering the same issue but on iOS only, have you found anything?

My error was to have AppRegistry.registerComponent("knipster", () => Component) inside an asyncronous block.

Apparently, it used to fail randomly but moving it outside the promise solved the issue.

I got the same issue as yours @maraujop . Did you manage to solve it ?

This bug only happened for the very first open of the app or first time after FB login on both Android and iOS.

if you are getting this error while using redux-persist, and you followed the tutorial for redux-persist integration in the docs. it tells you to put your registerScreens() function inside the persistStore(store, null, () => {...}) function. For me, moving registerScreens() out of that function resolved the error.

I am seeing this on android, not iOS. crashes with this error on reloading.

I am getting this when I add a second screen to a stack. Here is the stack:

        Navigation.setRoot({
          root: {
            stack: {
              children: [
                {
                  component: {
                    id: "pinCode",
                    name: "pinCode",
                    options: {
                      topBar: {
                        title: {
                          text: screenLabels.pinCode
                        }
                      }
                    }
                  }
                },
                {
                  component: {
                    id: "login",
                    name: "login",
                    options: {
                      topBar: {
                        title: {
                          text: screenLabels.login
                        }
                      }
                    }
                  }
                }
              ],
              options: {
                topBar: {
                  title: {
                    color: "rgba(60, 109, 240, 0.87)",
                    fontFamily: "Nunito",
                    fontSize: 18
                  }
                }
              }
            }
          }
        });

The app seems to be functioning though once you dismiss the error...very strange.

Another thing I noticed is that this happens when I hit reload while a pushed screen is being displayed. If I pop it and go back to root, and hit reload, it's fine.

I think this issue needs to be reopened.

So, it turns out that on android, there is a problem when registerScreens() is inside Navigation.events().registerAppLaunchedListener(). When I moved it outside and before it, then the issue went away.

I am getting this issue after upgrading to the latest react/react-native version and upgrading to react-native-navigation 1.1.473.

This is happening on iOS, not Android. The app seems to operate correctly when dismissing this error. However this seems to cause the app to hang/crash when built for production.

I do have registerScreens() being called inside the callback for redux-persist. Moving it outside is not a workable solution for me.

EDIT: 1.1.433 does not have this issue.

I get error when first time app built from xcode, cmd + r simulator show black screen and cmd + r again app works fine

@mikemerritt, I'm also using redux-persist and also calling registerScreens() inside redux-persist callback. I tried with RNN 1.1.433 but still get that error message and it prevents me from testing with detox. Please confirm it's still working for you with 1.1.433 or have you found probably another workaround? Thanks.

Don't think we should be mixing V1 and v2 reports. Original issue is against v2. I would open a new issue against V1, But that's getting very little support...

I am having the same issue.. Any updates?

Could it be related to this?

When I want to seperate the Components like
LoginScreen.js, SignUpScreen.js I am getting this error. I correctly export and import the component but getting this error.

I suspect from diffrence between create-react-native-app AppName and react-native init AppName

Anyone found this?

In my case, I was using mobx and mobx-react and I had forgotten to install a few babel plugins. Once they were installed, the error disappeared.

{
  "presets": ["module:metro-react-native-babel-preset"],
  "plugins": [
    "@babel/plugin-transform-runtime",
    [
      "@babel/plugin-proposal-decorators",
      {
        "legacy": true
      }
    ],
    "transform-async-generator-functions",
    "transform-class-properties"
  ]
}

Thanks @rottenoats! Its works for me.

Hey guys, using mobx with class notation. I had code like this:

class A {
  constructor() {
    this.methodA = this.methodA.bind(this)
  }

  methodB() {}
}

So trying to bind methodA when it didn't exists, was causing this error which made no sense.
This makes me wonder if it applies to Components too?

In regards to v1, particularly, what worked for me was just faking an instance of a class component and registering it.

class FakeApp extends Component {
  render() {
    return null
  }
}
AppRegistry.registerComponent('thrifter', () => FakeApp)

Worth noting: the bug only appeared for me in production and on Android.

if you are getting this error while using redux-persist, and you followed the tutorial for redux-persist integration in the docs. it tells you to put your registerScreens() function inside the persistStore(store, null, () => {...}) function. For me, moving registerScreens() out of that function resolved the error.

@awchang56 did you manage to delay the UI until the state got rehydrated? Because I need the persistor returned from persistStore(...) for the <PersistGate .../>.

if you are getting this error while using redux-persist, and you followed the tutorial for redux-persist integration in the docs. it tells you to put your registerScreens() function inside the persistStore(store, null, () => {...}) function. For me, moving registerScreens() out of that function resolved the error.

@awchang56 did you manage to delay the UI until the state got rehydrated? Because I need the persistor returned from persistStore(...) for the <PersistGate .../>.

Did you found a solution for this?

if you are getting this error while using redux-persist, and you followed the tutorial for redux-persist integration in the docs. it tells you to put your registerScreens() function inside the persistStore(store, null, () => {...}) function. For me, moving registerScreens() out of that function resolved the error.

@awchang56 did you manage to delay the UI until the state got rehydrated? Because I need the persistor returned from persistStore(...) for the <PersistGate .../>.

Did you found a solution for this?

@DanielJanke No, sadly not. At the moment I am not using <PersistGate /> because of this. But I'll have to upgrade this library soon anyway, maybe I'll give it a second try then.

I am also facing this issue. When I start the app, it is closing suddenly with the same error. Don't know how to fix it.

I had the same issue i just close everything and restart the metro bundler and it works.

My path for solving this:

  • Play around with index.js imports (App.js)
  • Realize App.js is the culprit
  • Go to App.js
  • Comment out the whole file
  • Binary search from the top uncommenting halves
  • Watch the console for this stupid error
  • Once the binary search settles on a culprit, follow that culprit. In my case, it was another file in my project.
  • Do the same binary search here.
  • I had to follow another import again.
  • I finally found that import SocialLogin from 'react-social-login' was causing the error.