@@ -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' ;
@@ -25,6 +25,7 @@ import useOnyx from '@hooks/useOnyx';
2525import usePermissions from '@hooks/usePermissions' ;
2626import useSearchTypeMenuSections from '@hooks/useSearchTypeMenuSections' ;
2727import useThemeStyles from '@hooks/useThemeStyles' ;
28+ import useWindowDimensions from '@hooks/useWindowDimensions' ;
2829import { startMoneyRequest } from '@libs/actions/IOU' ;
2930import { openOldDotLink } from '@libs/actions/Link' ;
3031import { createNewReport } from '@libs/actions/Report' ;
@@ -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 { windowHeight} = useWindowDimensions ( ) ;
126134
127135 const illustrations = useMemoizedLazyIllustrations ( [ 'EmptyStateTravel' ] ) ;
128136 const { showConfirmModal} = useConfirmModal ( ) ;
@@ -433,9 +441,11 @@ function EmptySearchViewContent({
433441 }
434442
435443 return (
436- < ScrollView
444+ < Animated . ScrollView
437445 showsVerticalScrollIndicator = { false }
438- contentContainerStyle = { [ styles . flexGrow1 , styles . flexShrink0 ] }
446+ contentContainerStyle = { [ styles . flexGrow1 , styles . flexShrink0 , contentContainerStyle , { minHeight : windowHeight } ] }
447+ scrollEventThrottle = { 16 }
448+ onScroll = { onScroll }
439449 >
440450 < GenericEmptyStateComponent
441451 headerMedia = { content . headerMedia }
@@ -449,7 +459,7 @@ function EmptySearchViewContent({
449459 >
450460 { content . children }
451461 </ GenericEmptyStateComponent >
452- </ ScrollView >
462+ </ Animated . ScrollView >
453463 ) ;
454464}
455465
0 commit comments