# react-native-config-bridge

> The aim of this library is to pass variables from Android and iOS native sides to Javascript. This is useful to know what buildType/configuration the current app is built upon.

Latest version **0.9.3** (published 2020-02-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-native-config-bridge
pnpm add react-native-config-bridge
yarn add react-native-config-bridge
bun add react-native-config-bridge
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.9.3 |
| Published | 2020-02-10 |
| First published | 2020-01-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 346.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Eze Livinsky |
| Maintainers | elivinsky, npmdigbang |
| Keywords | react-native |

## Links

- npm: https://www.npmjs.com/package/react-native-config-bridge
- Repository: https://github.com/digbang/react-native-config-bridge
- Homepage: https://github.com/digbang/react-native-config-bridge#readme
- Issues: https://github.com/digbang/react-native-config-bridge/issues
- npm.io page: https://npm.io/package/react-native-config-bridge

## Recent versions

- 0.9.3 (latest) — 2020-02-10
- 0.9.2 — 2020-01-28

## README

# react-native-config-bridge

The aim of this library is to read variables from Android and iOS native config with Javascript. This can be useful, for example, to know what buildType/flavor/configuration the current app has been built upon.

## Getting started

```shell script
yarn add react-native-config-bridge
```

##### For RN 0.60 and upper
```shell script
cd ios
pod install
```

##### For RN 0.59 and below
```shell script
react-native link react-native-config-bridge
```

## Usage
##### Android

1. Edit your `android/app/build.gradle`
    ```gradle
    ...
    defaultConfig {
        ...
        buildConfigField('String', 'ENV_NAME', '"development"')
    }
    ...
    ```
1. Override your config field per buildType or flavor, if needed.
    ```gradle
    ...
    buildTypes {
        ...
        release {
            ...
            buildConfigField('String', 'ENV_NAME', '"production"')
        }
    }
    ...
    ```
1. Enjoy.

##### iOS
1. Edit your `ios/Info.plist`
    ```xml
    ...
    <key>ENV_NAME</key>
    <string>$(BUILD_SETTING_NAME)</string>
    ...
    ```
2. Create a new build setting (`BUILD_SETTING_NAME` is a placeholder) in your target
3. Customize the build setting for each configuration, if needed.


##### Javascript
```javascript
import RNConfig from 'react-native-config-bridge';

const envName = RNConfig.ENV_NAME;
```

---
_Source: https://npm.io/package/react-native-config-bridge · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
