0.1.2 • Published 8 months ago
react-native-broadcast-receiver-android v0.1.2
react-native-broadcast-receiver-android
Duplicated from https://github.com/mojjominion/react-native-broadcast-receiver
:sparkles: :rocket: Supports React-Native Bridgeless mode
This package allows you to register custom intent to listen in react native applications. The idea here is to reduce the number app builds that are required if you change the native code in react native. With this you can inject custom intent config at runtime.
Installation
npm
npm install react-native-broadcast-receiver-android
yarn
yarn add react-native-broadcast-receiver-android
Usage
Listen to broadcast events with custom intent actions and extraDataKey
import { BroadcastReceiver } from 'react-native-broadcast-receiver-android';
BroadcastReceiver.setIntentActionConfig([
{ action: 'com.zzzz.yyyy.action1', datakey: '<data_key1>' },
{ action: 'com.zzzz.yyyy.action2', datakey: '<data_key2>' },
{ action: 'com.zzzz.yyyy.action3', datakey: '<data_key3>' },
]);
React.useEffect(() => {
const sub = BroadcastReceiver.addEventListner((d) =>
setScanned((x) => [...x, d.data])
);
return () => sub.remove();
}, []);
Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT
Made with create-react-native-library