Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xkrsz/react-native-build-env
Configure your app based on the build environment (iOS/Android)
https://github.com/xkrsz/react-native-build-env
Last synced: 8 days ago
JSON representation
Configure your app based on the build environment (iOS/Android)
- Host: GitHub
- URL: https://github.com/xkrsz/react-native-build-env
- Owner: xkrsz
- Created: 2018-09-07T11:26:38.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-09-07T13:01:52.000Z (about 6 years ago)
- Last Synced: 2024-08-09T09:30:08.621Z (3 months ago)
- Language: Java
- Size: 53.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# react-native-build-env
Configure your app based on the build environment (iOS/Android)
[![npm version](https://badge.fury.io/js/react-native-build-env.svg)](https://badge.fury.io/js/react-native-build-env)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)## Getting started
`$ npm install react-native-build-env --save`
### Mostly automatic installation
`$ react-native link react-native-build-env`
### Manual installation
#### iOS
1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`
2. Go to `node_modules` ➜ `react-native-build-env` and add `RNBuildEnv.xcodeproj`
3. In XCode, in the project navigator, select your project. Add `libRNBuildEnv.a` to your project's `Build Phases` ➜ `Link Binary With Libraries`
4. Run your project (`Cmd+R`)<#### Android
1. Open up `android/app/src/main/java/[...]/MainActivity.java`
- Add `import com.reactlibrary.RNBuildEnvPackage;` to the imports at the top of the file
- Add `new RNBuildEnvPackage()` to the list returned by the `getPackages()` method
2. Append the following lines to `android/settings.gradle`:
```
include ':react-native-build-env'
project(':react-native-build-env').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-build-env/android')
```
3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
```
compile project(':react-native-build-env')
```## Usage
```javascript
import { buildEnvironment } from 'react-native-build-env'console.log(buildEnvironment)
```