React Native Wrong LAN IP Hosting Fix - react-native

Whenever I run
npm start (react-native-scripts start)
It hosts the Application on the endpoint of 192.168.1.200:19000
The issue is my Windows computer has the IP address of 192.168.0.31
Is there a way to change this React Native hosting IP address so it is hosting on the correct IP?
The application does not start etc. The only way to run this expo app and have it connect is through the tunnel (which is 70% slower when refreshing the app etc).
Side note: This bug does not happen on my mac OS computer, Only on my Windows 10 computer development machine I am trying to transfer to.
Edit: Is there a way to always have this be my computer's router assigned IP address? I'm confused why this breaks for RN on windows vs RN on mac.

Check the below question thread.
It answers your query.
React Native Expo change default LAN IP
Hope it helps.

Related

My React native app is not running on physical device

enter image description here
My React native app is not running on a physical device.it's showing some Gradle error.
I check many articles but cant finds any soulation.
please help on out from this error.
You can also connect to the development server over Wi-Fi. You'll first need to install the app on your device using a USB cable, but once that has been done you can debug wirelessly by following these instructions. You'll need your development machine's current IP address before proceeding.
Open the command prompt and type ipconfig to find your machine's IP address (more info).
Make sure your laptop and your phone are on the same Wi-Fi network.
Open your React Native app on your device
You'll see a red screen with an error. This is OK. The following steps will fix that.
Open the in-app Developer menu.
Go to Dev Settings → Debug server host & port for device.
Type in your machine's IP address and the port of the local dev server (e.g. 10.0.1.1:8081).
Go back to the Developer menu and select Reload JS.
Please Check complete on official site as well. Other Best link

React Native Expo can't connect from phone to laptop on same wifi

I am building react native app with expo and I'm currently using public wifi because I'm traveling.
On the bus and in the hostel's wifi I've experienced an issue:
- Phone can't connect to Expo running on Laptop (same LAN wifi)
After trying many times to connect using the wifi, and also trying to see if Windows firewall has something to do with it, I finally found out what might be the issue and a temporary workaround.
Issue:
Some routers have a configuration called AP Isolation, that might be activated on the router/wifi of the public place you're using, to avoid someone hack into someone else's computer. So basically no device on the same network can communicate with the other.
Temporary workaround:
The only way I've got this working was by enabling a Wifi Hotspot on my Android phone and connecting the laptop to it. This means I'm using my phone's 4G connection for internet too. Expo seems like it needs to access the Internet and if you don't have data won't work.
The other way might work is if your Windows or Mac computer is able to create a virtual access point. So instead of connecting laptop to phone, you do it the other way around.
Hope this helps someone!
You should be able to run on a virtual device via expo. On my Macbook I run on iOS if doing work in a place where I do not have internet but on a PC you should be able to run the Android Emulator.
While this might not provide the not intuitive way of doing things as you'll be using a virtual device instead of a physical one, it still is very quick and responsive. Just know that animations may not be as smooth.
I fly frequently and running on virtual devices has enabled me to work when otherwise it would be impossible.

Access localhost site on mobile devices within the same local network

Right now, I'm running my site on my Mac OS X locally via Apache.
I'm trying to reproduce a bug that only happen on iPhone Safari. I'm trying to avoid keep pushing the code to the staging server, pull, and then, test on my phone.
Is there a way to access my local site via my phone? via some kind of IP address?
make phone connect to the same WIFI as MAC OSX
run the server on the non-localhost address (LAN DHCP allocated), noted as SRV_IP
access the SRV_IP from your phone

Internet Connectivity To worklight apps

I am using worklight 5.0.6 in Eclipse juno on Windows 7.
I made a simple form filling app. I am deploying this app on my PC, Making it a worklight server. I am accessing it from the instance of the app which is running on my phone.
It works fine as long as my Phone and PC are on the same network, that is, on local LAN.
But when I change the network to Internet, the app is not able to connect to the worklight server - which is, again, my PC.
My Questions are:
Where should i put the public IP address to access the worklight server?
Should i change the worklight version to make it work?
Also, I read solutions that you gotta run the "Build and deploy on remote servers" But i couldn't find the option for it, what i found was "Run on Server"
But i really don't know how to proceed after that.
Should i change the worklight version to make it work?
You should upgrade your Worklight from 5.0.6 to a later release regardless of the connectivity problem - it is a very, very, old release.
Also, I read solutions that you gotta run the "Build and deploy on
remote servers" But i couldn't find the option for it, what i found
was "Run on Server"
This is not related to what you are facing. This option is meant to be used as you prepare to move the development environment (the developer workstation) to other environments, such as QA, UAT and Production. This feature is meant to change the connectivity settings in the application. Again, not relevant for you at this time.
But when I change the network to Internet, the app is not able to
connect to the worklight server - which is, again, my PC.
The problem you are experiencing is expected. There is your PC, which acts as the local server, connected to the Internet via your router. And there is the device, also connected to the same network via the router.
As you disconnect the device from the local network, it is no longer able to connect to the server, which is still in the local network.
If you want that work still, you'd need to setup a server with an external IP address that your device will attempt to connect to, and be able to route the request to the Worklight Server... in short, in a development environment it is expected that you will be on the same network.

WP8 emulator stopped working

Ok so I was working fine with the WP8 emulator but suddenly after going into Hyper-V manager it stopped working, didn't make any change and even deleted the virtual machine to be created again on debug but no luck
I have tried with the various emulator images but none of them seems to work anymore, event viewer shows no errors on Hyper-V.
What I have noticed is that the virtual machine starts in Hyper-V goes to Windows logo, then hangs for a few minutes in a black screen and turns off afterwards automatically, tried starting it without debuging, directly from hyper-v but nothing works, should I reinstall the SDK? seems to me this is not install related since it worked before
Thanks
Taken from the connect forums, I don't know if it will fix your problem:
I had issues with the emulator and tried several things, including the below solutions and on a few occasions couldn't figure out what the problem was so I restored a previous image since that was quick.
From Discussion "RTW - Can't debug - IP Address Issue"
Uninstall the SDK
Uninstall and reinstall the virtual switches using:
C:> netcfg –u vms_pp
C:> netcfg –c p –i vms_pp
Reboot
Reinstall the SDK
From Discussion "Emulator and wireless adapter issues"
Problem solved! Hyper-V uses same MAC address for guest VMs (virtual
machine) and Host. If the router configured to give the host always
same ip address it will conflict with the emulator. Solution - on the
router remove the host from known PCs and let it give you some new ip
address (not fixed). After you start the emulator it will get the
correct ip address from router. Router will show you two PCs (host and
vm) with the same MAC, but different ip addresses.
Remove the instances in Hyper-V, and then run XdeCleanup.