From 151876277233befdbe7c0d9818039aa08ad15d1c Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Tue, 20 Oct 2026 20:23:47 +0200 Subject: [PATCH] Fix nullability annotations in iOS networking headers --- .../Libraries/Network/RCTHTTPRequestHandler.h | 8 ++++++-- .../React/Base/RCTMultipartDataTask.h | 15 ++++++++++----- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/packages/react-native/Libraries/Network/RCTHTTPRequestHandler.h b/packages/react-native/Libraries/Network/RCTHTTPRequestHandler.h index 15d986e529c8..7c86b27bae07 100644 --- a/packages/react-native/Libraries/Network/RCTHTTPRequestHandler.h +++ b/packages/react-native/Libraries/Network/RCTHTTPRequestHandler.h @@ -8,12 +8,14 @@ #import #import +NS_ASSUME_NONNULL_BEGIN + typedef NSURLSessionConfiguration *_Nullable (^NSURLSessionConfigurationProvider)(void); /** * The block provided via this function will provide the NSURLSessionConfiguration for all HTTP requests made by the * app. */ -RCT_EXTERN void RCTSetCustomNSURLSessionConfigurationProvider(NSURLSessionConfigurationProvider /*provider*/); +RCT_EXTERN void RCTSetCustomNSURLSessionConfigurationProvider(NSURLSessionConfigurationProvider _Nullable /*provider*/); typedef NSURLRequest *_Nullable (^RCTHTTPRequestInterceptor)(NSURLRequest *request); /** @@ -21,7 +23,7 @@ typedef NSURLRequest *_Nullable (^RCTHTTPRequestInterceptor)(NSURLRequest *reque * they are sent. Return a modified request to override, or nil to use the * original request unchanged. */ -RCT_EXTERN void RCTSetCustomHTTPRequestInterceptor(RCTHTTPRequestInterceptor /*interceptor*/); +RCT_EXTERN void RCTSetCustomHTTPRequestInterceptor(RCTHTTPRequestInterceptor _Nullable /*interceptor*/); /** * This is the default RCTURLRequestHandler implementation for HTTP requests. @@ -29,3 +31,5 @@ RCT_EXTERN void RCTSetCustomHTTPRequestInterceptor(RCTHTTPRequestInterceptor /*i @interface RCTHTTPRequestHandler : NSObject @end + +NS_ASSUME_NONNULL_END diff --git a/packages/react-native/React/Base/RCTMultipartDataTask.h b/packages/react-native/React/Base/RCTMultipartDataTask.h index 9b94a260a902..b161bf33b325 100644 --- a/packages/react-native/React/Base/RCTMultipartDataTask.h +++ b/packages/react-native/React/Base/RCTMultipartDataTask.h @@ -10,11 +10,13 @@ #import #import +NS_ASSUME_NONNULL_BEGIN + typedef void (^RCTMultipartDataTaskCallback)( NSInteger statusCode, - NSDictionary *headers, - NSData *content, - NSError *error, + NSDictionary *_Nullable headers, + NSData *_Nullable content, + NSError *_Nullable error, BOOL done); typedef NSURLRequest *_Nullable (^RCTMultipartDataTaskRequestInterceptor)(NSURLRequest *request); @@ -23,14 +25,17 @@ typedef NSURLRequest *_Nullable (^RCTMultipartDataTaskRequestInterceptor)(NSURLR * requests before they are sent. Return a modified request to override, or nil * to use the original request unchanged. */ -RCT_EXTERN void RCTSetCustomMultipartDataTaskRequestInterceptor(RCTMultipartDataTaskRequestInterceptor /*interceptor*/); +RCT_EXTERN void RCTSetCustomMultipartDataTaskRequestInterceptor( + RCTMultipartDataTaskRequestInterceptor _Nullable /*interceptor*/); @interface RCTMultipartDataTask : NSObject - (instancetype)initWithURL:(NSURL *)url partHandler:(RCTMultipartDataTaskCallback)partHandler - progressHandler:(RCTMultipartProgressCallback)progressHandler; + progressHandler:(nullable RCTMultipartProgressCallback)progressHandler; - (void)startTask; @end + +NS_ASSUME_NONNULL_END