Fix composer hidden behind keyboard on cold start into a chat - #97352
Fix composer hidden behind keyboard on cold start into a chat#97352MelvinBot wants to merge 1 commit into
Conversation
…s on first report Co-authored-by: Chuck Dries <chuckdries@users.noreply.github.com>
|
I looked into the failing checks. There's nothing to fix in the code — the only failing check is PR Author Checklist / checklist, and it fails purely because the checklist boxes and the That's a human-only step — I intentionally don't check those boxes or fill in the Tests/QA sections on a person's behalf, so there's no commit I can push to clear it. It'll pass once you (as the human co-author) complete the checklist and testing steps before marking the PR ready for review. Every code-related check is green: So: no fix needed on my end — the checklist just needs to be completed manually. |
Explanation of Change
On a cold start (force-quit then reopen), the app can restore directly into a report via the
NavigationContainer'sinitialState, bypassing the LHN. React Navigation does not fireonStateChangefor the initial state, andupdateCurrentReportIDwas only ever called from theonStateChangehandler — socurrentReportIDstayed unset ('') for that first restored report.ReportScreengates its keyboard-avoiding view onisTopMostReportId = currentReportID === reportIDFromRoute. WithcurrentReportIDempty,isTopMostReportIdisfalse, soshouldEnableKeyboardAvoidingViewisfalseand the composer is not lifted above the keyboard — it ends up hidden behind it. Navigating back to the LHN and reopening the chat fires a real state change, which is why the workaround restored correct behavior.This change seeds
currentReportIDfrom the restored root state insideonReadyWithSentry(which runs once the container is ready), soisTopMostReportIdis correct on the very first report screen after a cold start. The existingupdateCurrentReportIDguards mean it safely no-ops when the cold start lands on a non-report screen (e.g. Inbox or Settings).Fixed Issues
$ #97295
PROPOSAL: #97295 (comment)
Tests
// TODO: The human co-author must fill out the tests you ran before marking this PR as "ready for review".
Suggested manual test:
Offline tests
Same as tests.
QA Steps
// TODO: The human co-author must fill out the QA tests before marking this PR as "ready for review".
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari