Skip to content

fix: use propagation view surfaceId for focused input events inside Modal - #1570

Merged
kirillzyusko merged 2 commits into
kirillzyusko:mainfrom
JoaoPauloCMarra:fix/android-modal-surface-id
Aug 5, 2026
Merged

fix: use propagation view surfaceId for focused input events inside Modal#1570
kirillzyusko merged 2 commits into
kirillzyusko:mainfrom
JoaoPauloCMarra:fix/android-modal-surface-id

Conversation

@JoaoPauloCMarra

@JoaoPauloCMarra JoaoPauloCMarra commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

📜 Description

Resolve Android focused-input event surface IDs from the React event propagation view instead of the watched modal window root.

💡 Motivation and Context

ModalAttachedWatcher observes the modal window root while dispatching focused-input events through a separate React view. Resolving the surface ID from the window root returns -1 under Fabric, producing a surface/target mismatch for layout, text, and selection events.

The non-modal path is unchanged because both constructor arguments reference the same React view.

Fixes #1569.

📢 Changelog

Android

  • Fixed focused-input event routing inside React Native modals under Fabric

🤔 How Has This Been Tested?

  • Android debug assembly with React Native 0.76.2
  • Android lint, detekt, and ktlint
  • TypeScript, ESLint, and Prettier checks

📝 Checklist

  • CI successfully passed
  • Library API is unchanged; Android regression coverage was added

@kirillzyusko kirillzyusko left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thank you for PR! Once you address comments we can merge it 🙌

@kirillzyusko kirillzyusko self-assigned this Aug 5, 2026
@kirillzyusko kirillzyusko added 🤖 android Android specific 🏭 fabric Changes specific to new (fabric/jsi) architecture focused input 📝 Anything about focused input functionality 🐛 bug Something isn't working 🌎 modal Anything that involves Modal usage labels Aug 5, 2026
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

📊 Package size report

Current size Target Size Difference
334276 bytes 334280 bytes -4 bytes 📉

- Keep the propagation surface ID implementation private\n- Remove the over-engineered observer unit test
@kirillzyusko kirillzyusko changed the title fix(android): use propagation view surface id fix: use propagation view surfaceId for focused input events inside Modal Aug 5, 2026
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor
  1. Incorrect Surface ID Calculation
    Why: The surfaceId is now calculated using eventPropagationView instead of view, which may cause events to be dispatched incorrectly if these views represent different surfaces.
    Fix: Verify that eventPropagationView is the correct source for surfaceId in this context.

  2. Potential NullPointerException
    Why: If eventPropagationView is null or doesn't have a valid surface ID, calling UIManagerHelper.getSurfaceId(eventPropagationView) could result in an exception.
    Fix: Ensure that eventPropagationView is always non-null and has a valid surface ID before using it.

@kirillzyusko
kirillzyusko merged commit 3677f93 into kirillzyusko:main Aug 5, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🤖 android Android specific 🐛 bug Something isn't working 🏭 fabric Changes specific to new (fabric/jsi) architecture focused input 📝 Anything about focused input functionality 🌎 modal Anything that involves Modal usage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android Fabric focused-input events use wrong modal surface ID

2 participants