Skip to content

fix: replace dispatchCommand with runOnJS for browser search input focus#7337

Merged
janicduplessis merged 2 commits intodevelopfrom
@janic/fix-search-dispatch-command
Apr 14, 2026
Merged

fix: replace dispatchCommand with runOnJS for browser search input focus#7337
janicduplessis merged 2 commits intodevelopfrom
@janic/fix-search-dispatch-command

Conversation

@janicduplessis
Copy link
Copy Markdown
Contributor

@janicduplessis janicduplessis commented Apr 10, 2026

Fixes APP-3622

What changed (plus any additional context for devs)

Extracted from the new arch migration PR #6924.

The browser search bar uses Reanimated's dispatchCommand(inputRef, 'focus') to focus the text input from a worklet. dispatchCommand relies on the legacy Paper command dispatch mechanism which is not available on new arch (Fabric).

Replaces with a runOnJS callback that calls inputRef.current?.focus() on the JS thread — the standard pattern for triggering imperative methods from worklets.

What to test

  • Browser search: tapping the address bar focuses the input and opens the search view

…search

Replace `dispatchCommand(inputRef, 'focus')` with `runOnJS` callback
to focus the input from a worklet. `dispatchCommand` is not compatible
with the new architecture for this use case.

Also use `TAB_BAR_HEIGHT` consistently for both platforms instead of
hardcoding 46 for Android.
@linear
Copy link
Copy Markdown

linear Bot commented Apr 10, 2026

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 10, 2026

🧪 Flashlight Performance Report (AWS Device Farm)

🔀 Commit: 88505da

📎 View Artifacts

Metric Current Δ vs Baseline
Time to Interactive (TTI) 2122 ms
Average FPS 59.70
Average RAM 469.3 MB

@janicduplessis janicduplessis requested a review from olerass April 10, 2026 20:06
@janicduplessis
Copy link
Copy Markdown
Contributor Author

Validated on iOS and Android emulator

@github-actions
Copy link
Copy Markdown

Launch in simulator or device for 4d62729

@olerass
Copy link
Copy Markdown
Contributor

olerass commented Apr 13, 2026

Can we split this PR out? It's changing two fundamentall independent things with no functional relation except they happen to be in the same file. Also the dispatch fix is required and thus related to the new arch migration, the tab bar height is just regular bug with no releation (right)?

The dispatchCommand fix looks clean and ready to ship.

The tab bar height fix is a visual change that could use before/after screenshots to explain what's going on. I captured these to understand it (feel free to use, but it's only showing gesture nav, we should also check 3 button nav case):

image

Revert the TAB_BAR_HEIGHT change — it's an independent visual fix
unrelated to the dispatchCommand migration and should be reviewed
separately.
@janicduplessis
Copy link
Copy Markdown
Contributor Author

Split the tab bar height fix into a separate PR: #7345. This PR now only contains the dispatchCommandrunOnJS migration.

@github-actions
Copy link
Copy Markdown

Launch in simulator or device for 88505da

@janicduplessis janicduplessis merged commit 656cbb8 into develop Apr 14, 2026
25 of 26 checks passed
@janicduplessis janicduplessis deleted the @janic/fix-search-dispatch-command branch April 14, 2026 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants