@@ -300,7 +300,7 @@ function Search({
300300 const navigation = useNavigation < PlatformStackNavigationProp < SearchFullscreenNavigatorParamList > > ( ) ;
301301 const isFocused = useIsFocused ( ) ;
302302 const [ isHoldMenuVisible , setIsHoldMenuVisible ] = useState ( false ) ;
303- const holdMenuParams = useRef < {
303+ const [ holdMenuParams , setHoldMenuParams ] = useState < {
304304 chatReport : OnyxEntry < Report > ;
305305 fullAmount : string ;
306306 moneyRequestReport : OnyxEntry < Report > ;
@@ -376,7 +376,7 @@ function Search({
376376 const chatReport = searchResults ?. data ?. [ `${ ONYXKEYS . COLLECTION . REPORT } ${ item . parentReportID } ` ] ;
377377 const moneyRequestReport = searchResults ?. data ?. [ `${ ONYXKEYS . COLLECTION . REPORT } ${ item . reportID } ` ] ;
378378 const { nonHeldAmount, fullAmount, hasValidNonHeldAmount} = getNonHeldAndFullAmount ( moneyRequestReport , item . allActions ?. includes ( CONST . SEARCH . ACTION_TYPES . PAY ) ?? false ) ;
379- holdMenuParams . current = {
379+ setHoldMenuParams ( {
380380 chatReport,
381381 moneyRequestReport,
382382 transactionCount : item . transactionCount ?? 0 ,
@@ -386,7 +386,7 @@ function Search({
386386 nonHeldAmount,
387387 hasValidNonHeldAmount,
388388 hasNoneHeldExpenses : item . transactions . some ( ( t ) => ! isOnHold ( t ) ) ,
389- } ;
389+ } ) ;
390390 setIsHoldMenuVisible ( true ) ;
391391 } ,
392392 [ searchResults ?. data ] ,
@@ -1773,18 +1773,18 @@ function Search({
17731773 nonPersonalAndWorkspaceCards = { nonPersonalAndWorkspaceCards }
17741774 isActionColumnWide = { isTask || hasDeletedTransaction }
17751775 />
1776- { isHoldMenuVisible && ! ! holdMenuParams . current && (
1776+ { isHoldMenuVisible && ! ! holdMenuParams && (
17771777 < ProcessMoneyReportHoldMenu
17781778 isVisible = { isHoldMenuVisible }
17791779 onClose = { ( ) => setIsHoldMenuVisible ( false ) }
1780- chatReport = { holdMenuParams . current . chatReport }
1781- fullAmount = { holdMenuParams . current . fullAmount }
1782- moneyRequestReport = { holdMenuParams . current . moneyRequestReport }
1783- transactionCount = { holdMenuParams . current . transactionCount }
1784- hasNonHeldExpenses = { holdMenuParams . current ?. hasNoneHeldExpenses }
1785- nonHeldAmount = { holdMenuParams . current . hasNoneHeldExpenses && holdMenuParams . current . hasValidNonHeldAmount ? holdMenuParams . current . nonHeldAmount : undefined }
1786- requestType = { holdMenuParams . current . requestType }
1787- paymentType = { holdMenuParams . current . paymentType }
1780+ chatReport = { holdMenuParams . chatReport }
1781+ fullAmount = { holdMenuParams . fullAmount }
1782+ moneyRequestReport = { holdMenuParams . moneyRequestReport }
1783+ transactionCount = { holdMenuParams . transactionCount }
1784+ hasNonHeldExpenses = { holdMenuParams ?. hasNoneHeldExpenses }
1785+ nonHeldAmount = { holdMenuParams . hasNoneHeldExpenses && holdMenuParams . hasValidNonHeldAmount ? holdMenuParams . nonHeldAmount : undefined }
1786+ requestType = { holdMenuParams . requestType }
1787+ paymentType = { holdMenuParams . paymentType }
17881788 />
17891789 ) }
17901790 </ Animated . View >
0 commit comments