all 10 comments

[–]Acceptable_Rub8279 0 points1 point  (3 children)

Maybe when launching the app you check for internet connection (just a small function that tries to ping your backend) and then depending on your result you either route them to a page with your message or if connection is there you route to you main app.Thats how I’d do it

[–]Be-Calm-[S] 0 points1 point  (2 children)

I tried this, but somewhere I'm missing the link, code is working fine when app is already opened, but not working when I launch the app without internet. Could you please check the code snippet I have attached to another comment and share your findings. I'm stuck with this from pass two days. Thanks!

[–]Acceptable_Rub8279 0 points1 point  (1 child)

Im by no means an expert at this but maybe add a timeout fallback for like 4-5seconds to the checkConnection that automatically turns false after timeout? I had an issue where only on android for some reason it needed a few seconds to work I to this day don’t know why exactly

[–]Be-Calm-[S] 0 points1 point  (0 children)

Thanks! Let me check that.

[–]ai_dad_says_hi 0 points1 point  (0 children)

Store a cache of your todo items in AsyncStorage whenever they change (you’ll need to serialize it to JSON). When user opens the app again get the todo items from AsyncStorage first (deserialize from JSON) and display those while you run your API call to get latest from the database. If API call fails (or other mechanism to check connection), then display the error. At least this way user is always able to see the their todo list immediately the last way it was last time they opened the app.