Skip to content

Commit b0a6386

Browse files
christophpurrermeta-codesync[bot]
authored andcommitted
Deprecate Timing native module ahead of legacy-arch removal (#57081)
Summary: Pull Request resolved: #57081 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 fbshipit-source-id: 99937ebfd591a59c6ee571b3269f7263c5235913
1 parent 2da0244 commit b0a6386

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

@@ -460,9 +462,12 @@ - (void)_start
460462

461463
[strongSelf->_delegate instance:strongSelf didInitializeRuntime:runtime];
462464

463-
// Set up Display Link
465+
// Set up Display Link
466+
#pragma clang diagnostic push
467+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
464468
id<RCTDisplayLinkModuleHolder> moduleHolder = [[RCTBridgelessDisplayLinkModuleHolder alloc] initWithModule:timing];
465469
[strongSelf->_displayLink registerModuleForFrameUpdates:timing withModuleHolder:moduleHolder];
470+
#pragma clang diagnostic pop
466471
[strongSelf->_displayLink addToRunLoop:[NSRunLoop currentRunLoop]];
467472

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

0 commit comments

Comments
 (0)