Add SearchRouter component and context to display it#48785
Add SearchRouter component and context to display it#48785luacmartins merged 7 commits intoExpensify:mainfrom
Conversation
|
@luacmartins here is a draft that I created when describing the doc, take a quick look. |
|
Nice! You guys make it look too easy 😄 |
53ec64f to
f8803d3
Compare
0966fad to
aa224c6
Compare
| height: variables.componentSizeNormal, | ||
| }, | ||
|
|
||
| searchContainer: { |
There was a problem hiding this comment.
I searched in all project files using IDE (webstorm) search and found no usages of this. I believe these are leftovers after some temporary old search feature which was removed.
aa224c6 to
2a2796b
Compare
289Adam289
left a comment
There was a problem hiding this comment.
Code looks good. Requested two small changes
|
@289Adam289 I've fixed both suggestions, take a look |
8ed1946 to
08fd7e4
Compare
08fd7e4 to
2772431
Compare
|
There's no overlay planned (yet) - but we did have some slight box shadow happening around it from our mockups. |
|
@ikevin127 please prioritize reviewing this issue since it unblocks others. |
Reviewer Checklist
Screenshots/VideosAndroid: Nativeandroid.webmAndroid: mWeb Chromeandroid-mweb.webmiOS: Nativeios.mp4iOS: mWeb Safariios-mweb.mp4MacOS: Chrome / Safariweb.movMacOS: Desktopdesktop.mov |
ikevin127
left a comment
There was a problem hiding this comment.
LGTM 🚀
Observation: The Cancel button only shows-up on narrow layout devices, probably that's intended but I thought I should mention it anyway in case it's not.
|
|
||
| return ( | ||
| <PressableWithoutFeedback | ||
| accessibilityLabel="" |
There was a problem hiding this comment.
NAB we'll need to update this
|
@luacmartins looks like this was merged without a test passing. Please add a note explaining why this was done and remove the |
|
ESlint was failing on AuthScreens, it's unrelated to this PR. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
The failing Eslint was a new check, details: #48785 (comment) |
|
🚀 Deployed to staging by https://github.com/luacmartins in version: 9.0.38-0 🚀
|
|
🚀 Deployed to production by https://github.com/grgia in version: 9.0.38-4 🚀
|
| value={value} | ||
| onChangeText={onChangeText} | ||
| onSubmitEditing={onSubmit} | ||
| autoFocus |
There was a problem hiding this comment.
Coming from this Issue #51010, We are adding autoFocus here, but it doesn’t always work consistently on Android. To handle this, we’ve an existing prop (shouldDelayFocus) for TextInput that enables autoFocus with a delay specifically for Android #51010 (comment)
| } | ||
|
|
||
| return ( | ||
| <PressableWithoutFeedback |
There was a problem hiding this comment.
FYI this PR missed adding a tooltip for the search button and caused this issue: #50977
| value={value} | ||
| onChangeText={onChangeText} | ||
| onSubmitEditing={onSubmit} | ||
| autoFocus |
There was a problem hiding this comment.
On mWeb Safari, the autoFocus does not work well while animation is still ongoing, the caret lags behind (#52382). Usually we use useAutoFocusInput hook instead. However since this input is not rendered in RHP (or LHP) but it's inside a modal (and the timing in modal vs RHP are diff) we had to go for another solution which is to just hide the caret while modal is still animating.
| <PressableWithoutFeedback | ||
| accessibilityLabel="" | ||
| style={[styles.flexRow, styles.mr2, styles.touchableButtonImage]} | ||
| onPress={() => { |
There was a problem hiding this comment.
Not blurring the search button causes quite a unique edge case in mweb android platform that resulted in blue frame on the search button as mentioned in #52128
| const modalWidth = isFullWidth ? styles.w100 : {width: variables.popoverWidth}; | ||
|
|
||
| return ( | ||
| <BaseTextInput |
There was a problem hiding this comment.
Coming from #54151, we add maxLength to the input here to prevent freezing when searching with a long text



Details
SearchRouterand unblocks all other work around SearchRouter and 2.4Done
SearchRouterwhich uses a modal, and allows to submit search viaENTERkey (the clickable list will come in a different PR) - it's responsible for managing the parsing of query and performing the actual search (viaNavigation.navigate())SearchRouterInputwhich is responsible for displaying the input to the user (in future we plan to add autocomplete there)SearchContextthat controls whether the router should be shown or hiddenSearchButtonto display the new router but ONLY in development (not staging or prod) - I understand that the TopBar looks weird with old and new search, but that is the easiest way to add it both for large and small screens; we don't want to display the new router to the users until it's fully doneFixed Issues
$ #49118
$ #49119
PROPOSAL:
Tests
Offline tests
QA Steps
Nothing to test for QA at this point, we'll do tests once the feature is more complete
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))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
rec-search-android.mp4
Android: mWeb Chrome
iOS: Native
rec-search-ios.mp4
iOS: mWeb Safari
rec-search-ios-web.mp4
MacOS: Chrome / Safari
rec-search-web.mp4
MacOS: Desktop