-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45076 from margelo/perunt/suggestion-box-scroll-hide
Hide suggestion box
- Loading branch information
Showing
10 changed files
with
107 additions
and
24 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
...mpleteSuggestions/AutoCompleteSuggestionsPortal/TransparentOverlay/TransparentOverlay.tsx
This file contains 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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React, {useCallback} from 'react'; | ||
import {View} from 'react-native'; | ||
import type {PointerEvent} from 'react-native'; | ||
import type PressableProps from '@components/Pressable/GenericPressable/types'; | ||
import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeedback'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import CONST from '@src/CONST'; | ||
|
||
type TransparentOverlayProps = { | ||
resetSuggestions: () => void; | ||
}; | ||
|
||
type OnPressHandler = PressableProps['onPress']; | ||
|
||
function TransparentOverlay({resetSuggestions}: TransparentOverlayProps) { | ||
const {translate} = useLocalize(); | ||
const styles = useThemeStyles(); | ||
|
||
const onResetSuggestions = useCallback<NonNullable<OnPressHandler>>( | ||
(event) => { | ||
event?.preventDefault(); | ||
resetSuggestions(); | ||
}, | ||
[resetSuggestions], | ||
); | ||
|
||
const handlePointerDown = useCallback((e: PointerEvent) => { | ||
e?.preventDefault(); | ||
}, []); | ||
|
||
return ( | ||
<View | ||
onPointerDown={handlePointerDown} | ||
style={styles.fullScreen} | ||
> | ||
<PressableWithoutFeedback | ||
onPress={onResetSuggestions} | ||
style={[styles.flex1, styles.cursorDefault]} | ||
accessibilityLabel={translate('common.close')} | ||
role={CONST.ROLE.BUTTON} | ||
/> | ||
</View> | ||
); | ||
} | ||
|
||
export default TransparentOverlay; |
This file contains 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 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 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 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 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 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 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 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 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