Reagieren Sie native Umgebungsvariablen

# .env files
API_URL=https://myapi.com
GOOGLE_MAPS_API_KEY=abcdefgh

# use env
import Config from 'react-native-config'

Config.API_URL  // 'https://myapi.com'
Config.GOOGLE_MAPS_API_KEY  // 'abcdefgh'

# call env
development: ENVFILE=.env.staging react-native run-android
production: cd android && ENVFILE=.env.production ./gradlew assembleRelease
IT