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

[V2] Screen remains on reload #3528

Closed luskin closed 6 years ago

luskin commented 6 years ago

Issue Description

On V2 if you have a screen visible and reload via debugger RNN keeps those screens open and remounts them before the app has a chance to reload properly:

Running application "Driver.Account" with appParams: {"initialProps":{"componentId":"Component13"},"rootTag":151}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF
infoLog.js:15 Running application "Driver.History" with appParams: {"initialProps":{"componentId":"Component12"},"rootTag":161}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF
infoLog.js:15 Running application "Driver.Dispatches" with appParams: {"initialProps":{"componentId":"Component11"},"rootTag":171}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF
console.js:35 Running application "Driver.Launch" with appParams: {"initialProps":{"componentId":"Component1"},"rootTag":181}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF
console.js:35 ---- START APP ----

In the above example from my app, all of those views (except the launch view) should not be visible until after the START APP log, and after the start app log there should be a series of services to startup before the views are visible. On a fresh install from android studio everything works fine as shown in the following logs:

Running application "Driver.Launch" with appParams: {"initialProps":{"componentId":"Component1"},"rootTag":1}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF
console.js:35 ---- START APP ----
console.js:35 [CODEPUSH]: Started
console.js:35 [PERMISSION]: Checking
console.js:35 [APPSTATE]: Started service
console.js:35 [PERMISSION]: Location  authorized
console.js:35 [PERMISSION]: Notification authenticated (default android)
console.js:35 [AUTHENTICATION]: Authenticated as ***************************
console.js:35 [CODEPUSH]: Up To Date
console.js:35 [USER]: Started services
console.js:35 [ONBOARDING]: Started services
console.js:35 [DISPATCH]: Started
console.js:35 [ORGANIZATION]: Started services
console.js:35 [LOCATION]: Permission is authorized, begin tracking
console.js:35 [NOTIFICATION]: Permission granted setting up listener
console.js:35 [NOTIFICATION]: Started services
console.js:35 Running application "Driver.Account" with appParams: {"initialProps":{"componentId":"Component6"},"rootTag":11}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF
console.js:35 Running application "Driver.History" with appParams: {"initialProps":{"componentId":"Component5"},"rootTag":21}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF
console.js:35 Running application "Driver.Dispatches" with appParams: {"initialProps":{"componentId":"Component4"},"rootTag":31}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF

Environment

guyca commented 6 years ago

Hey @luskin How is your layout constructed? Are you using TopTabs? BottomTabs? SideMenu?

GuillotJessica commented 6 years ago

you are on debug, this is a problem with RN 0.55

luskin commented 6 years ago

@guyca the Launch screen is a single page view set as root and when all services have loaded I reset the root with a bottom tab bar view.

@GuillotJessica I was using RN0.55 before with react-native-navigation v1 and this problem did not exist.

GuillotJessica commented 6 years ago

@luskin I'm on "react-native": "0.55.2", and the problem was there before using rnn at all

luskin commented 6 years ago

@GuillotJessica well that's react native for ya 😂

guyca commented 6 years ago

Guess we can close this one 😕 I'll reopen if we can confirm RNN has something to do with this

luskin commented 6 years ago

Looks like it was a 0.55 issue, very very strange we did not see it before implementing RNN, see here: https://github.com/facebook/react-native/commit/e5aa5b7c508c5e0e51f7abfcee350e27bef24ba2

rendomnet commented 6 years ago

@luskin I have this in rn 0.56. Screens from my bottomTabs start app roots.js:5 register App

---> here my prev screen loaded for some reason before app "WelcomeScreen" infoLog.js:16 Running application "Feed" with appParams: {"initialProps":{"componentId":"Component5"},"rootTag":141}. DEV === true, development-level warning are ON, performance optimizations are OFF

----- here my roots init roots.js:7 set options roots.js:125 set Root ------ and here is my WelcomeScreen infoLog.js:16 Running application "WelcomeScreen" with appParams: {"initialProps":{"componentId":"Component5"},"rootTag":151}. DEV === true, development-level warning are ON, performance optimizations are OFF WelcomeScreen.js:32 welcome screen mounted

luskin commented 6 years ago

@rendomnet I think this may be a side effect of hot reloading or live reload, try turning those debug features off and see if this is still the case.

rendomnet commented 6 years ago

@luskin just tested without hotreloading. and bug remains the same. setRoots that was active during app reaload is started first... before all. please reopen the issue

luskin commented 6 years ago

Android, iOS or Both?

rendomnet commented 6 years ago

@luskin only Android

luskin commented 6 years ago

Yeah we've ran into this before as well, I believe this is due to Android's app caching for faster app launching in debug mode, I do not believe this occurs when building in release.

rendomnet commented 6 years ago

@luskin anyway this is a bug and not a documented one. Can you unclose this issue or should I create another one?

tylerjbainbridge commented 6 years ago

I'm having this issue as well, not sure what to do.

husseinyar commented 2 years ago

the screen is showing blank not visual data on Android screen if somebody knews how to fixit please tall me what to do