Skip to content

Commit 0a5b672

Browse files
authored
[iOS] Remove a stale TODO in State.ts and the unused constants export (#4457)
## Description Removes two leftovers that reference each other: - The `TODO use State from RNModule` comment in `src/State.ts`, added in the TS rewrite (#1327). The idea was to source the `State` object from the native module's exported constants instead of duplicating the values in JS. That's no longer viable: the TurboModule spec has no `getConstants`, web and Jest have no native module to ask, and `as const` literal types have to exist at compile time anyway. - The `constantsToExport` method in `RNGestureHandlerModule.mm` (the `State` and `Direction` dictionaries, exported since 2017) together with the now-unused `RNGestureHandlerDirection.h` import. Nothing on the JS side reads these - without `getConstants` in the spec they are unreachable on the new architecture. `requiresMainQueueSetup` stays, as module initialization inserts into the static `_managers` map that component views read on the main thread. No behavior change. ## Test plan - Built and ran `basic-example` on the iOS simulator; the app renders and a tap on the `VirtualGestureDetector` text logs `Tapped on first part!`. - Verified nothing references the exported constants: no `getConstants` in `NativeRNGestureHandlerModule.ts`, no `Module.State` / `Module.Direction` reads in `src/`.
1 parent bac9b38 commit 0a5b672

2 files changed

Lines changed: 0 additions & 25 deletions

File tree

packages/react-native-gesture-handler/apple/RNGestureHandlerModule.mm

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#import "RNGHRuntimeDecorator.h"
1818

1919
#import "RNGestureHandler.h"
20-
#import "RNGestureHandlerDirection.h"
2120
#import "RNGestureHandlerState.h"
2221

2322
#import "RNGestureHandlerButton.h"
@@ -278,28 +277,6 @@ - (void)addOperationBlock:(GestureHandlerOperation)operation
278277
return @[ @"onGestureHandlerEvent", @"onGestureHandlerStateChange" ];
279278
}
280279

281-
#pragma mark Module Constants
282-
283-
- (NSDictionary *)constantsToExport
284-
{
285-
return @{
286-
@"State" : @{
287-
@"UNDETERMINED" : @(RNGestureHandlerStateUndetermined),
288-
@"BEGAN" : @(RNGestureHandlerStateBegan),
289-
@"ACTIVE" : @(RNGestureHandlerStateActive),
290-
@"CANCELLED" : @(RNGestureHandlerStateCancelled),
291-
@"FAILED" : @(RNGestureHandlerStateFailed),
292-
@"END" : @(RNGestureHandlerStateEnd)
293-
},
294-
@"Direction" : @{
295-
@"RIGHT" : @(RNGestureHandlerDirectionRight),
296-
@"LEFT" : @(RNGestureHandlerDirectionLeft),
297-
@"UP" : @(RNGestureHandlerDirectionUp),
298-
@"DOWN" : @(RNGestureHandlerDirectionDown)
299-
}
300-
};
301-
}
302-
303280
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
304281
(const facebook::react::ObjCTurboModule::InitParams &)params
305282
{

packages/react-native-gesture-handler/src/State.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// TODO use State from RNModule
2-
31
export const State = {
42
UNDETERMINED: 0,
53
FAILED: 1,

0 commit comments

Comments
 (0)