@@ -3,14 +3,14 @@ import {accountIDSelector} from '@selectors/Session';
33import { validTransactionDraftIDsSelector } from '@selectors/TransactionDraft' ;
44import React from 'react' ;
55// eslint-disable-next-line no-restricted-imports
6- import type { ImageStyle , TextStyle , ViewStyle } from 'react-native' ;
6+ import type { ImageStyle , NativeScrollEvent , NativeSyntheticEvent , StyleProp , TextStyle , ViewStyle } from 'react-native' ;
77import { Linking , View } from 'react-native' ;
88import type { OnyxCollection , OnyxEntry } from 'react-native-onyx' ;
9+ import Animated from 'react-native-reanimated' ;
910import BookTravelButton from '@components/BookTravelButton' ;
1011import GenericEmptyStateComponent from '@components/EmptyStateComponent/GenericEmptyStateComponent' ;
1112import type { EmptyStateButton , HeaderMedia } from '@components/EmptyStateComponent/types' ;
1213import { ModalActions } from '@components/Modal/Global/ModalContext' ;
13- import ScrollView from '@components/ScrollView' ;
1414import { SearchScopeProvider } from '@components/Search/SearchScopeProvider' ;
1515import type { SearchQueryJSON } from '@components/Search/types' ;
1616import Text from '@components/Text' ;
@@ -19,6 +19,7 @@ import useConfirmModal from '@hooks/useConfirmModal';
1919import useCreateEmptyReportConfirmation from '@hooks/useCreateEmptyReportConfirmation' ;
2020import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails' ;
2121import useHasEmptyReportsForPolicy from '@hooks/useHasEmptyReportsForPolicy' ;
22+ import useIsInLandscapeMode from '@hooks/useIsInLandscapeMode' ;
2223import { useMemoizedLazyIllustrations } from '@hooks/useLazyAsset' ;
2324import useLocalize from '@hooks/useLocalize' ;
2425import useOnyx from '@hooks/useOnyx' ;
@@ -48,6 +49,8 @@ type EmptySearchViewProps = {
4849 type : SearchDataTypes ;
4950 hasResults : boolean ;
5051 queryJSON ?: SearchQueryJSON ;
52+ onScroll ?: ( event : NativeSyntheticEvent < NativeScrollEvent > ) => void ;
53+ contentContainerStyle ?: StyleProp < ViewStyle > ;
5154} ;
5255
5356type EmptySearchViewContentProps = EmptySearchViewProps & {
@@ -70,7 +73,7 @@ type EmptySearchViewItem = {
7073 children ?: React . ReactNode ;
7174} ;
7275
73- function EmptySearchView ( { similarSearchHash, type, hasResults, queryJSON} : EmptySearchViewProps ) {
76+ function EmptySearchView ( { similarSearchHash, type, hasResults, queryJSON, onScroll , contentContainerStyle } : EmptySearchViewProps ) {
7477 const currentUserPersonalDetails = useCurrentUserPersonalDetails ( ) ;
7578 const { typeMenuSections} = useSearchTypeMenuSections ( ) ;
7679
@@ -98,6 +101,8 @@ function EmptySearchView({similarSearchHash, type, hasResults, queryJSON}: Empty
98101 groupPoliciesWithChatEnabled = { groupPoliciesWithChatEnabled }
99102 hasSeenTour = { hasSeenTour }
100103 queryJSON = { queryJSON }
104+ onScroll = { onScroll }
105+ contentContainerStyle = { contentContainerStyle }
101106 />
102107 </ SearchScopeProvider >
103108 ) ;
@@ -120,9 +125,12 @@ function EmptySearchViewContent({
120125 groupPoliciesWithChatEnabled,
121126 hasSeenTour,
122127 queryJSON,
128+ onScroll,
129+ contentContainerStyle,
123130} : EmptySearchViewContentProps ) {
124131 const { translate} = useLocalize ( ) ;
125132 const styles = useThemeStyles ( ) ;
133+ const isInLandscapeMode = useIsInLandscapeMode ( ) ;
126134
127135 const illustrations = useMemoizedLazyIllustrations ( [ 'EmptyStateTravel' ] ) ;
128136 const { showConfirmModal} = useConfirmModal ( ) ;
@@ -434,13 +442,16 @@ function EmptySearchViewContent({
434442 }
435443
436444 return (
437- < ScrollView
445+ < Animated . ScrollView
438446 showsVerticalScrollIndicator = { false }
439- contentContainerStyle = { [ styles . flexGrow1 , styles . flexShrink0 ] }
447+ contentContainerStyle = { [ styles . flexGrow1 , styles . flexShrink0 , contentContainerStyle ] }
448+ scrollEventThrottle = { CONST . TIMING . MIN_SMOOTH_SCROLL_EVENT_THROTTLE }
449+ onScroll = { onScroll }
440450 >
441451 < GenericEmptyStateComponent
442452 headerMedia = { content . headerMedia }
443453 headerStyles = { styles . emptyStateCardIllustrationContainer }
454+ minModalHeight = { isInLandscapeMode ? 0 : undefined }
444455 title = { content . title }
445456 titleStyles = { content . titleStyles }
446457 subtitle = { content . subtitle }
@@ -450,7 +461,7 @@ function EmptySearchViewContent({
450461 >
451462 { content . children }
452463 </ GenericEmptyStateComponent >
453- </ ScrollView >
464+ </ Animated . ScrollView >
454465 ) ;
455466}
456467
0 commit comments