Update RCTNetworking, RCTNetInfo and RCTLocationManager to use new events system

Summary: Updated networking and geolocation to use the new events system.

Reviewed By: javache

Differential Revision: D3339945

fbshipit-source-id: f1332fb2aab8560e4783739e223c1f31d583cfcf
This commit is contained in:
Nick Lockwood
2016-05-24 10:26:33 -07:00
committed by Facebook Github Bot 3
parent 71bf8a3e48
commit 3f08fe4b7f
27 changed files with 229 additions and 340 deletions

View File

@@ -12,12 +12,14 @@
'use strict';
const Map = require('Map');
const NativeEventEmitter = require('NativeEventEmitter');
const NativeModules = require('NativeModules');
const Platform = require('Platform');
const RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
const RCTNetInfo = NativeModules.NetInfo;
const deprecatedCallback = require('deprecatedCallback');
const NetInfoEventEmitter = new NativeEventEmitter(RCTNetInfo);
const DEVICE_CONNECTIVITY_EVENT = 'networkStatusDidChange';
type ChangeEventName = $Enum<{
@@ -176,7 +178,7 @@ const NetInfo = {
eventName: ChangeEventName,
handler: Function
): {remove: () => void} {
const listener = RCTDeviceEventEmitter.addListener(
const listener = NetInfoEventEmitter.addListener(
DEVICE_CONNECTIVITY_EVENT,
(appStateData) => {
handler(appStateData.network_info);