React-native-config: RN 57 support with Babel Preset...

Created on 19 Dec 2018  Â·  12Comments  Â·  Source: luggit/react-native-config

Hi,

First, love this.

Second, looks like upgrading to RN 57 broke this. I found adding the required preset "module:metro-react-native-babel-preset" made the config variables return as undefined.

I don't have a solution here, but curious if others have found this, and if there is a solution out there.

Thank you!
Dave

Most helpful comment

Does anybody manage to solve an issue with iOS and React-Native 0.57?

All 12 comments

Have the same after upgrade to 0.57

Have the same problem in RN 0.57.5, anyone with a quick fix?

same in RN 0.57.8, need to check this source code to find out why return undefined , or config = {}

It seems fine for Android builds, only my iOS builds seem to be missing config data. Can anyone confirm that android is working for them as well, but iOS is having a problem?

it works for android only, i can use the env variables in build.gradle and AndroidManifest.xml
It does not work for JS, it returns an empty {} when i write console.log('config', Config);

not tested in ios

fixed adding the resValue line in defaultConfig

https://github.com/luggit/react-native-config/issues/143#issuecomment-447579204

fixed adding the resValue line in defaultConfig

#143 (comment)

That's probably why I was having success on Android. I have that resValue set already for other reasons. iOS is still broken and I haven't found a workaround at the moment.

Still an issue it seems....

(For Android)
Fixed it by doing the following:

In the Android src folder, open the file "MainApplication.java" and do the following...

Add the following at the top:
import com.lugg.ReactNativeConfig.ReactNativeConfigPackage;

In the "getPackages" function, add the following as part of the ArrayList:
new ReactNativeConfigPackage()

Does anybody manage to solve an issue with iOS and React-Native 0.57?

I ended up getting iOS to work again (we'd upgraded RN versions when the problem began) by manually going through the linking process. YMMV though.

This worked! https://github.com/luggit/react-native-config/issues/322#issuecomment-452813041

Going to close the issue, as I think its solved. Feel free to re-open if you disagree. :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ORESoftware picture ORESoftware  Â·  3Comments

francisrod01 picture francisrod01  Â·  3Comments

kidnapkin picture kidnapkin  Â·  3Comments

rpereira picture rpereira  Â·  3Comments

NachtRitter picture NachtRitter  Â·  4Comments