An open API service indexing awesome lists of open source software.

https://github.com/callstack/react-native-brownfield

Set of helpers to make your brownfield integration smooth and easy.
https://github.com/callstack/react-native-brownfield

Last synced: 6 months ago
JSON representation

Set of helpers to make your brownfield integration smooth and easy.

Awesome Lists containing this project

README

          


React Native Brownfield


Set of helpers to make your brownfield integration smooth and easy.

---

[![Build Status][build-badge]][build]
[![Version][version-badge]][package]
[![MIT License][license-badge]][license]

[![PRs Welcome][prs-welcome-badge]][prs-welcome]
[![Chat][chat-badge]][chat]
[![Code of Conduct][coc-badge]][coc]
[![Sponsored by Callstack][callstack-badge]][callstack]

[![tweet][tweet-badge]][tweet]

## Features

- **Easily integrate** React Native with existing native app
- Start React Native with **one method** and invoke code as soon as it's loaded
- Compatible with **both old and new React Native architecture**!
- Reuse the same instance of React Native between different components
- Use predefined **native building blocks** - crafted for React Native
- Disable and enable **native gestures and hardware buttons** from JavaScript
- Works well with **any native navigation** pattern, as well as every React Native JavaScript based navigation
- Compatible with all native languages **Objective-C**, **Swift**, **Java** and **Kotlin**
- Supports UIKit and SwiftUI on iOS and Fragments and Jetpack Compose on Android

## Installation

```sh
npm install @callstack/react-native-brownfield
```

or

```sh
yarn add @callstack/react-native-brownfield
```

## Enabling New Architecture

### Android
Add the following to your `android/gradle.properties`:

```
# Enable new architecture
newArchEnabled=true
```

### iOS
Install cocoapods with the flag:

```
RCT_NEW_ARCH_ENABLED=1 pod install
```

> [!NOTE]
> New Architecture is enabled by default from React Native 0.76

## Usage

React Native Brownfield library works with all major native programming languages. Majority of its API is exposed on the native side. Click on the logo to choose the one that interests you:

| [Objective-C
Objective-C](docs/OBJECTIVE_C.md) | [Swift
Swift](docs/SWIFT.md) | [Java
Java](docs/JAVA.md) | [Kotlin
Kotlin](docs/KOTLIN.md) |
| :---: | :---: | :---: | :---: |

### JavaScript Module

Besides native components, we are exposing JavaScript functions to control the behavior of those components.

To use the module, simply import it:

```js
import ReactNativeBrownfield from '@callstack/react-native-brownfield';
```

### JavaScript API Reference:

**setNativeBackGestureAndButtonEnabled(enabled: boolean)**

A method used to toggle iOS native back gesture and Android hardware back button.

```js
ReactNativeBrownfield.setNativeBackGestureAndButtonEnabled(true);
```

**popToNative(animated[iOS only]: boolean)**

A method to pop to native screen used to push React Native experience.

```js
ReactNativeBrownfield.popToNative(true);
```

> NOTE: Those methods works only with native components provided by this library.

## Made with ❤️ at Callstack

React Native Brownfield is an open source project and will always remain free to use. If you think it's cool, please star it 🌟. [Callstack](https://callstack.com) is a group of React and React Native geeks, contact us at [hello@callstack.com](mailto:hello@callstack.com) if you need any help with these or just want to say hi!

Like the project? ⚛️ [Join the team](https://callstack.com/careers/?utm_campaign=Senior_RN&utm_source=github&utm_medium=readme) who does amazing stuff for clients and drives React Native Open Source! 🔥

## Contributors

Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):

| [Michał Chudziak
Michał Chudziak](https://twitter.com/michalchudziak)
[💻](https://github.com/callstack/react-native-brownfield/commits?author=michalchudziak "Code") [📖](https://github.com/callstack/react-native-brownfield/commits?author=michalchudziak "Documentation") [🤔](#ideas-michalchudziak "Ideas, Planning, & Feedback") | [Piotr Drapich
Piotr Drapich](https://twitter.com/dratwas)
[💻](https://github.com/callstack/react-native-brownfield/commits?author=dratwas "Code") [🤔](#ideas-dratwas "Ideas, Planning, & Feedback") |
| :---: | :---: |

This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!

[build-badge]: https://img.shields.io/circleci/build/github/callstack/react-native-brownfield/master.svg?style=flat-square
[build]: https://circleci.com/gh/callstack/react-native-brownfield
[version-badge]: https://img.shields.io/npm/v/@callstack/react-native-brownfield.svg?style=flat-square
[package]: https://www.npmjs.com/package/@callstack/react-native-brownfield
[license-badge]: https://img.shields.io/npm/l/@callstack/react-native-brownfield.svg?style=flat-square
[license]: https://opensource.org/licenses/MIT
[prs-welcome-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
[prs-welcome]: http://makeapullrequest.com
[coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square
[coc]: https://github.com/callstack/react-native-brownfield/blob/master/CODE_OF_CONDUCT.md
[all-contributors-badge]: https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square
[chat-badge]: https://img.shields.io/discord/613446453762719798.svg?style=flat-square&colorB=758ED3
[chat]: https://discord.gg/2SR9Mua
[tweet-badge]: https://img.shields.io/badge/tweet-%23reacnativebrownfield-blue.svg?style=flat-square&colorB=1DA1F2&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAUCAYAAACXtf2DAAAAAXNSR0IArs4c6QAAAaRJREFUOBGtlM8rBGEYx3cWtRHJRaKcuMtBSitxkCQ3LtzkP9iUUu5ODspRHLhRLtq0FxeicEBC2cOivcge%2FMgan3fNM8bbzL4zm6c%2BPT%2Fe7%2FO8887svrFYBWbbtgWzsAt3sAcpqJFxxF1QV8oJFqFPFst5dLWQAT87oTgPB7DtziFRT1EA4yZolsFkhwjGYFRO8Op0KD8HVe7unoB6PRTBZG8IctAmG1xrHcfkQ2B55sfI%2ByGMXSBqV71xZ8CWdxBxN6ThFuECDEAL%2Bc9HIzDYumVZ966GZnX0SzCZvEqTbkaGywkyFE6hKAsBPhFQ18uPUqh2ggJ%2BUor%2F4M%2F%2FzOC8g6YzR1i%2F8g4vvSI%2ByD7FFNjexQrjHd8%2BnjABI3AU4Wl16TuF1qANGll81jsi5qu%2Bw6XIsCn4ijhU5FmCJpkV6BGNw410hfSf6JKBQ%2FUFxHGYBnWnmOwDwYQ%2BwzdHqO75HtiAMJfaC7ph32FSRJCENUhDHsLaJkL%2FX4wMF4%2BwA5bgAcrZE4sr0Cu9Jq9fxyrvBHWbNkMD5CEHWTjjT2m6r5D92jfmbbKJEWuMMAAAAABJRU5ErkJggg%3D%3D
[tweet]: https://twitter.com/intent/tweet?text=Check%20out%20react-native-brownfield!%20https://github.com/callstack/react-native-brownfield%20%F0%9F%91%8D
[callstack-badge]: https://callstack.com/images/callstack-badge.svg
[callstack]: https://callstack.com/open-source/?utm_source=github.com&utm_medium=referral&utm_campaign=rnbrownfield&utm_term=readme