Repository navigation
refactor: inline the Touchable press state machine - #3012
Merged
Merged
Conversation
jakex7
force-pushed
the
remove-touchable-usage
branch
from
August 14, 2026 15:13
a04b8c4 to
c830730
Compare
jakex7
approved these changes
Aug 18, 2026
jakex7
left a comment
Member
There was a problem hiding this comment.
Looks good to me, thank you! I'll re-introduce Android tap sound on press in a followup PR
2 tasks done
jakex7
added a commit
that referenced
this pull request
Aug 18, 2026
# Summary #3012 removed the tap sound, this PR restores previous behavior by adding `SvgSoundModule` on Android. ## Test Plan Run TouchEvents test on Android. ## Compatibility | OS | Implemented | | ------- | :---------: | | Android | ✅ | ## Checklist - [x] I have tested this on a device and a simulator - [x] I updated the typed files (typescript)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Shapehandles presses by mixing inTouchable.Mixin, a private and deprecated API ofreact-native. react-native cannot deleteTouchablewhile this library uses it.From
packages/react-native/index.jsatv0.87.0:How it is implemented
src/lib/SvgTouchableMixin.tsnow holds its own copy of the press state machine, ported fromTouchable.Mixin. Same states, same signals, same transition table, same method names, so the callers are unchanged. It only depends on the gesture responder system, which is public API.Two differences with the original implementation:
SoundManagerhas no public export.measure()on the granted responder node, falling back to the instancerootref, instead ofUIManager.measure.The mixin is also fully typed now, so the
// @ts-expect-error: Mixin is not typedis gone.Areas impacted
Press props on every shape element:
onPress,onPressIn,onPressOut,onLongPress,delayPressIn,delayPressOut,delayLongPress,pressRetentionOffset,hitSlop,disabled, and the user suppliedonResponder*overrides.Plus the config needed to type check the new test file:
tsconfig.jsonincludes__tests__ande2e, and liststypesexplicitlytsconfig.build.json, narrowed back tosrc, used by thebobtypescript target so test globals never reach the published types@types/jest, new@types/react-test-renderer,react-native-builder-bobTest Plan
What's required for testing (prerequisites)?
yarn installat the repo root, thenyarn installin the example app.What are the steps to reproduce (after prerequisites)?
__tests__/touchable.test.tsxis new. Its 19 cases cover handler attachment, press order,delayPressIn/delayPressOut/delayLongPress, the 500ms long press threshold, long press cancellingonPress, the 10px movement cancel, leaving and re-entering the press rect, the default retention offset,hitSlop,disabled, user supplied responder handlers, termination, and timer cleanup on unmount.Then check the
TouchEventsexample screen, which coversonPressonCircle,onLongPressonRect,onPressIn/onPressOutwithdelayPressIn={0}, andonPressonGandText:Compatibility
The change is JavaScript only and shared by every platform. No native code is touched.
Checklist
README.md__tests__folderDemos
demo.ios.mov
demo.android.mov