Add useIsInSidePanel context hook to replace prop drilling#85355
Add useIsInSidePanel context hook to replace prop drilling#85355rlinoz merged 2 commits intoExpensify:mainfrom
Conversation
Introduce an IsInSidePanelContext and useIsInSidePanel hook that allows descendants to query whether they're rendered inside a side panel without prop drilling. SidePanelReport wraps its children with the provider. The existing isInSidePanel prop is kept for backward compatibility and will be removed in a follow-up PR that switches consumers to the hook. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
Introduce an IsInSidePanelContext and useIsInSidePanel hook so that any descendant can query whether it is rendered inside the side panel without prop drilling through ReportScreen → HeaderView / ReportFooter → ReportActionCompose. SidePanelReport wraps its children with the context provider. All four consumers (ReportScreen, HeaderView, ReportFooter, ReportActionCompose) now call useIsInSidePanel() directly instead of receiving the prop. The Report/index.ts action-layer isInSidePanel parameter is a separate concern and is not changed by this commit. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@DylanDylann Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
Very simple, love it |
|
@adhorodyski let's remove the NO QA though, I think steps could be
|
|
updated the test steps thanks |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2026-03-16.at.23.53.03.movAndroid: mWeb ChromeScreen.Recording.2026-03-16.at.23.52.03.moviOS: HybridAppScreen.Recording.2026-03-16.at.23.52.42.moviOS: mWeb SafariMacOS: Chrome / SafariScreen.Recording.2026-03-16.at.23.49.11.mov |
|
🚧 @rlinoz has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/rlinoz in version: 9.3.39-0 🚀
|
|
🚀 Deployed to production by https://github.com/cristipaval in version: 9.3.39-3 🚀
|
@rlinoz @mountiny @TMisiukiewicz
Explanation of Change
Introduces a
useIsInSidePanelReact context hook to replaceisInSidePanelprop drilling throughout the report screen hierarchy.A new
IsInSidePanelContextis created insrc/hooks/useIsInSidePanel.tsand its provider is added toSidePanelReportinsrc/components/SidePanel/SidePanelReport/index.tsx. Any component rendered inside the side panel can now calluseIsInSidePanel()directly instead of receivingisInSidePanelas a prop passed down through intermediate components.The existing
isInSidePanelprop is kept intact for backward compatibility. A follow-up PR will migrate consumers to use the hook and remove the prop.This is PR 1 of a series decomposing
ReportScreen. Part of #84971.Fixed Issues
$ #84895
PROPOSAL:
Tests
Offline tests
N/A
QA Steps
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, 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.ScrollViewcomponent to make it scrollable when more elements are added to the page.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