I am using the logic below for choosing an ip address for making ajax call to Api which is running on localhost and its working fine when I use emulator on my laptop, but when I use expo on an IPhone device to load my app the ajax call fails and can not make the connection with the Api, I also tried my machine local ip in network and 127.0.0.1 but none of them works.
const SERVER_URL = __DEV__ ?
Platform.select({
ios: "http://localhost:5000",
android: "http://10.0.2.2:5000"
}) : "https://exmple.com"