-
Notifications
You must be signed in to change notification settings - Fork 4k
feat: update Search/Reports page immediately following report actions #56772
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
Changes from all commits
9403e10
93a5bb6
e5b6e88
b93259e
8c74944
969c67e
88a7cb7
f368c6a
89d9e3c
e8fb90a
8331371
5267b72
1289cb9
3857631
4c525e2
e599567
4dca452
d87c916
891cd1a
7f09e7b
dc0a5df
b978d08
34b7df9
c02965b
43f935b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -80,6 +80,7 @@ import MoneyRequestHeaderStatusBar from './MoneyRequestHeaderStatusBar'; | |
| import type {ActionHandledType} from './ProcessMoneyReportHoldMenu'; | ||
| import ProcessMoneyReportHoldMenu from './ProcessMoneyReportHoldMenu'; | ||
| import ExportWithDropdownMenu from './ReportActionItem/ExportWithDropdownMenu'; | ||
| import {useSearchContext} from './Search/SearchContext'; | ||
| import SettlementButton from './SettlementButton'; | ||
|
|
||
| type MoneyReportHeaderProps = { | ||
|
|
@@ -163,6 +164,8 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea | |
| const isPayAtEndExpense = isPayAtEndExpenseTransactionUtils(transaction); | ||
| const isArchivedReport = isArchivedReportWithID(moneyRequestReport?.reportID); | ||
| const [archiveReason] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${moneyRequestReport?.reportID}`, {selector: getArchiveReason}); | ||
| const {currentSearchHash, isAllStatus} = useSearchContext(); | ||
| const hash = isAllStatus ? undefined : currentSearchHash; | ||
|
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. question to @luacmartins In general why do we have to push search hash to these functions which didn't use them before?
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. If I'm correct, the backend is not using the hash, this is purely used by the frontend to build optimistic data |
||
|
|
||
| const getCanIOUBePaid = useCallback( | ||
| (onlyShowPayElsewhere = false) => canIOUBePaidAction(moneyRequestReport, chatReport, policy, transaction ? [transaction] : undefined, onlyShowPayElsewhere), | ||
|
|
@@ -236,10 +239,10 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea | |
| } else if (isInvoiceReport(moneyRequestReport)) { | ||
| payInvoice(type, chatReport, moneyRequestReport, payAsBusiness); | ||
| } else { | ||
| payMoneyRequest(type, chatReport, moneyRequestReport, true); | ||
| payMoneyRequest(type, chatReport, moneyRequestReport, true, hash); | ||
|
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. @mkzie2 an we determine if the Expense Report is being opened from Search? If so, would it be possible to use |
||
| } | ||
| }, | ||
| [chatReport, isAnyTransactionOnHold, isDelegateAccessRestricted, moneyRequestReport], | ||
| [chatReport, hash, isAnyTransactionOnHold, isDelegateAccessRestricted, moneyRequestReport], | ||
| ); | ||
|
|
||
| const confirmApproval = () => { | ||
|
|
@@ -249,7 +252,7 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea | |
| } else if (isAnyTransactionOnHold) { | ||
| setIsHoldMenuVisible(true); | ||
| } else { | ||
| approveMoneyRequest(moneyRequestReport, true); | ||
| approveMoneyRequest(moneyRequestReport, true, hash); | ||
| } | ||
| }; | ||
|
|
||
|
|
@@ -418,7 +421,7 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea | |
| success={isWaitingForSubmissionFromCurrentUser} | ||
| text={translate('common.submit')} | ||
| style={[styles.mnw120, styles.pv2, styles.pr0]} | ||
| onPress={() => submitReport(moneyRequestReport)} | ||
| onPress={() => submitReport(moneyRequestReport, hash)} | ||
| isDisabled={shouldDisableSubmitButton} | ||
| /> | ||
| </View> | ||
|
|
@@ -479,7 +482,7 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea | |
| success={isWaitingForSubmissionFromCurrentUser} | ||
| text={translate('common.submit')} | ||
| style={[styles.flex1, styles.pr0]} | ||
| onPress={() => submitReport(moneyRequestReport)} | ||
| onPress={() => submitReport(moneyRequestReport, hash)} | ||
| isDisabled={shouldDisableSubmitButton} | ||
| /> | ||
| )} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,9 @@ | ||
| import React from 'react'; | ||
| import React, {useState} from 'react'; | ||
| import type {StyleProp, ViewStyle} from 'react-native'; | ||
| import type {AnimatedStyle} from 'react-native-reanimated'; | ||
| import Animated, {useAnimatedStyle, useSharedValue, withTiming} from 'react-native-reanimated'; | ||
| import useExitingAnimation from '@hooks/useExitingAnimation'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
| import shouldRenderOffscreen from '@libs/shouldRenderOffscreen'; | ||
| import variables from '@styles/variables'; | ||
|
|
||
|
|
@@ -32,6 +34,8 @@ type OpacityViewProps = { | |
|
|
||
| /** Whether the view needs to be rendered offscreen (for Android only) */ | ||
| needsOffscreenAlphaCompositing?: boolean; | ||
|
|
||
| shouldAnimateOnRemove?: boolean; | ||
| }; | ||
|
|
||
| function OpacityView({ | ||
|
|
@@ -41,8 +45,13 @@ function OpacityView({ | |
| style = [], | ||
| dimmingValue = variables.hoverDimValue, | ||
| needsOffscreenAlphaCompositing = false, | ||
| shouldAnimateOnRemove, | ||
| }: OpacityViewProps) { | ||
| const opacity = useSharedValue(1); | ||
| const styles = useThemeStyles(); | ||
| const [height, setHeight] = useState(0); | ||
| const Exiting = useExitingAnimation(height); | ||
|
|
||
| const opacityStyle = useAnimatedStyle(() => ({ | ||
| opacity: opacity.get(), | ||
| })); | ||
|
|
@@ -53,8 +62,12 @@ function OpacityView({ | |
|
|
||
| return ( | ||
| <Animated.View | ||
| style={[opacityStyle, style]} | ||
| style={[opacityStyle, style, shouldAnimateOnRemove && styles.overflowHidden]} | ||
| needsOffscreenAlphaCompositing={shouldRenderOffscreen ? needsOffscreenAlphaCompositing : undefined} | ||
| exiting={shouldAnimateOnRemove ? Exiting : undefined} | ||
| onLayout={(e) => { | ||
|
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. This component ( Is there any other way to add this animation, without affecting OpacityView? |
||
| setHeight(e.nativeEvent.layout.height); | ||
| }} | ||
| > | ||
| {children} | ||
| </Animated.View> | ||
|
|
||
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.
BTW I don't think we should connect this component to Search context since this component is used in the Inbox flow, not Search. I think we need to keep changes contained to the Search components since this is a Search feature
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.
@luacmartins When the user opens the RHP from Search and performs actions like approving or paying a money request, we will need to use the hash to update the search results.