Add TouchableSpan interface for position-aware touch on text spans#56709
Open
andrewdacenko wants to merge 2 commits intofacebook:mainfrom
Open
Add TouchableSpan interface for position-aware touch on text spans#56709andrewdacenko wants to merge 2 commits intofacebook:mainfrom
andrewdacenko wants to merge 2 commits intofacebook:mainfrom
Conversation
…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
|
@andrewdacenko has exported this pull request. If you are a Meta employee, you can view the originating Diff in D97417356. |
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:
Changelog: [Internal]
Introduces
TouchableSpan, an interface for spans that receive fullMotionEventtouch events fromPreparedLayoutTextView. UnlikeClickableSpanwhich only provides anonClickcallback with noposition information,
TouchableSpanreceives the fullMotionEvent,enabling position-aware interactions such as dismiss animations
originating from the tap point.
Reviewed By: Abbondanzo
Differential Revision: D97417356