@hollyoops/react-native-config
TypeScript icon, indicating that this package has built-in type declarations

0.11.8 • Public • Published

Config variables for React Native apps

Module to expose config variables to your javascript code in React Native, supporting both iOS and Android.

Bring some 12 factor love to your mobile apps!

IMPORTANT

This repo just folk from react-native-config to fix some bugs and there is a new library react-native-env is on the way!

To view more usage just refer to react-native-env

Basic Usage

Create a new file .env in the root of your React Native app:

API_URL=https://myapi.com
GOOGLE_MAPS_API_KEY=abcdefgh

Then access variables defined there from your app:

import Config from "react-native-config";

Config.API_URL; // 'https://myapi.com'
Config.GOOGLE_MAPS_API_KEY; // 'abcdefgh'

Keep in mind this module doesn't obfuscate or encrypt secrets for packaging, so do not store sensitive keys in .env. It's basically impossible to prevent users from reverse engineering mobile app secrets, so design your app (and APIs) with that in mind.

Package Sidebar

Install

npm i @hollyoops/react-native-config

Weekly Downloads

0

Version

0.11.8

License

MIT

Unpacked Size

67.1 kB

Total Files

24

Last publish

Collaborators

  • holy.li