wix / react-native-navigation

A complete native navigation solution for React Native
https://wix.github.io/react-native-navigation/
MIT License
13.04k stars 2.67k forks source link

[v7] Invariant Violation: "MyScreen" has not been registered. #6956

Closed zabojad closed 3 years ago

zabojad commented 3 years ago

šŸ› Bug Report

I'm seeing these kinds of logs in my Sentry.io reports:

Invariant Violation: "MyScreen" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry...
at runApplication(app:///index.android.bundle:1:443080)
at apply(native)
at value(app:///index.android.bundle:1:84075)
at anonymous(app:///index.android.bundle:1:82713)
at value(app:///index.android.bundle:1:83670)
at value(app:///index.android.bundle:1:82671)

I'm a bit puzzled because this happens in production with a release build and on both iOS and Android. It seems to be happen randomly and fortunately quite rarely: so far 57 times since 4th February for more that 40k users.

It's quite disturbing because it seems to be a development log entry...

And also note that I am sometimes seeing those errors when reloading my app in dev mode. I used to ignore them as it seemed to work correctly anyway (even the screens reported in the error log entry)...

Does anyone has any idea why would this happen? Do I have a misconfiguration issue or something?

To Reproduce

I do not have any idea how to reproduce this. It's happening randomly...

Expected behavior

I expect this error not to happen ^^...

Actual Behavior

This error happens...

Your Environment

Reproducible Demo

I do not have any...

mrousavy commented 3 years ago

There is no relevant information in this issue.

Search your entire code-base for the string MyScreen and find out where you use that. If you find it, paste the problematic code snippet here.

zabojad commented 3 years ago

@mrousavy It happens randomly on any of my screens. I 've written "MyScreen" here just for an example... I do not know what causes it and how can I reproduce it.

The questions are:

stale[bot] commented 3 years ago

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 version and report back. Thank you for your contributions.

stale[bot] commented 3 years ago

The issue has been closed for inactivity.

mrousavy commented 3 years ago

What can lead to this error?

Incorrectly registering your screens. Is this a greenfield app?

I'm sorry but if you don't post any code snippets we can't help you.

zabojad commented 3 years ago

Incorrectly registering your screens. Is this a greenfield app?

@mrousavy Well, there is no rocket science in calling Navigation.registerComponent... Also, I would expect it to happen all the time if the code that registers me screens were incorrect. Nop?

I'm wondering if there is not some timing issue. Is the call to Navigation.registerComponent synchronous?

Is this a greenfield app?

It's not. It's an app that has been using RNN since RNN v2... This issue started to show up in the latest updates of RNN.

zabojad commented 3 years ago

@mrousavy I've found my mistake and apologize. This issue was happening on an edge case when the app is opened from a Push notification. In that case, the call to navigate to my screen was made before all the screens registration ended.

I close this issue (which was a user issue).

Thank you for answering me anyway !