Skip to content

Commit a94dbad

Browse files
committed
fix #38
1 parent b9e7bca commit a94dbad

File tree

4 files changed

+12
-22
lines changed

4 files changed

+12
-22
lines changed

examples/BeaconsDemo/yarn.lock

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3303,13 +3303,9 @@ react-devtools-core@^2.0.8:
33033303
cross-env "^3.1.4"
33043304
ws "^2.0.3"
33053305

3306-
react-native-beacons-manager@^1.0.5:
3307-
version "1.0.5"
3308-
resolved "https://registry.yarnpkg.com/react-native-beacons-manager/-/react-native-beacons-manager-1.0.5.tgz#14c5e6de0f1deced30c42d4a3ab3e38fb3cb0516"
3309-
33103306
"react-native-beacons-manager@git+https://github.com/MacKentoch/react-native-beacons-manager.git":
33113307
version "1.0.6"
3312-
resolved "git+https://github.com/MacKentoch/react-native-beacons-manager.git#4cac5a9f688dc6d8b79d19f54510d37c862f19b8"
3308+
resolved "git+https://github.com/MacKentoch/react-native-beacons-manager.git#b9e7bca76648a4ebd1164c8618d377a730b39d7c"
33133309

33143310
react-native-bluetooth-state@^2.0.0:
33153311
version "2.0.0"

index.js

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,9 @@
22

33
import { Platform } from 'react-native';
44

5-
const RNiBeaconAndroid = require('./lib/module.android.js');
6-
const RNiBeaconIOS = require('./lib/module.ios.js');
7-
8-
function moduleSelector() {
9-
if (Platform.OS === 'ios') {
10-
return RNiBeaconIOS;
11-
}
12-
return RNiBeaconAndroid;
13-
}
14-
15-
const RNiBeaconsModule = moduleSelector();
5+
const RNiBeaconsModule = Platform.select({
6+
ios: () => require('./lib/module.ios.js'),
7+
android: () => require('./lib/module.android.js')
8+
})();
169

1710
export default RNiBeaconsModule;

lib/module.android.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// @flow
22

3-
import { NativeModules } from 'react-native';
3+
const RN = require('react-native');
44

5-
const beaconsAndroid: any = NativeModules.BeaconsAndroidModule;
5+
const beaconsAndroid: any = RN.NativeModules.BeaconsAndroidModule;
66

77
const PARSER_IBEACON: string = 'm:0-3=4c000215,i:4-19,i:20-21,i:22-23,p:24-24';
88
const PARSER_ESTIMOTE: string = 'm:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24';
@@ -206,7 +206,7 @@ function stopRangingBeaconsInRegion(regionId: string, beaconsUUID?: string): Pro
206206
);
207207
}
208208

209-
export default {
209+
module.exports = {
210210
setHardwareEqualityEnforced,
211211
detectIBeacons,
212212
detectAltBeacons,

lib/module.ios.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// @flow
22

3-
import { NativeModules } from 'react-native';
4-
const NativeRNiBeacons = NativeModules.RNiBeacon;
3+
const RN = require('react-native');
54

6-
export default NativeRNiBeacons;
5+
const NativeRNiBeacons = RN.NativeModules.RNiBeacon;
6+
7+
module.exports = NativeRNiBeacons;

0 commit comments

Comments
 (0)