https://github.com/hikouki/hey-react-native
:email: Send message to react-native app from react-native-webview.
https://github.com/hikouki/hey-react-native
emit events message react-native react-native-webview typescript
Last synced: 4 months ago
JSON representation
:email: Send message to react-native app from react-native-webview.
- Host: GitHub
- URL: https://github.com/hikouki/hey-react-native
- Owner: hikouki
- License: mit
- Created: 2020-10-24T03:38:09.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2020-10-24T05:47:00.000Z (over 4 years ago)
- Last Synced: 2024-04-29T06:21:52.853Z (about 1 year ago)
- Topics: emit, events, message, react-native, react-native-webview, typescript
- Language: TypeScript
- Homepage:
- Size: 57.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# hey-react-native

Send message to react-native app from react-native-webview.
If not in the react-native-webview, It won't do anything.
## Install
```
npm install hey-react-native
```## Usage
Please refer to [tests](https://github.com/hikouki/hey-react-native/blob/main/__tests__/index.spec.ts).
```typescript
import { HeyReactNative } from "hey-react-native";const hey = new HeyReactNative({ debug: true });
hey.emit({ event: 'ping', value: 'pong' });// => console.log {"event":"ping","value":"pong"}
```If you want to specify a event name.
```typescript
import { HeyReactNative } from "hey-react-native";const hey = new HeyReactNative<'ping'>({ debug: true });
hey.emit({ event: 'ping', value: 'pong' });
```## License
hey-react-native is [MIT licensed](https://github.com/hikouki/hey-react-native/blob/main/LICENSE).