-
Notifications
You must be signed in to change notification settings - Fork 4k
Enable keyboard avoiding view in search modal #57458
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
Merged
Gonals
merged 5 commits into
Expensify:main
from
bernhardoj:fix/56342-can't-scroll-search-results-when-keyboard-opened
Mar 3, 2025
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
276731b
enable keyboard avoiding view in search modal
bernhardoj fa57cf3
Merge branch 'main' into fix/56342-can't-scroll-search-results-when-k…
bernhardoj 8b04d0b
Merge branch 'main' into fix/56342-can't-scroll-search-results-when-k…
bernhardoj 52096f5
keyboard avoiding view in mweb safari
bernhardoj abf96de
prevent viewport scrolling
bernhardoj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,12 @@ | ||
| import React, {useState} from 'react'; | ||
| import FocusTrapForModal from '@components/FocusTrap/FocusTrapForModal'; | ||
| import KeyboardAvoidingView from '@components/KeyboardAvoidingView'; | ||
| import Modal from '@components/Modal'; | ||
| import useResponsiveLayout from '@hooks/useResponsiveLayout'; | ||
| import useSafeAreaInsets from '@hooks/useSafeAreaInsets'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
| import useViewportOffsetTop from '@hooks/useViewportOffsetTop'; | ||
| import useWindowDimensions from '@hooks/useWindowDimensions'; | ||
| import {isMobileChrome, isMobileSafari} from '@libs/Browser'; | ||
| import CONST from '@src/CONST'; | ||
| import SearchRouter from './SearchRouter'; | ||
|
|
@@ -12,7 +15,9 @@ import {useSearchRouterContext} from './SearchRouterContext'; | |
| const isMobileWebSafari = isMobileSafari(); | ||
|
|
||
| function SearchRouterModal() { | ||
| const styles = useThemeStyles(); | ||
| const {shouldUseNarrowLayout} = useResponsiveLayout(); | ||
| const {windowHeight} = useWindowDimensions(); | ||
| const {isSearchRouterDisplayed, closeSearchRouter} = useSearchRouterContext(); | ||
| const viewportOffsetTop = useViewportOffsetTop(); | ||
| const safeAreaInsets = useSafeAreaInsets(); | ||
|
|
@@ -35,14 +40,19 @@ function SearchRouterModal() { | |
| onModalHide={() => setShouldHideInputCaret(isMobileWebSafari)} | ||
| onModalShow={() => setShouldHideInputCaret(false)} | ||
| > | ||
| {isSearchRouterDisplayed && ( | ||
| <FocusTrapForModal active={isSearchRouterDisplayed}> | ||
| <SearchRouter | ||
| onRouterClose={closeSearchRouter} | ||
| shouldHideInputCaret={shouldHideInputCaret} | ||
| /> | ||
| </FocusTrapForModal> | ||
| )} | ||
| <KeyboardAvoidingView | ||
| behavior="padding" | ||
| style={[styles.flex1, {maxHeight: windowHeight}]} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we only add |
||
| > | ||
| {isSearchRouterDisplayed && ( | ||
| <FocusTrapForModal active={isSearchRouterDisplayed}> | ||
| <SearchRouter | ||
| onRouterClose={closeSearchRouter} | ||
| shouldHideInputCaret={shouldHideInputCaret} | ||
| /> | ||
| </FocusTrapForModal> | ||
| )} | ||
| </KeyboardAvoidingView> | ||
| </Modal> | ||
| ); | ||
| } | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should we apply
overscrollBehaviorContainonly for mobile WebKit? I found a use case here.App/src/components/ScreenWrapper.tsx
Line 284 in cd92ca9
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 retested other platforms with different use cases, with few contacts (7-9) or long contact list. I didn't find any inconsistencies, so these comments won't be a blocker. They're just for discussing
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 didn't find any issues on other platforms too, so I think we can just leave it, same as
maxHeightabove.They probably add it for iOS mWeb only since it's the only platform where the viewport scroll issue happens, but since it doesn't cause any inconsistency on other platforms, I think it's fine to apply it to all. It's actually more consistent if we apply the overscroll style to all platforms instead of only 1 platform.