Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

How to handle multiple environments in React Native CLI (specific case)

$
0
0

I want to handle different environments by letting the developers select which one they want to.

So basically lets say we have a login screen and a "Settings" touchable there. When the user press it, or shake the device, the following modal opens:

enter image description here

I wanna let the user change the environment mode and then restart the application with the selected environment settings.

.env.development

REACT_APP_API_URL=https://development-api.io/api

.env.staging

REACT_APP_API_URL=https://staging-api.io/api

.env.production

REACT_APP_API_URL=https://production-api.io/api

I'm not sure if this is feasable, but my starting point is to try it with react-native-config and react-native-restart. Any thoughts on the best way to do it?

Thank you!

Obs: React Native CLI


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>