Exposes config variables from .env files to React Native JavaScript and native code, supporting iOS, Android, macOS, and Windows.
React Native Config is a library that brings 12-factor configuration principles to React Native mobile development. It allows developers to manage environment-specific variables (like API endpoints and keys) outside the app code in .env files, enabling easy switching between configurations such as staging and production without rebuilding the application.
React Native developers building cross-platform mobile apps for iOS, Android, macOS, or Windows who need to manage different environment configurations (e.g., development, staging, production) and expose those variables to both JavaScript and native code.
Developers choose React Native Config because it provides a unified, platform-agnostic way to handle environment variables across React Native projects, supporting both JavaScript and native code access. Its adherence to 12-factor methodology and integration with native build settings and manifests offers a robust configuration solution not typically available out-of-the-box in React Native.
Bring some 12 factor love to your mobile apps!
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Works consistently across iOS, Android, macOS, and Windows React Native projects, enabling unified configuration management as highlighted in the multi-platform feature list.
Exposes environment variables to Java, Objective-C, and C++ via BuildConfig or module methods, allowing deep native app customization without JavaScript bridges.
Uses .env files like .env.staging or .env.production, enabling easy configuration changes for different builds without code modifications, as demonstrated in the setup guides.
Provides declaration files for autocompletion and type checking, reducing errors when accessing config variables in TypeScript projects.
Integrates with native build settings, Info.plist, and AndroidManifest.xml, useful for setting platform-specific properties like API keys directly in manifests.
Requires manual linking, Gradle modifications, Xcode scheme configurations, and platform-specific steps (e.g., for Windows), which can be tedious and error-prone, especially for beginners.
The README explicitly warns that secrets in .env files are not obfuscated and can be reverse-engineered, making it unsafe for storing sensitive data without additional security layers.
Due to native code dependencies, testing in JavaScript environments like Jest requires mocking libraries like react-native-config-node, adding overhead to the testing pipeline.
v1.6.0+ mandates React Native 0.73+, causing build errors for older projects and forcing upgrades or version pinning, as noted in the troubleshooting section.