Skip to content

Add TouchableSpan interface for position-aware touch on text spans#56709

Open
andrewdacenko wants to merge 2 commits intofacebook:mainfrom
andrewdacenko:export-D97417356
Open

Add TouchableSpan interface for position-aware touch on text spans#56709
andrewdacenko wants to merge 2 commits intofacebook:mainfrom
andrewdacenko:export-D97417356

Conversation

@andrewdacenko
Copy link
Copy Markdown
Contributor

Summary:
Changelog: [Internal]

Introduces TouchableSpan, an interface for spans that receive full
MotionEvent touch events from PreparedLayoutTextView. Unlike
ClickableSpan which only provides an onClick callback with no
position information, TouchableSpan receives the full MotionEvent,
enabling position-aware interactions such as dismiss animations
originating from the tap point.

Reviewed By: Abbondanzo

Differential Revision: D97417356

NickGerleman and others added 2 commits May 6, 2026 05:42
…nd ReactSpan

Summary:
Renames `DrawCommandSpan` to `CanvasEffectSpan` for consistency with the new
`AnimatedEffectSpan`, and removes the `UpdateAppearance` and `ReactSpan`
interfaces.

`UpdateAppearance` is a marker interface that tells Android's text layout system
the span affects text appearance (triggering re-measurement). Since
`CanvasEffectSpan` only draws on top of text during `PreparedLayoutTextView`'s
draw pass and never modifies paint state or text measurement, implementing
`UpdateAppearance` was incorrect — the same reasoning applied when designing
`AnimatedEffectSpan` without it.

`ReactSpan` is removed because not all spans implementing `CanvasEffectSpan`
will be provided by React — app-side code can create custom canvas effects via
the TextEffect registry, so the React-internal marker is not appropriate here.

Differential Revision: D97399655
Summary:
Changelog: [Internal]

Introduces `TouchableSpan`, an interface for spans that receive full
`MotionEvent` touch events from `PreparedLayoutTextView`. Unlike
`ClickableSpan` which only provides an `onClick` callback with no
position information, `TouchableSpan` receives the full `MotionEvent`,
enabling position-aware interactions such as dismiss animations
originating from the tap point.

Reviewed By: Abbondanzo

Differential Revision: D97417356
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 6, 2026
@facebook-github-tools facebook-github-tools Bot added p: Facebook Partner: Facebook Partner labels May 6, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented May 6, 2026

@andrewdacenko has exported this pull request. If you are a Meta employee, you can view the originating Diff in D97417356.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants