Skip to content

Commit 3f4c553

Browse files
Deprecate Timing native module ahead of legacy-arch removal (#57081)
Summary: The legacy Timing native module (`RCTTiming` on iOS, `TimingModule` on Android) is scheduled for removal in a future React Native release as part of the legacy architecture cleanup. Changelog: [iOS][Deprecated] - Deprecate `RCTTiming Native Module usage`; will be removed in a future React Native release [Android][Deprecated] - Deprecate `TimingModule`; will be removed in a future React Native release Reviewed By: shwanton Differential Revision: D107540262
1 parent 87184c8 commit 3f4c553

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

packages/react-native/React/Base/RCTDisplayLink.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
- (instancetype)init;
2222
- (void)invalidate;
2323
- (void)registerModuleForFrameUpdates:(id<RCTBridgeModule>)module
24-
withModuleHolder:(id<RCTDisplayLinkModuleHolder>)moduleHolder;
24+
withModuleHolder:(id<RCTDisplayLinkModuleHolder>)moduleHolder
25+
__attribute__((deprecated(
26+
"registerModuleForFrameUpdates is part of the legacy architecture and will be removed in a future React Native release.")));
2527
- (void)addToRunLoop:(NSRunLoop *)runLoop;
2628

2729
@end

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/core/TimingModule.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ import com.facebook.react.devsupport.interfaces.DevSupportManager
1515
import com.facebook.react.module.annotations.ReactModule
1616

1717
/** Native module for JS timer execution. Timers fire on frame boundaries. */
18+
@Deprecated(
19+
"TimingModule is part of the legacy architecture and will be removed in a future React Native release."
20+
)
1821
@ReactModule(name = NativeTimingSpec.NAME)
1922
public class TimingModule(
2023
reactContext: ReactApplicationContext,

packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ void RCTInstanceSetRuntimeDiagnosticFlags(NSString *flags)
7474
sRuntimeDiagnosticFlags = [flags copy];
7575
}
7676

77-
@interface RCTBridgelessDisplayLinkModuleHolder : NSObject <RCTDisplayLinkModuleHolder>
77+
__attribute__((deprecated(
78+
"RCTBridgelessDisplayLinkModuleHolder is part of the legacy architecture and will be removed in a future React Native release.")))
79+
@interface RCTBridgelessDisplayLinkModuleHolder : NSObject<RCTDisplayLinkModuleHolder>
7880
- (instancetype)initWithModule:(id<RCTBridgeModule>)module;
7981
@end
8082

@@ -457,9 +459,12 @@ - (void)_start
457459

458460
[strongSelf->_delegate instance:strongSelf didInitializeRuntime:runtime];
459461

460-
// Set up Display Link
462+
// Set up Display Link
463+
#pragma clang diagnostic push
464+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
461465
id<RCTDisplayLinkModuleHolder> moduleHolder = [[RCTBridgelessDisplayLinkModuleHolder alloc] initWithModule:timing];
462466
[strongSelf->_displayLink registerModuleForFrameUpdates:timing withModuleHolder:moduleHolder];
467+
#pragma clang diagnostic pop
463468
[strongSelf->_displayLink addToRunLoop:[NSRunLoop currentRunLoop]];
464469

465470
// Attempt to load bundle synchronously, fallback to asynchronously.

0 commit comments

Comments
 (0)