fix(mobile): stop cold-launch keyboard flash on explore search#14395
Merged
Conversation
…launch keyboard flash #14289 stopped the background→foreground flash but the cold-launch flash remained: when the explore screen mounted off-screen with a stale `autoFocus: true` route param, the useEffect would call `.focus()` on the search input even though the explore tab wasn't the active tab, briefly summoning the keyboard. Gate the focus call on `useIsFocused()` so the param is only consumed when the user is actually looking at the explore tab. The intentional search-icon flow still works because navigating to explore makes the tab focused before the effect runs. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
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
useEffectcalls.focus()wheneverparams?.autoFocus === true, regardless of whether the explore tab is the active tab. If the explore screen mounts off-screen with a staleautoFocus: trueon its route, the focus call fires anyway and briefly summons the keyboard.useIsFocused()so the param is only consumed while the explore tab is actually the active tab. The intentional search-icon-tap flow still works — navigating to explore puts the tab in focus before the effect runs.Test plan
🤖 Generated with Claude Code