# react-nativ-broadcast-messages

> simple native module to send a event to native and then native broadcast it to all its subscribers.

Latest version **0.0.2** (published 2017-12-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-nativ-broadcast-messages
pnpm add react-nativ-broadcast-messages
yarn add react-nativ-broadcast-messages
bun add react-nativ-broadcast-messages
```

## 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.0.2 |
| Published | 2017-12-14 |
| First published | 2017-12-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ronnie Ren |
| Maintainers | ronnieren |
| Keywords | react-native, events, messages, broadcast, listener, emitter |

## Links

- npm: https://www.npmjs.com/package/react-nativ-broadcast-messages
- Repository: https://github.com/ronnieren/react-native-broadcast-messages
- Homepage: https://github.com/ronnieren/react-native-broadcast-messages#readme
- Issues: https://github.com/ronnieren/react-native-broadcast-messages/issues
- npm.io page: https://npm.io/package/react-nativ-broadcast-messages

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 0.0.2 (latest) — 2017-12-14
- 0.0.1 — 2017-12-14

## README

# react-native-broadcast-messages

## Getting started

`$ npm install react-native-broadcast-messages --save`

### Mostly automatic installation

`$ react-native link react-native-broadcast-messages`

### 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-broadcast-messages` and add `RNMessages.xcodeproj`
3. In XCode, in the project navigator, select your project. Add `libRNMessages.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.RNMessagesPackage;` to the imports at the top of the file
  - Add `new RNMessagesPackage()` to the list returned by the `getPackages()` method
2. Append the following lines to `android/settings.gradle`:
  	```
  	include ':react-native-broadcast-messages'
  	project(':react-native-broadcast-messages').projectDir = new File(rootProject.projectDir, 	'../node_modules/react-native-broadcast-messages/android')
  	```
3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
  	```
      compile project(':react-native-broadcast-messages')
  	```

#### Windows
    TODO


## Usage
```javascript
import RNMessages from 'react-native-broadcast-messages';

// post a event to native side
RNMessages.postMessage({message: "hello"});
let data = {
    greeting: "hello",
    name: "kitty"
}
RNMessages.postMessage({message: data});

// subscribe the message
RNMessages.addListener((data: any) => {
    console.log(data);
});


```

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