React-native-config: Problems with v0.12.0 + React Native 0.61.4

Created on 22 Nov 2019  路  18Comments  路  Source: luggit/react-native-config

Is there a migration guide from 0.11.7 to 0.12.0?
What do I need to remove from the old config, and what do I need to add to the new config?
Do I need this config in the Podfile?

    if target.name == 'react-native-config'
      phase = target.project.new(Xcodeproj::Project::Object::PBXShellScriptBuildPhase)
      phase.shell_script = "cd ../../"\
        " && RNC_ROOT=./node_modules/react-native-config/"\
        " && export SYMROOT=$RNC_ROOT/ios/ReactNativeConfig"\
        " && export BUILD_DIR=$RNC_ROOT/ios/ReactNativeConfig"\
        " && ruby $RNC_ROOT/ios/ReactNativeConfig/@BuildDotenvConfig.rb"

      target.build_phases << phase
      target.build_phases.move(phase,0)
    end

I have added a config file in ios folder called Config.xcconfig with this line:

include? "tmp.xcconfig"

I get some build errors, when I try to upgrade from 0.11.7 to 0.12.0.

I have the following:
echo ".env.test" > /tmp/envfile
Added this line to it as the guide suggests:
image

I get this build error:
/node_modules/react-native-config/ios/ReactNativeConfig/ReadDotEnv.rb:27:in join': no implicit conversion of nil into String (TypeError) from /node_modules/react-native-config/ios/ReactNativeConfig/ReadDotEnv.rb:27:inread_dot_env'
from ./node_modules/react-native-config//ios/ReactNativeConfig/BuildDotenvConfig.rb:15:in `

'
reading env file from and writing .m to
going to read env file from root folder

Most helpful comment

Any update on this?

All 18 comments

I have the same issue, and haven't been able to find a workaround.

Updates:
Removed the source script from the pre-actions on each env, and added it to a build phase:
image

Removed the config from Podfile

Now I cannot access env from Config object in iOS from React, works fine in Android though.

I have the same issue, and haven't been able to find a workaround.

+1

facing same issue.

+1

Not sure if this helps but...

We just upgraded to the latest and had to remove plist preprocessing (this is in Build Settings).

INFOPLIST_OTHER_PREPROCESSOR_FLAGS = "-traditional";
INFOPLIST_PREFIX_HEADER = "${BUILD_DIR}/GeneratedInfoPlistDotEnv.h";
INFOPLIST_PREPROCESS = YES

Also, we did not need to modify the Podfile with the script @c0d3x posted above.

Any update on this?

same issue

same issue

same here

Same issue

any updates?

Same here

Seeing the same issue as well. We have rolled back to 0.11.7

I don't know if this will help, but I got some clarification to my comment here (see the comments that follow it as well). It is working for me, using v0.12.0 + RN 0.61.5.

hey 馃憢 I kindly ask to try my lib https://www.npmjs.com/package/react-native-ultimate-config if the issue persists. it works well for me in rn60+

Was this page helpful?
0 / 5 - 0 ratings