@@ -52,20 +52,25 @@ static void RCTReachabilityCallback(__unused SCNetworkReachabilityRef target, SC
52
52
{
53
53
RCTNetInfo *self = (__bridge id )info;
54
54
BOOL didSetReachabilityFlags = [self setReachabilityStatus: flags];
55
+
56
+ NSString *connectionType = self->_connectionType ?: RCTConnectionTypeUnknown;
57
+ NSString *effectiveConnectionType = self->_effectiveConnectionType ?: RCTEffectiveConnectionTypeUnknown;
58
+ NSString *networkInfo = self->_statusDeprecated ?: RCTReachabilityStateUnknown;
59
+
55
60
if (self->_firstTimeReachability && self->_resolve ) {
56
61
SCNetworkReachabilityUnscheduleFromRunLoop (self->_firstTimeReachability , CFRunLoopGetMain (), kCFRunLoopCommonModes );
57
62
CFRelease (self->_firstTimeReachability );
58
- self->_resolve (@{@" connectionType" : self-> _connectionType ?: RCTConnectionTypeUnknown ,
59
- @" effectiveConnectionType" : self-> _effectiveConnectionType ?: RCTEffectiveConnectionTypeUnknown ,
60
- @" network_info" : self-> _statusDeprecated ?: RCTReachabilityStateUnknown });
63
+ self->_resolve (@{@" connectionType" : connectionType ,
64
+ @" effectiveConnectionType" : effectiveConnectionType ,
65
+ @" network_info" : networkInfo });
61
66
self->_firstTimeReachability = nil ;
62
67
self->_resolve = nil ;
63
68
}
64
69
65
70
if (didSetReachabilityFlags && self->_isObserving ) {
66
- [self sendEventWithName: @" networkStatusDidChange" body: @{@" connectionType" : self-> _connectionType ,
67
- @" effectiveConnectionType" : self-> _effectiveConnectionType ,
68
- @" network_info" : self-> _statusDeprecated }];
71
+ [self sendEventWithName: @" networkStatusDidChange" body: @{@" connectionType" : connectionType ,
72
+ @" effectiveConnectionType" : effectiveConnectionType ,
73
+ @" network_info" : networkInfo }];
69
74
}
70
75
}
71
76
0 commit comments