8

it tries to connect to npm server and throws red screen, I want to test some offline on-load features.

or is there someway to debug without npm server?

2 Answers 2

3

To debug offline IOS (react native) you can run two commands: - once you turned off your wifi, run this command in the terminal:

sudo ifconfig lo0 alias 192.xx.xx.xx - 192.xx.xx.xx is your ip address (you can get the ip address running ifconfig command)

After running above command and being offline you should not have the red screen

To undo the above command you run:

sudo ifconfig lo0 -alias 192.xx.xx.xx, being still offline you will get now the red screen.

Hope this helps.

Sign up to request clarification or add additional context in comments.

1 Comment

Hi, should I turn off my wifi on my computer or on my iphone? I tried both, but I could not make it work.
1

To debug on an android device (usb connected) you need to do the following:

  1. Enable USB debugging on your android device

  2. Navigate to your AndroidDevelopment/SDKManagerForAndroidStudio/Platform-tools/ directory in a terminal and type adb devices (this should pull up your connected device)

  3. Again in the terminal type adb reverse tcp:8081 tcp:8081

You should then be able to debug on your device. Here is a link to the docs (I think they explain how to go about this on ios, I've only tried it on Android)

2 Comments

eh? then how does my phone connect to my computer? it uses ip address, which means no network = can't connect to debugger
Didnt catch that it was a real device, in that case i will revise my answer.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.