UNPKG

expo-react-native-ibeacon

Version:
44 lines 1.75 kB
import ExpoReactNativeIbeaconModule from "./ExpoReactNativeIbeaconModule"; import { NativeModules, NativeEventEmitter } from "react-native"; export function startScanning(beacon) { return ExpoReactNativeIbeaconModule.startScanning(beacon, null); } export const BeaconScanner = () => { const { BeaconManager } = NativeModules; const eventEmittedFromIOS = new NativeEventEmitter(NativeModules.RNEventEmitter); const requestAlwaysAuthorization = () => { BeaconManager.requestAlwaysAuthorization(); }; const startScanning = (uuid) => { BeaconManager.startScanning(uuid, null); }; const stopScanning = (uuid) => { BeaconManager.stopScanning(uuid); }; function addBeaconsDetectedListener(listener) { return eventEmittedFromIOS.addListener("onBeaconsDetected", listener); } function addBeaconsEnterRegionListener(listener) { return eventEmittedFromIOS.addListener("onEnterRegion", listener); } function addBeaconsExitRegionListener(listener) { return eventEmittedFromIOS.addListener("onExitRegion", listener); } function addBeaconsBluetoothStateChangedListener(listener) { return eventEmittedFromIOS.addListener("onBluetoothStateChanged", listener); } function addBeaconsDetermineStateListener(listener) { return eventEmittedFromIOS.addListener("onDetermineState", listener); } return { requestAlwaysAuthorization, startScanning, stopScanning, addBeaconsDetectedListener, addBeaconsEnterRegionListener, addBeaconsExitRegionListener, addBeaconsBluetoothStateChangedListener, addBeaconsDetermineStateListener, }; }; //# sourceMappingURL=index.js.map