Repository navigation
fix(explore): stop the search keyboard flashing dark and smooth the search transition - #34575
Conversation
The Explore search screen is a native-stack push and its input used autoFocus, so the keyboard was raised while the push was still animating. On iOS the keyboard paints its translucent background from whatever sits behind it, so it rendered dark grey for ~0.5s before settling. Mounting the results subtree (perps stream + five search feeds) during the same frame also blocked the JS thread and made the transition look glitchy. Add useScreenTransitionComplete, which resolves on the native-stack transitionEnd event with a timer fallback, and gate both the keyboard and the results subtree on it. Also set keyboardAppearance from the theme, so the keyboard stops rendering light in dark mode.
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
PR template — items to address before "Ready for review"Warnings — informational, address before merging:
See docs/readme/ready-for-review.md for the full Definition of Ready for Review. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c6c2913. Configure here.
The fallback timer fired unconditionally, so dismissing search before its opening transitionEnd arrived (that event is ignored while closing) still unblocked the screen mid-pop — mounting the perps stream and the results subtree against the exit animation, only to tear them down. Gate the fallback on navigation.isFocused() and re-arm it on focus, so a screen that regains focus is not left permanently blocked.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: Performance Test Selection: |
|




Description
Opening Explore search raised the keyboard while the screen was still animating in. On iOS the keyboard paints its translucent background from whatever sits behind it, so it rendered dark grey for roughly half a second and then snapped to its normal colour. The same mount also spun up the entire results subtree during the animation, which is what made the transition feel glitchy.
Both now wait for the push to finish.
What
useScreenTransitionCompletehook — resolves on the native-stacktransitionEndevent, with a 450 ms timer fallback so it always resolves (initial route, animation disabled, tests). Follows the existingtransitionEndpattern inCardWelcomeandusePredictBuyActions.ExploreSearchScreengates two things on it — the keyboard, and thePerpsSectionProvider+ results subtree whose mount blocks the JS thread mid-slide.ExploreSearchBartakes anautoFocusprop (defaults totrue, so Watchlist is unchanged). RN'sautoFocusonly applies on mount, so flipping it on later triggers an imperative focus.keyboardAppearancenow follows the theme — it was never passed, so the keyboard stayed light in dark mode regardless of app theme.Why
The screen is a plain native-stack push (
animation: 'ios_from_right', MainNavigator.js#L1425-L1429) and the input was hardcoded toautoFocus. Nothing coordinated the keyboard with the animation.transitionEndtransitionEndkeyboardAppearancenever setTrade-off: the keyboard now appears ~350 ms later, once the push completes. That is the fix, and it matches native iOS behaviour, but it is a deliberate responsiveness trade-off worth a reviewer's eye.
Changelog
CHANGELOG entry: Fixed the Explore search keyboard flashing dark grey and the search screen transition stuttering when opening search from Home or Explore
Related issues
Fixes: TMCU-1261
Manual testing steps
Screenshots/Recordings
after_keyboard.mov
Before
Keyboard is dark grey on first load (~0.5s), then settles
before_keyboard.mov
After
after_keyboard.mov
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Test coverage
useScreenTransitionComplete.test.ts(new)closingevent ignored, timer fallback, listener + timer cleanupExploreSearchBar.test.tsxautoFocusoff,autoFocusflipped on after mount, themedkeyboardAppearance)ExploreSearchScreen.view.test.tsxlint,prettier, andlint:tscare clean for the changed files. Thelint:tscerrors that remain in the repo are pre-existing, in Perps and Engine.Known follow-up: Watchlist search has the same bug
WatchlistFullScreenViewuses the sameExploreSearchBarbehind the sameslideFromRightNativeOptionspush, so its keyboard flashes the same way. It is untouched here (defaultautoFocus: truepreserves today's behaviour) because it is outside TMCU-1261's scope. Applying the fix there is a two-line change: passautoFocus={useScreenTransitionComplete()}.Note
Low Risk
Localized UX/performance timing on Explore search with a tested navigation hook; keyboard appears slightly later by design.
Overview
Fixes Explore search opening during the native-stack push by coordinating keyboard focus and heavy UI with the enter animation.
Adds
useScreenTransitionComplete, which flips totrueon non-closingtransitionEndor after a 450ms focused-screen fallback (re-armed onfocus).ExploreSearchScreenuses it to passautoFocus={isTransitionComplete}and to defer mountingPerpsSectionProvider/ search results until the slide finishes.ExploreSearchBargains an optionalautoFocusprop (defaulttrue) with imperativefocus()when it turns on after mount, pluskeyboardAppearancederived from the design-system theme. Tests cover the hook, bar behavior, and the gated screen mount.Reviewed by Cursor Bugbot for commit 1218560. Bugbot is set up for automated code reviews on this repo. Configure here.