I installed react-native-config
version 1.2.0
and added a .env
file to the root of my project. This .env
file contains the following:
REACT_APP_LAST_FM_API_KEY=some_key_here
REACT_APP_LAST_FM_SHARED_KEY=some_shared_key_here
In my App.tsx
I’ve the following:
import Config from 'react-native-config';
console.log(Config.REACT_APP_LAST_FM_API_KEY) // undefined;
When I do console.log(Config)
I get the following:
{"APPLICATION_ID": "com.mobile", "BUILD_TYPE": "debug", "DEBUG": true, "FLAVOR": "", "VERSION_CODE": 1, "VERSION_NAME": "1.0", "getConstants": [Function anonymous]}
Am I missing something?
Please let me know if you need any more information and thanks in advance!
We did and that fixed it, thanks!
This package works great but the documentation is a little bit unclear in my opinion.