-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Add search input to mobile search page(with fixed performance) #56326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add search input to mobile search page(with fixed performance) #56326
Conversation
Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers! |
@sobitneupane 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] |
🚧 @luacmartins has triggered a test build. You can view the workflow run here. |
This comment has been minimized.
This comment has been minimized.
@IuliiaHerets could you please run the test steps from this issue using the builds here. Hopefully that issue is fixed in this build |
@ikevin127 All yours as you were reviewer in the previous reverted PR. Please let me know if you won't be available to review the PR. |
@sobitneupane Thanks, I'll start working on the checklist, making sure to test all issues encountered last time which led to the revert 👍 |
Reviewer Checklist
Screenshots/VideosAndroid: Nativeandroid.webmAndroid: mWeb Chromeandroid-mweb.webmiOS: Nativeios.mp4iOS: mWeb Safariios-mweb.mp4MacOS: Chrome / Safariweb.movMacOS: Desktopdesktop.mov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Went over the PR, it gets quite complicated with all the changes of components :/ but in general great work on this
src/styles/index.ts
Outdated
flex: 1, | ||
}, | ||
|
||
typePopoverButtonStyle: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know that we have a preference to use style props/consts but I think if it's just a class for 1 line of styles, then maybe it's better to just inline theme.sidebarHover
in the component that it's used?
@@ -76,6 +76,7 @@ function BaseTextInput( | |||
contentWidth, | |||
loadingSpinnerStyle, | |||
uncontrolled = false, | |||
placeholderTextColor, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another prop 😭 😭 😭
src/libs/CardUtils.ts
Outdated
@@ -98,7 +98,7 @@ function isCardHiddenFromSearch(card: Card) { | |||
return !card?.nameValuePairs?.isVirtual && CONST.EXPENSIFY_CARD.HIDDEN_FROM_SEARCH_STATES.includes(card.state ?? 0); | |||
} | |||
|
|||
function mergeCardListWithWorkspaceFeeds(workspaceFeeds: Record<string, WorkspaceCardsList | undefined>, cardList = allCards, shouldExcludeCardHiddenFromSearch = false) { | |||
function mergeCardListWithWorkspaceFeeds(workspaceFeeds: Record<string, WorkspaceCardsList | undefined> | undefined, cardList = allCards, shouldExcludeCardHiddenFromSearch = false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO it looks bad when the first argument can be undefined
but there are other arguments after it. It is technically "correct" from the perspective of JS/TS but bad function design.
Can we revert the change? did you do it just to avoid creating empty objects in other places in Search code?
}, | ||
}); | ||
} | ||
typeMenuItems.push({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typeMenuItems.push({ | |
typeMenuItems.push({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add ENTER
return; | ||
} | ||
textInputRef.current.blur(); | ||
// eslint-disable-next-line react-compiler/react-compiler | ||
// eslint-disable-next-line react-hooks/exhaustive-deps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// eslint-disable-next-line react-hooks/exhaustive-deps | |
// eslint-disable-next-line react-compiler/react-compiler react-hooks/exhaustive-deps |
1 line less ;)
@@ -63,12 +61,12 @@ function TopBar({breadcrumbLabel, activeWorkspaceID, shouldDisplaySearch = true, | |||
</View> | |||
</View> | |||
{displaySignIn && <SignInButton />} | |||
{shouldDisplayCancelSearch && ( | |||
{shouldDisplayCancel && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NAB - reminder for me to discuss 1 thing about using shouldDisplayCancel + callback
@luacmartins Tester cannot repro the issue using mentioned builds Screen_Recording_20250206_214923_New.Expensify.AdHoc.mp4 |
I've improved performance of the TextInput animation, tell me what do you think @shawnborton. |
🚧 @luacmartins has triggered a test build. You can view the workflow run here. |
I've kicked off an adhoc build |
Thanks @IuliiaHerets |
Any idea why the bookmark button bounces so weirdly when navigating? Seems like it only happens sometimes but it's enough to notice. (This video is from the iOS ad hoc build) ScreenRecording_02-18-2025.14-12-21_1.MP4 |
@SzymczakJ let's try to address the comments above. @ikevin127 could you review this PR once again once you're online please? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟢 Issues mentioned in #56326 (comment) were adddressed / fixed, this looks good and I think it's ready to merge with the mention that the 2 non-blocker issues from above could be addressed in a follow-up if not before this merges 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. We have two design issues, but let's address them in a follow up. Failing test is also unrelated to this PR.
@luacmartins looks like this was merged without a test passing. Please add a note explaining why this was done and remove the |
See comment above |
✋ 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/luacmartins in version: 9.1.1-0 🚀
|
🚀 Deployed to production by https://github.com/francoisl in version: 9.1.1-6 🚀
|
{showPopupButton && ( | ||
<Animated.View | ||
entering={FadeInRight} | ||
exiting={FadeOutRight} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should have only put the exit animation if isFocused
was true, this caused #57151
...baseMenuItem, | ||
onSelected: baseMenuItem.onPress, | ||
rightComponent: ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{BZ CHECKLIST} there was regression resulting in double navigation resulting from the presence of onPress and onSelect at the same time
import type {SaveSearchItem} from '@src/types/onyx/SaveSearch'; | ||
|
||
type SavedSearchMenuItem = MenuItemWithLink & { | ||
key: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SzymczakJ Hi, can I ask for the use of key
prop here? Currently I don't see any place that requires key
, and it caused #58261.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The key
prop here is accidentally spread into another component causing a dev warning #58261
Coming from issue #57493, a bug was found on mWeb Safari with existing popover modal logic but only reproducible with this feature |
<View style={[styles.appBG, styles.flex1]}> | ||
<View style={[styles.flexRow, styles.mh5, styles.mb3, styles.alignItemsCenter, styles.justifyContentCenter, {height: variables.searchTopBarHeight}]}> | ||
<Animated.View style={[styles.flex1, styles.zIndex10]}> | ||
<SearchInputSelectionWrapper |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explanation of Change
This PR is mainly about redesigning Search Page but I also made a pretty big refactor and improved performance of Search Page mobile header animation.
These are the design changes:
These are refactor changes:
SearchPageBottomTab.tsx
so that it has one render for narrow screen and one render for full screen, for better readability.SearchTypeMenuNarrow.tsx
and decuple it's logic fromSearchTypeMenu.tsx
, now this logic lives inSearchTypeMenuPopover.tsx
with the common parts ofSearchTypeMenuPopover
andSearchTypeMenu
put intoSearchUIUtils
.SearchSelectionModeHeader.tsx
as it added unnecessary layer that was confusing.Fixed Issues
$ #52317
$ #55828
PROPOSAL:
Tests
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
Same as tests
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
Screen.Recording.2025-02-18.at.16.17.38.mov
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop