@@ -147,7 +147,7 @@ var NetInfo = {
147147 eventName : ChangeEventName ,
148148 handler : Function
149149 ) : void {
150- _subscriptions[ handler ] = RCTDeviceEventEmitter . addListener (
150+ _subscriptions[ String ( handler ) ] = RCTDeviceEventEmitter . addListener (
151151 DEVICE_REACHABILITY_EVENT ,
152152 ( appStateData ) => {
153153 handler ( appStateData . network_reachability ) ;
@@ -159,11 +159,11 @@ var NetInfo = {
159159 eventName : ChangeEventName ,
160160 handler : Function
161161 ) : void {
162- if ( ! _subscriptions [ handler ] ) {
162+ if ( ! _subscriptions [ String ( handler ) ] ) {
163163 return ;
164164 }
165- _subscriptions [ handler ] . remove ( ) ;
166- _subscriptions [ handler ] = null ;
165+ _subscriptions [ String ( handler ) ] . remove ( ) ;
166+ _subscriptions [ String ( handler ) ] = null ;
167167 } ,
168168
169169 fetch: function ( ) : Promise {
@@ -204,12 +204,12 @@ NetInfo.isConnected = {
204204 eventName : ChangeEventName ,
205205 handler : Function
206206 ) : void {
207- _isConnectedSubscriptions[ handler ] = ( connection ) => {
207+ _isConnectedSubscriptions[ String ( handler ) ] = ( connection ) => {
208208 handler ( _isConnected ( connection ) ) ;
209209 } ;
210210 NetInfo . addEventListener (
211211 eventName ,
212- _isConnectedSubscriptions [ handler ]
212+ _isConnectedSubscriptions [ String ( handler ) ]
213213 ) ;
214214 } ,
215215
@@ -219,7 +219,7 @@ NetInfo.isConnected = {
219219 ) : void {
220220 NetInfo. removeEventListener (
221221 eventName ,
222- _isConnectedSubscriptions [ handler ]
222+ _isConnectedSubscriptions [ String ( handler ) ]
223223 ) ;
224224 } ,
225225
0 commit comments