I have follow the doc: https://github.com/luggit/react-native-config#ios
until: Availability in Build settings and Info.plist
step 6. create new build phase for the scheme which will generate "tmp.xcconfig"
before each build exposing values to Build Settings and Info.plist (this snippet has to be placed after "echo ... > tmp/envfile"
if approach explained below is used)
- I have created schema for my app then in build -> pre-actions. I click add new script and paste the following:
echo ".env.staging" > /tmp/envfile
"${SRCROOT}/../node_modules/react-native-config/ios/ReactNativeConfig/BuildXCConfig.rb" "${SRCROOT}/.." "${SRCROOT}/tmp.xcconfig"
- then I go to info.plist and use $(MYENVVAR) to get value from .env file but it could not get any value.
Has anyone ever faced it?
my package json lock is
"react-native-config": "0.11.7"
Happy to see any comments
If you can see empty config file in your JS when importing
import Config from 'react-native-config'
and if you are using Pods just add (withoutreact-native link react-native-config
)in your Podfile.
And try to update module version