From 346b02822710152292eca25a711e9eeca68ab941 Mon Sep 17 00:00:00 2001 From: Tommy Nguyen <4123478+tido64@users.noreply.github.com> Date: Fri, 24 Feb 2023 03:54:02 -0800 Subject: [PATCH] fix(ios): fix nullability warnings (#36247) Summary: While testing `use_frameworks! :linkage => :static`, I encountered nullability warnings that were previously suppressed because we always build with `-Werror`. I'm not sure why the suppressions no longer work, but they should just be fixed. ## Changelog [IOS] [FIXED] - Fix nullability warnings Pull Request resolved: https://github.com/facebook/react-native/pull/36247 Test Plan: iOS build should succeed. Reviewed By: cipolleschi Differential Revision: D43531887 Pulled By: javache fbshipit-source-id: cae0617a20c8d215042cf4c5be2cbb17c801bb41 --- React/Base/RCTJSScriptLoaderModule.h | 6 +++++- React/CoreModules/RCTTiming.h | 12 ++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/React/Base/RCTJSScriptLoaderModule.h b/React/Base/RCTJSScriptLoaderModule.h index c05c29f7697..f05d361a579 100644 --- a/React/Base/RCTJSScriptLoaderModule.h +++ b/React/Base/RCTJSScriptLoaderModule.h @@ -7,12 +7,16 @@ @class RCTSource; +NS_ASSUME_NONNULL_BEGIN + /** * This protocol should be adopted when a turbo module needs to tell React Native to load a script. * In bridge-less React Native, it is a replacement for [_bridge loadAndExecuteSplitBundleURL:]. */ @protocol RCTJSScriptLoaderModule -@property (nonatomic, copy, nonnull) void (^loadScript)(RCTSource *source); +@property (nonatomic, copy) void (^loadScript)(RCTSource *source); @end + +NS_ASSUME_NONNULL_END diff --git a/React/CoreModules/RCTTiming.h b/React/CoreModules/RCTTiming.h index 1039f254cea..2a7519afb1b 100644 --- a/React/CoreModules/RCTTiming.h +++ b/React/CoreModules/RCTTiming.h @@ -12,21 +12,25 @@ #import #import +NS_ASSUME_NONNULL_BEGIN + @protocol RCTTimingDelegate - (void)callTimers:(NSArray *)timers; -- (void)immediatelyCallTimer:(nonnull NSNumber *)callbackID; -- (void)callIdleCallbacks:(nonnull NSNumber *)absoluteFrameStartMS; +- (void)immediatelyCallTimer:(NSNumber *)callbackID; +- (void)callIdleCallbacks:(NSNumber *)absoluteFrameStartMS; @end @interface RCTTiming : NSObject - (instancetype)initWithDelegate:(id)delegate; -- (void)createTimerForNextFrame:(nonnull NSNumber *)callbackID +- (void)createTimerForNextFrame:(NSNumber *)callbackID duration:(NSTimeInterval)jsDuration - jsSchedulingTime:(NSDate *)jsSchedulingTime + jsSchedulingTime:(nullable NSDate *)jsSchedulingTime repeats:(BOOL)repeats; - (void)deleteTimer:(double)timerID; @end + +NS_ASSUME_NONNULL_END