-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
23 lines (19 loc) · 854 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// import {NativeModules, DeviceEventEmitter, Platform} from 'react-native';
// const {RNAmapLocation} = NativeModules;
import { NativeModules, NativeEventEmitter, Platform } from "react-native"
const { RNAmapLocation } = NativeModules
const eventEmitter = new NativeEventEmitter(RNAmapLocation)
let gOptions = null;
const AMapLocation = {
init: key => RNAmapLocation.init(Platform.select(key)),
setOptions: options => {
gOptions = options;
RNAmapLocation.setOptions(options)
},
startLocation: (options) => RNAmapLocation.startLocation(Object.assign({}, gOptions, options)),
stopLocation: () => RNAmapLocation.stopLocation(),
destroyLocation: () => RNAmapLocation.destroyLocation(),
addListener: listener =>
eventEmitter.addListener("AMapLocationChanged", listener)
};
export default AMapLocation;