Skip to content

Commit

Permalink
fix: fix error argument is marked as nullable but React requires that…
Browse files Browse the repository at this point in the history
… all NSNumber arguments are nonnull
  • Loading branch information
DavideViolante committed Aug 9, 2024
1 parent d98ccfc commit b3f4e84
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ios/RNWifi.m
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ + (BOOL)requiresMainQueueSetup
RCT_EXPORT_METHOD(connectToSSID:(NSString*)ssid
resolver:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject) {
[self connectToProtectedSSID:ssid withPassphrase:@"" isWEP:false isHidden:false timeout:nil resolver:resolve rejecter:reject];
NSNumber *defaultTimeout = @(0); // Provide a default value for timeout, fix issue #379
[self connectToProtectedSSID:ssid withPassphrase:@"" isWEP:false isHidden:false timeout:defaultTimeout resolver:resolve rejecter:reject];
}

RCT_EXPORT_METHOD(connectToSSIDPrefix:(NSString*)ssid
Expand Down Expand Up @@ -131,7 +132,7 @@ + (BOOL)requiresMainQueueSetup
withPassphrase:(NSString*)passphrase
isWEP:(BOOL)isWEP
isHidden:(BOOL)isHidden
timeout:(nullable NSNumber *)timeout
timeout:(nonnull NSNumber *)timeout // Explicitly mark timeout as nonnull, fix issue #379
resolver:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject) {
[self connectToProtectedSSIDOnce:ssid withPassphrase:passphrase isWEP:isWEP joinOnce:false resolver:resolve rejecter:reject];
Expand Down

0 comments on commit b3f4e84

Please sign in to comment.