Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility of react-native-config with React Native 0.73+ #803

Open
dawidmatyjasik opened this issue May 29, 2024 · 1 comment
Open

Comments

@dawidmatyjasik
Copy link

Hello,

I am currently working on a project using React Native version 0.73.6 and I am using react-native-config to manage environment variables. Specifically, I am interested in ensuring that productFlavors are functioning correctly on Android.

I have a few questions regarding this setup:

  • Is react-native-config fully compatible with React Native versions 0.73 and above?
  • Has anyone successfully used react-native-config with Android productFlavors on these React Native versions?
  • Are there any known issues or special configurations required to ensure that react-native-config works seamlessly with Android product flavors on React Native 0.73+?
  • Is there any official documentation or guidance available for this specific use case?

Any insights or experiences shared would be greatly appreciated.

Thank you!

@maksimlya
Copy link

maksimlya commented Jun 10, 2024

We are currently on react 0.73.5, and have no issues with this lib on android and product flavors. The setup is something like that:

In app/build.gradle flavors defined regular:

productFlavors {
    DemoFlavor1 {
        applicationId "com.zzzzz.yyyyy"
        dimension "default"
        resValue "string", "app_name", "DemoFlavor1"
        versionCode 22222
        versionName "0.1.56"
    }
    DemoFlavor2 {
        applicationId "com.ccccc.vvvvv"
        dimension "default"
        resValue "string", "app_name", "DemoFlavor2"
        versionCode 33333
        versionName "0.2.54"
    }
}


implementation project(':react-native-config')

And down in that file:

project.ext.envConfigFiles = [
        "demoFlavor1debug":"../config/.env.DemoFlavor1",
        "demoFlavor1release":"../config/.env.DemoFlavor1",
        "demoFlavor2debug":"../config/.env.DemoFlavor2",
        "demoFlavor2release": "../config/.env.DemoFlavor2"
]
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"

In settings.gradle:

include ':react-native-config'
project(':react-native-config').projectDir = new File(settingsDir, '../node_modules/react-native-config/android')

On iOS tho.... It is a pain and suffering due to caching mechanisms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants