Skip to content

[iOS] Remove a stale TODO in State.ts and the unused constants export - #4457

Merged
m-bert merged 2 commits into
mainfrom
@mbert/remove-state-todo
Aug 20, 2026
Merged

[iOS] Remove a stale TODO in State.ts and the unused constants export#4457
m-bert merged 2 commits into
mainfrom
@mbert/remove-state-todo

Conversation

@m-bert

@m-bert m-bert commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Description

Removes two leftovers that reference each other:

  • The TODO use State from RNModule comment in src/State.ts, added in the TS rewrite (Rewrite to TS #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/.

Copilot AI lite review requested due to automatic review settings August 20, 2026 07:30
@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 27c1d52d-4ba5-4f4e-98af-48a8ba50cc1b

📥 Commits

Reviewing files that changed from the base of the PR and between bac9b38 and 11ee4aa.

📒 Files selected for processing (2)
  • packages/react-native-gesture-handler/apple/RNGestureHandlerModule.mm
  • packages/react-native-gesture-handler/src/State.ts
💤 Files with no reviewable changes (2)
  • packages/react-native-gesture-handler/src/State.ts
  • packages/react-native-gesture-handler/apple/RNGestureHandlerModule.mm

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Summary by CodeRabbit

  • Refactor
    • Removed legacy gesture state and direction constants from the iOS module’s exported interface.
    • Preserved TurboModule functionality and the existing gesture state API.
    • Cleaned up obsolete internal documentation.

Walkthrough

The native gesture handler module removes legacy state and direction constant exports and their unused direction header import. TurboModule construction remains unchanged. The State export and type remain unchanged.

Changes

Gesture constant export removal

Layer / File(s) Summary
Remove legacy native constant exports
packages/react-native-gesture-handler/apple/RNGestureHandlerModule.mm
Removes the unused direction header import and the legacy constantsToExport method with its state and direction dictionaries.

Merge Risk: ⚪ Minimal · up to 11ee4

This is a localized cleanup with no intended runtime behavior change; no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes both primary changes: removing the stale TODO and the unused constants export on iOS.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes stale, unreachable constants-export plumbing and a leftover TODO that referenced it, keeping the JS State values as the single source of truth and trimming dead iOS native module code.

Changes:

  • Removed the stale TODO use State from RNModule comment from src/State.ts.
  • Removed the unused iOS constantsToExport implementation (State/Direction dictionaries) and its now-unused RNGestureHandlerDirection.h import.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/react-native-gesture-handler/src/State.ts Deletes a stale TODO comment above the JS State constant.
packages/react-native-gesture-handler/apple/RNGestureHandlerModule.mm Removes unused constantsToExport and the unused Direction header import.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@m-bert
m-bert requested a review from j-piasecki August 20, 2026 07:33
Comment on lines -285 to -300
return @{
@"State" : @{
@"UNDETERMINED" : @(RNGestureHandlerStateUndetermined),
@"BEGAN" : @(RNGestureHandlerStateBegan),
@"ACTIVE" : @(RNGestureHandlerStateActive),
@"CANCELLED" : @(RNGestureHandlerStateCancelled),
@"FAILED" : @(RNGestureHandlerStateFailed),
@"END" : @(RNGestureHandlerStateEnd)
},
@"Direction" : @{
@"RIGHT" : @(RNGestureHandlerDirectionRight),
@"LEFT" : @(RNGestureHandlerDirectionLeft),
@"UP" : @(RNGestureHandlerDirectionUp),
@"DOWN" : @(RNGestureHandlerDirectionDown)
}
};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Android module didn't export it?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It did, until you removed it 😄

@m-bert
m-bert merged commit 0a5b672 into main Aug 20, 2026
8 checks passed
@m-bert
m-bert deleted the @mbert/remove-state-todo branch August 20, 2026 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants