Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Splash screen does not dismiss when it should while logging in [IOS] [RN68] [React-Native-Navigation] #15206

Closed
siddarthkay opened this issue Feb 28, 2023 · 19 comments
Assignees

Comments

@siddarthkay
Copy link
Contributor

After upgrading react-native to version 0.68.5 the splash screen does not dismiss on IOS Simulator when you try to log in.
The splash screen dismisses itself when you are going through the onboarding flow, but after you have successfully created your account and you dismiss the app and try to open it again and log in, you get stuck with the splash screen.

Screenshot :
Screenshot 2023-02-28 at 11 55 26 AM

The metro logs look normal, for some reason the splash screen dismissing code is not called :

ref : src/react_native/core.cljs

(defn hide-splash-screen
  []
  (.hide ^js (-> react-native .-NativeModules .-SplashScreen)))

ref : src/status_im2/navigation/core.cljs

;; APP LAUNCHED
(defn app-launched-listener
  []
  (reset! state/curr-modal false)
  (reset! state/dissmissing false)
  (if (or (= @state/root-id :multiaccounts)
          (= @state/root-id :multiaccounts-keycard))
    (re-frame/dispatch-sync [::set-multiaccount-root])
    (when @state/root-id
      (navigation/set-root (get (roots/roots) @state/root-id))
      (re-frame/dispatch [::login-core/check-last-chat])))
  (rn/hide-splash-screen))
@siddarthkay
Copy link
Contributor Author

Funny thing is this happens only on IOS. This behaviour is not replicated on Android.

@siddarthkay siddarthkay self-assigned this Feb 28, 2023
@siddarthkay
Copy link
Contributor Author

Funny thing is this happens only on IOS

makes me wonder whether this guy right here is the culprit once again : https://github.com/status-im/status-mobile/blob/9f3c5454f0406d25b537e0a8362aa6d307bc599c/ios/StatusIm/AppDelegate.mm

@siddarthkay
Copy link
Contributor Author

screenshot of the same build working fine when we go through the onboarding flow :
Screenshot 2023-02-28 at 12 44 58 PM

@flexsurfer
Copy link
Member

so it seems on ios RNN doesn't fire an event right ? what RNN version is used ?

@flexsurfer
Copy link
Member

flexsurfer commented Feb 28, 2023

just to make sure can you add println to app-launched-listener ?

@siddarthkay
Copy link
Contributor Author

siddarthkay commented Feb 28, 2023

what RNN version is used ?

"react-native-navigation": "^7.27.1"

just to make sure can you add println to app-launched-listener ?

Will do

@siddarthkay
Copy link
Contributor Author

just to make sure can you add println to app-launched-listener ?

seems like I had already added that last time while debugging, here is the log in metro

 WARN  Require cycle: node_modules/react-native-crypto/index.js -> node_modules/react-native-randombytes/index.js -> node_modules/sjcl/sjcl.js -> node_modules/react-native-crypto/index.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
 INFO  INFO [react-native.navigation:8] - setDefaultOptions called
 INFO  INFO [react-native.navigation:48] - registerAppLaunchedListener called
 LOG  dev init time 3948
 LOG  #3 ready!

@flexsurfer
Copy link
Member

its registration, but we want to know if it fires event, so we need to add log to app-launched-listener function

@flexsurfer
Copy link
Member

could you try 7.31.0 ?

@siddarthkay
Copy link
Contributor Author

Okay will add some logs to app-launched-listener and also try upgrading react-native-navigation to 7.31.0

@siddarthkay
Copy link
Contributor Author

siddarthkay commented Feb 28, 2023

upgraded to 7.31.1 and was greeted with the following error, I have seen this one before, if you dismiss it the app works fine..

Exeption 'Bridge not yet loaded! 
Send commands after Navigation.events().onAppLaunched() has been called.' 
was thrown while invoking setRoot on target RNNBridgeModule with params ( *truncating this info *

@siddarthkay
Copy link
Contributor Author

This is how it looks :
Screenshot 2023-02-28 at 5 35 31 PM

but you can dismiss it and the app works :
Screenshot 2023-02-28 at 5 35 51 PM

@siddarthkay
Copy link
Contributor Author

The error seems to me that only in case of IOS Side sometimes we do SetNavigation before the bridge is loaded, maybe
these two statements are run async,

RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
[ReactNativeNavigation bootstrapWithDelegate:self launchOptions:launchOptions];

I will debug more and find out.

@siddarthkay
Copy link
Contributor Author

from the logs I see we do this in the order :

  • setDefaultOptions
  • setRoot

Which is how it should be done,
One interesting thing I am seeing is that setRoot has been logged 4 times, which maybe a concern..

 BUNDLE  ./index.js 

 DEBUG  DEBUG [status-im.native-module.core:526] - [native-module] sha3
 DEBUG  DEBUG [status-im.native-module.core:420] - [native-module] get-device-model-info
 WARN  Require cycle: node_modules/react-native-crypto/index.js -> node_modules/react-native-randombytes/index.js -> node_modules/sjcl/sjcl.js -> node_modules/react-native-crypto/index.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
 INFO  INFO [react-native.navigation:8] - setDefaultOptions called
 LOG  dev init time 4093
 LOG  #3 ready!
 INFO  INFO [react-native.navigation:16] - [RNN] the root is set
 DEBUG  DEBUG [status-im.native-module.core:526] - [native-module] sha3
 DEBUG  DEBUG [status-im.native-module.core:420] - [native-module] get-device-model-info
 WARN  Require cycle: node_modules/react-native-crypto/index.js -> node_modules/react-native-randombytes/index.js -> node_modules/sjcl/sjcl.js -> node_modules/react-native-crypto/index.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
 INFO  INFO [react-native.navigation:8] - setDefaultOptions called
 LOG  dev init time 4044
 LOG  #4 ready!
 INFO  INFO [react-native.navigation:16] - [RNN] the root is set
 INFO  INFO [react-native.navigation:16] - [RNN] the root is set
 INFO  INFO [react-native.navigation:16] - [RNN] the root is set
 LOG  Running "intro" with {"rootTag":1,"initialProps":{"componentId":"intro"}}
 INFO  INFO [react-native.navigation:16] - [RNN] the root is set
 LOG  Running "get-your-keys" with {"rootTag":11,"initialProps":{"componentId":"get-your-keys"}}

Also seeing some duplication in logs that probably should not happen 🤔

@flexsurfer
Copy link
Member

it might be the same error app-launched-listener is not dispatched for some reason

@flexsurfer
Copy link
Member

in develop it looks like this

[Tue Feb 28 2023 15:02:54.895]  LOG      app-launched-listener
[Tue Feb 28 2023 15:02:55.105]  LOG      set-root {:root {:stack {:id :multiaccounts-stack

@siddarthkay
Copy link
Contributor Author

Fixed here : 4d2c381

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants