Skip to content

Commit a1b1263

Browse files
rafaellincolnfacebook-github-bot
authored andcommitted
Fix Warnings in Xcode (#23184)
Summary: His PR is related to #22609 Changelog: ---------- [IOS][Changed] - Fix warning in RCTImage [IOS][Changed] - Fix warning in RCTNetwork Pull Request resolved: facebook/react-native#23184 Differential Revision: D13838680 Pulled By: cpojer fbshipit-source-id: 698303e44bb85a4819abff7d71e0b75936c09dc8
1 parent 272b16f commit a1b1263

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

RCTNetInfo.m

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,25 @@ static void RCTReachabilityCallback(__unused SCNetworkReachabilityRef target, SC
5252
{
5353
RCTNetInfo *self = (__bridge id)info;
5454
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+
5560
if (self->_firstTimeReachability && self->_resolve) {
5661
SCNetworkReachabilityUnscheduleFromRunLoop(self->_firstTimeReachability, CFRunLoopGetMain(), kCFRunLoopCommonModes);
5762
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});
6166
self->_firstTimeReachability = nil;
6267
self->_resolve = nil;
6368
}
6469

6570
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}];
6974
}
7075
}
7176

0 commit comments

Comments
 (0)