Skip to content

Commit 391f480

Browse files
Merge pull request #13 from callstack-internal/docs
Documentation
2 parents c9c67bb + 2da7047 commit 391f480

File tree

10 files changed

+642
-8
lines changed

10 files changed

+642
-8
lines changed

CODE_OF_CONDUCT.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, gender identity and expression, level of experience,
9+
nationality, personal appearance, race, religion, or sexual identity and
10+
orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at [[email protected]](mailto:[email protected]). All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct/
72+
73+
[homepage]: https://www.contributor-covenant.org

README.md

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
<p align="center">
2+
<img alt="React Native Brownfield" src="https://user-images.githubusercontent.com/7837457/63594721-7f7b8800-c5b7-11e9-87ef-a0898cd22fcc.png" width="800">
3+
</p>
4+
5+
<p align="center">
6+
Set of helpers to make your brownfield integration smooth and easy.
7+
</p>
8+
9+
---
10+
11+
[![Build Status][build-badge]][build]
12+
[![Version][version-badge]][package]
13+
[![MIT License][license-badge]][license]
14+
15+
[![PRs Welcome][prs-welcome-badge]][prs-welcome]
16+
[![Chat][chat-badge]][chat]
17+
[![Code of Conduct][coc-badge]][coc]
18+
[![Sponsored by Callstack][callstack-badge]][callstack]
19+
20+
[![tweet][tweet-badge]][tweet]
21+
22+
## Features
23+
24+
- **Easily integrate** React Native with existing native app
25+
- Start React Native with **one method** and invoke code as soon as it's loaded
26+
- Reuse the same instance of React Native **bridge** between different components
27+
- Use predefined **native building blocks** - crafted for React Native
28+
- Disable and enable **native gestures and hardware buttons** from JavaScript
29+
- Works well with **any native navigation** pattern, as well as every React Native JavaScript based navigation
30+
- Compatible with all native languages **Objective-C**, **Swift**, **Java** and **Kotlin**
31+
32+
33+
## Installation
34+
35+
```sh
36+
npm install @callstack/react-native-brownfield
37+
```
38+
39+
or
40+
41+
```sh
42+
yarn add @callstack/react-native-brownfield
43+
```
44+
45+
## Usage
46+
47+
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:
48+
49+
| [<img src="https://user-images.githubusercontent.com/7837457/63374769-cafd1e80-c38a-11e9-9724-e797a199ebab.png" width="100px;" alt="Objective-C"/><br /><sub><b>Objective-C</b></sub>](docs/OBJECTIVE_C.md) | [<img src="https://user-images.githubusercontent.com/7837457/63374778-ce90a580-c38a-11e9-8f37-72a9a5b9a52f.png" width="100px;" alt="Swift"/><br /><sub><b>Swift</b></sub>](docs/SWIFT.md) | [<img src="https://user-images.githubusercontent.com/7837457/63374794-d2bcc300-c38a-11e9-9a7f-d538563b75db.png" width="100px;" alt="Java"/><br /><sub><b>Java</b></sub>](docs/JAVA.md) | [<img src="https://user-images.githubusercontent.com/7837457/63374783-d0f2ff80-c38a-11e9-9790-041cad53b259.png" width="100px;" alt="Kotlin"/><br /><sub><b>Kotlin</b></sub>](docs/KOTLIN.md) |
50+
| :---: | :---: | :---: | :---: |
51+
52+
### JavaScript Module
53+
54+
Besides native components, we are exposing JavaScript functions to control the behavior of those components.
55+
56+
To use the module, simply import it:
57+
58+
```js
59+
import ReactNativeBrownfield from '@callstack/react-native-brownfield';
60+
```
61+
62+
### JavaScript API Reference:
63+
64+
**setNativeBackGestureAndButtonEnabled(enabled: boolean)**
65+
66+
A method used to toggle iOS native back gesture and Android hardware back button.
67+
68+
```js
69+
ReactNativeBrownfield.setNativeBackGestureAndButtonEnabled(true);
70+
```
71+
72+
**popToNative(animated[iOS only]: boolean)**
73+
74+
A method to pop to native screen used to push React Native experience.
75+
76+
```js
77+
ReactNativeBrownfield.popToNative(true);
78+
```
79+
80+
> NOTE: Those methods works only with native components provided by this library.
81+
82+
## Made with ❤️ at Callstack
83+
84+
Linaria 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 [[email protected]](mailto:[email protected]) if you need any help with these or just want to say hi!
85+
86+
## Contributors
87+
88+
Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):
89+
90+
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
91+
<!-- prettier-ignore -->
92+
| [<img src="https://avatars0.githubusercontent.com/u/7837457?s=460&v=4" width="100px;" alt="Michał Chudziak"/><br /><sub><b>Michał Chudziak</b></sub>](https://twitter.com/michalchudziak)<br />[💻](https://github.com/callstack/linaria/commits?author=michalchudziak "Code") [📖](https://github.com/callstack/linaria/commits?author=michalchudziak "Documentation") [🤔](#ideas-michalchudziak "Ideas, Planning, & Feedback") | [<img src="https://avatars1.githubusercontent.com/u/16336501?s=400&v=4" width="100px;" alt="Piotr Drapich"/><br /><sub><b>Piotr Drapich</b></sub>](https://twitter.com/dratwas)<br />[💻](https://github.com/callstack/linaria/commits?author=dratwas "Code") [🤔](#ideas-dratwas "Ideas, Planning, & Feedback") |
93+
| :---: | :---: |
94+
95+
<!-- ALL-CONTRIBUTORS-LIST:END -->
96+
97+
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!
98+
99+
<!-- badges -->
100+
[build-badge]: https://img.shields.io/circleci/build/github/callstack/react-native-brownfield/master.svg?style=flat-square
101+
[build]: https://circleci.com/gh/callstack/react-native-brownfield
102+
[version-badge]: https://img.shields.io/npm/v/@callstack/react-native-brownfield.svg?style=flat-square
103+
[package]: https://www.npmjs.com/package/@callstack/react-native-brownfield
104+
[license-badge]: https://img.shields.io/npm/l/@callstack/react-native-brownfield.svg?style=flat-square
105+
[license]: https://opensource.org/licenses/MIT
106+
[prs-welcome-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
107+
[prs-welcome]: http://makeapullrequest.com
108+
[coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square
109+
[coc]: https://github.com/callstack/react-native-brownfield/blob/master/CODE_OF_CONDUCT.md
110+
[all-contributors-badge]: https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square
111+
[chat-badge]: https://img.shields.io/discord/613446453762719798.svg?style=flat-square&colorB=758ED3
112+
[chat]: https://discord.gg/2SR9Mua
113+
[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
114+
[tweet]: https://twitter.com/intent/tweet?text=Check%20out%20react-native-brownfield!%20https://github.com/callstack/react-native-brownfield%20%F0%9F%91%8D
115+
[callstack-badge]: https://callstack.com/images/callstack-badge.svg
116+
[callstack]: https://callstack.com/open-source/?utm_source=github.com&utm_medium=referral&utm_campaign=rnbrownfield&utm_term=readme

android/src/main/java/com/callstack/reactnativebrownfield/ReactNativeBrownfield.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ class ReactNativeBrownfield private constructor(val reactNativeHost: ReactNative
1919
val shared: ReactNativeBrownfield get() = instance
2020

2121
@JvmStatic
22-
fun initialize(rnHost: ReactNativeHost, application: Application) {
22+
fun initialize(application: Application, rnHost: ReactNativeHost) {
2323
if(!initialized.getAndSet(true)) {
2424
instance = ReactNativeBrownfield(rnHost)
2525
SoLoader.init(application.applicationContext,false)
2626
}
2727
}
2828

2929
@JvmStatic
30-
fun initialize(options: HashMap<String, Any>, application: Application) {
30+
fun initialize(application: Application, options: HashMap<String, Any>) {
3131
val rnHost = object : ReactNativeHost(application) {
3232
override fun getUseDeveloperSupport(): Boolean {
3333
return options["useDeveloperSupport"] as? Boolean ?: BuildConfig.DEBUG
@@ -43,14 +43,14 @@ class ReactNativeBrownfield private constructor(val reactNativeHost: ReactNative
4343
}
4444
}
4545

46-
initialize(rnHost, application)
46+
initialize(application, rnHost)
4747
}
4848

4949
@JvmStatic
50-
fun initialize(packages: List<ReactPackage>, application: Application) {
50+
fun initialize(application: Application, packages: List<ReactPackage>) {
5151
val options = hashMapOf("packages" to packages, "mainModuleName" to "index")
5252

53-
initialize(options, application)
53+
initialize(application, options)
5454
}
5555
}
5656

0 commit comments

Comments
 (0)