Skip to content

feat: animate SVG props in CSS pseudo selectors on native#9717

Draft
MatiPl01 wants to merge 3 commits into
mainfrom
@MatiPl01/pseudo-selectors-svg-native
Draft

feat: animate SVG props in CSS pseudo selectors on native#9717
MatiPl01 wants to merge 3 commits into
mainfrom
@MatiPl01/pseudo-selectors-svg-native

Conversation

@MatiPl01

Copy link
Copy Markdown
Member

Makes CSS pseudo selectors (:active, :hover) animate react-native-svg props such as fill on iOS and Android, matching existing Web behavior. Previously these only fired for SVG shapes when the element opted in with onStartShouldSetResponder.

  • iOS: attaches the pseudo gesture recognizers to the nearest interactive ancestor and hit-tests the shape bounds, since RNSVG shapes are not user-interactive views.
  • Android: routes :active/:hover through the shape's compound host (SvgView) via reactTagForTouch, defers host resolution until the shape attaches, and enables per-shape hit testing through setResponsible.

Draft pending broader validation (hover on Android, lint/tests, and example-screen cleanup).

Pseudo selectors such as :active and :hover now drive react-native-svg
props (e.g. fill) on iOS and Android, without requiring the element to
opt in via onStartShouldSetResponder.
@MatiPl01 MatiPl01 self-assigned this Jun 20, 2026
MatiPl01 added 2 commits June 20, 2026 20:55
Route :active-deepest through the SvgView compound host (per-path reactTagForTouch), sharing one host touch listener across :active and :active-deepest. Track multiple :hover SVG shapes per host. Ref-count setResponsible and revert it on detach. Drop the onStartShouldSetResponder workaround from the SVG examples and add multi-shape, nested-group, and overlapping-circles cases. iOS: collapse the remaining recognizer signatures via the REAGestureRecognizer typedef and document the deferred SVG deepest-arbitration TODO.
Keep SVG fill + SVG radius (:active) and the overlapping-circles deepest test; drop the multiple-shapes and nested-group cards (redundant) and the Circle-over-Rect case (can't distinguish per-path from bounding-box). Remove now-unused Rect/G imports.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant