diff --git a/Libraries/Network/RCTNetInfo.m b/Libraries/Network/RCTNetInfo.m index 50c27ba1365..40e164d33d2 100644 --- a/Libraries/Network/RCTNetInfo.m +++ b/Libraries/Network/RCTNetInfo.m @@ -110,6 +110,8 @@ static void RCTReachabilityCallback(__unused SCNetworkReachabilityRef target, SC if (_firstTimeReachability) { SCNetworkReachabilityUnscheduleFromRunLoop(self->_firstTimeReachability, CFRunLoopGetMain(), kCFRunLoopCommonModes); CFRelease(self->_firstTimeReachability); + _firstTimeReachability = nil; + _resolve = nil; } } @@ -184,6 +186,12 @@ static void RCTReachabilityCallback(__unused SCNetworkReachabilityRef target, SC RCT_EXPORT_METHOD(getCurrentConnectivity:(RCTPromiseResolveBlock)resolve reject:(__unused RCTPromiseRejectBlock)reject) { + if (_firstTimeReachability) { + SCNetworkReachabilityUnscheduleFromRunLoop(self->_firstTimeReachability, CFRunLoopGetMain(), kCFRunLoopCommonModes); + CFRelease(self->_firstTimeReachability); + _firstTimeReachability = nil; + _resolve = nil; + } _firstTimeReachability = [self getReachabilityRef]; _resolve = resolve; }