meteor-react-native icon indicating copy to clipboard operation
meteor-react-native copied to clipboard

Network is disconnects often while using the app and white screen is displayed without any error

Open Akashdeep312 opened this issue 2 years ago • 5 comments

Steps to reproduce :

  1. Run your app.
  2. While app is working suddenly a white screen appears.

React Native and MeteorRN versions:

  "react": "16.13.1",
    "react-native": "0.63.4",
 "react-native-meteor-upgraded": "^1.4.1"

in the console i got some logs like

Disconnected from DDP server.
Disconnected from DDP server.
Disconnected from DDP server.

Akashdeep312 avatar Oct 18 '21 06:10 Akashdeep312

Hi @Akashdeep312,

This repository is not for the package you are using. This repo is for the @meteorrn/core and other @meteorrn org packages only.

Highly recommend switching to this package as it is officially recognized and well maintained.

Closing this issue for now

TheRealNate avatar Oct 18 '21 16:10 TheRealNate

HI @TheRealNate i've recently switched to @meteorrn/core and to some extent it solves the problem now app is not stuck on white screen , But now white screen appears only for 1 sec and then user is navigated to home screen. It appears like the app when app is disconnected and reconnects with the server then app goes to home screen

React Native and meterorn/core versions:

 "react": "16.13.1",
  "react-native": "0.63.4",
  "@meteorrn/core": "^2.3.0",

And now i'm not getting any logs as i described earlier

Akashdeep312 avatar Nov 17 '21 04:11 Akashdeep312

Hi @Akashdeep312, sorry for not getting back to you sooner. For future reference, I recommend reopening the issue if you need to continue the conversation as it can get it attention quicker.

The app can disconnect and reconnect if the websocket connection fails. For example, depending on device if the user has the app in the background for a while the websocket connection will be closed, then when the app is refocused the connection needs to be reopened again. I’d look into your logic for when you are loading the home screen (are you waiting for Meteor connection, login, etc).

Also keep in mind there will be a very short delay with any React Native app (I’m not sure if what you are referring to is this short delay or a longer delay as a result of an unexpected issue). You can mitigate this by implementing a splash screen like mentioned in this article.

I’m going to reopen the issue for now in case you need to continue the conversation. If you need to follow up feel free, otherwise if you feel your issue is solved you can close this.

TheRealNate avatar Nov 24 '21 04:11 TheRealNate

hi @TheRealNate i've come across a behaviour of meteor connection , so what happens is when i put app in background and start working on other app after a while when i came back to my app the Meteor.user() returns undefined , so tackle this for the time being i've just handled it like making it a state variable and made a use effect once it changes its state and updates it's value if it's not undefined.

Have this is a desired behaviour of connection or that's how it works , if yes then i'm better off handling Meteor.user() with a separate context and pass it throughout the app and update once listen to any changes. Or can you suggest any better way to handle this

Akashdeep312 avatar Dec 03 '21 04:12 Akashdeep312

Hi @Akashdeep312, this is expected behavior. This package provides no data persistence, so if the connection to the server is lost we assume the data is stale and clear it. Keeping the data in state (for temporary persistence) or local storage (for semi-permanent persistence) is likely the best way to handle this.

TheRealNate avatar Dec 20 '21 16:12 TheRealNate

Closing this issue due to no activity. Feel free to reopen.

github-actions[bot] avatar Dec 02 '22 02:12 github-actions[bot]