Alright, in my continuing effort to use React Native, I keep running into little issues with all the libraries I use. Usually it's due to a setup issue and my lack of understanding of the true under-workings of what I'm doing seems to lead to these issues.
Today, it's with react-native-env. When setting this library up, I kept running into an issue that would say 'cannot read property get of undefined' or 'cannot read property getAll of undefined'.
When I started debugging, it seemed the EnvironmentManager object was present, so what was the issue.
If you look at your
node_modules\react-native-env\index.js
you'll see that the get and getAll methods are delegating it to some native code:
RNEnvironmentManagerIOS.get
RNEnvironmentManagerIOS.getAll
So it's really just an issue of not reading the instructions properly. You need to add the RNEnvironmentManagerIOS.h and .m files to your project.
The only thing I found a little misleading is you shouldn't add the folder - rather add the individual files.
So in XCode, (I have a group called 'Libraries' under my project, but I think you can add it anywhere), right-click and "Add files to
Hope that helps out some peeps!