Skip to content

fix: mobile keyboard popping up when app returns from background#14289

Merged
dylanjeffers merged 3 commits into
mainfrom
claude/thirsty-blackburn-4484cd
May 12, 2026
Merged

fix: mobile keyboard popping up when app returns from background#14289
dylanjeffers merged 3 commits into
mainfrom
claude/thirsty-blackburn-4484cd

Conversation

@dylanjeffers
Copy link
Copy Markdown
Contributor

Summary

The mobile keyboard was popping up unexpectedly when the app first loads (specifically: when returning from background while the explore tab was the active tab).

Root cause

SearchExploreHeader.tsx was using useFocusEffect to call .focus() on the search input whenever the screen gained focus AND params.autoFocus === true. With freezeOnBlur: true on the tab stacks, the explore screen stays mounted across tab switches. When the user tapped the search icon, navigated to explore (params.autoFocus: true), and then backgrounded the app without dismissing the keyboard, params.autoFocus remained true. On app resume, React Navigation fires a fresh focus event → useFocusEffect re-runs → keyboard pops up.

Fix

  • Replace useFocusEffect with a plain useEffect keyed on params?.autoFocus — fires only when the param transitions, not on every screen focus.
  • Consume the param by immediately calling setParams({ autoFocus: false }) after focusing, so the same useEffect can re-trigger on a subsequent search-icon tap.
  • Drop the redundant autoFocus prop on the TextInput (the effect handles initial mount too) and the keyboardDidHide listener (no longer needed now that focus stops firing on screen refocus).

Test plan

  • Cold-start the app → no keyboard on initial load (regardless of which tab was last active)
  • Tap search icon from any tab header → explore opens with keyboard up and input focused
  • On explore, dismiss keyboard, switch to another tab, return to explore → keyboard does NOT reappear
  • On explore with keyboard up, background the app, return from background → keyboard does NOT reappear
  • Tap search icon → keyboard reappears, dismiss it, tap search icon again → keyboard reappears (param re-trigger works)

🤖 Generated with Claude Code

dylanjeffers and others added 3 commits May 8, 2026 14:42
Instruments three key contest interactions following the existing
'Remix Contest:' event prefix and {remixContestId, trackId} property
shape used by the host/pick-winners events:

  - REMIX_CONTEST_VIEW: contest page/screen first resolves trackId+eventId
  - REMIX_CONTEST_ENTER: user taps Enter Contest / Upload Remix
  - REMIX_CONTEST_VIEW_SUBMISSIONS: user opens the submissions tab

Mobile submissions-tab firing uses useFocusedTab from
react-native-collapsible-tab-view because the contest tabs mount
eagerly (lazy: false) — a plain mount effect would fire even for
users who only view the Details tab.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…round

The search input was being re-focused on every navigation focus event via
`useFocusEffect` — including when the app returned from background while
explore was the active tab. If the user had tapped the search icon before
backgrounding (without dismissing the keyboard first), `params.autoFocus`
remained true and the keyboard popped up again on resume.

Replace `useFocusEffect` with `useEffect` so the focus only fires when the
param transitions to true (initial mount or a subsequent search-icon tap),
not on every screen focus. Consume the param by immediately setting it back
to false so the next tap can re-trigger. Drops the redundant `autoFocus`
prop on the TextInput (the effect handles initial mount too) and the
`keyboardDidHide` listener (no longer needed once focus stops firing on
every screen refocus).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 11, 2026

⚠️ No Changeset found

Latest commit: 2aeefe2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@dylanjeffers dylanjeffers merged commit 146dbd6 into main May 12, 2026
12 of 14 checks passed
@dylanjeffers dylanjeffers deleted the claude/thirsty-blackburn-4484cd branch May 12, 2026 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant