Juuso
Juuso

Reputation: 485

Debugging react native application in offline mode

I'm trying to add some offline support for my app, but debugging the app with my emulator in airplane mode seems to be a giant pain. Every time I reload the app without a connection I am met with this:

enter image description here

So, in essence, I would like to have the app think it does not have a connection, but maintain the connection to my development server. Is that possible?

Upvotes: 8

Views: 3251

Answers (1)

Facundo La Rocca
Facundo La Rocca

Reputation: 3866

The problem is 10.0.3.2 is being provided by your router so when you are on offline (or without connection), who is going to route that ip?

One option to solve this problem is to use localhost or 127.0.0.1 as Debug Server.

Other option could be adding in your host (c:\C:\Windows\System32\drivers\etc) a traduction for your IP, something like this:

10.0.3.2   127.0.0.1

Of course you have to change your devs settings in your emulator

Upvotes: 1

Related Questions