THE BITESITE BLOG
Reactnativeenv

React Native Env 'cannot read property get of undefined'

coding software react native

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 ", and make sure to select the individual RNEnvironmentManagerIOS.m and RNEnvironmentManagerIOS.h files.

Hope that helps out some peeps!

Caseyli
Casey Li
CEO & Founder, BiteSite
Reactnativevectoricons

React Native Vector Icons getImageForFont issue

coding software react native

So recently, I've been diving into React Native and running into all these little quirks. Luckily, it seems to be getting better day by day in terms of setup. I can say this though, as a Web Developer, this is my most successful attempt and writing mobile apps (after trying Objective-C, then Swift).

Today, I thought I'd post an small issue I ran into in trying to get react-native-vector-icons to work. The error message that would pop up on screen was

getImageForFont issue

It was a pretty simple fix. In Xcode, in your project, find your Info.plist. Then check the "Fonts provided by application" (if it's not there, you'll have to add it). Once added, make sure all your fonts are added to this property. So add Entypo.ttf, FontAwesome.ttf etc.

After that, it should work.

Hope this helps out some peeps.

Caseyli
Casey Li
CEO & Founder, BiteSite