-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Refactor table view report loading state #62363
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
19f893e
5102271
0e0b101
fe0d59f
c554e97
f46fcc0
05e2f15
732873b
a155fb8
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React from 'react'; | ||
import {View} from 'react-native'; | ||
import {Rect} from 'react-native-svg'; | ||
import useTheme from '@hooks/useTheme'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import SkeletonViewContentLoader from './SkeletonViewContentLoader'; | ||
|
||
function MoneyReportHeaderStatusBarSkeleton() { | ||
const styles = useThemeStyles(); | ||
const theme = useTheme(); | ||
|
||
return ( | ||
<View style={[styles.dFlex, styles.flexRow, styles.overflowHidden, styles.w100, {height: 28}]}> | ||
<SkeletonViewContentLoader | ||
height={28} | ||
backgroundColor={theme.skeletonLHNIn} | ||
foregroundColor={theme.skeletonLHNOut} | ||
> | ||
<Rect | ||
x={0} | ||
y={12} | ||
width={16} | ||
height={8} | ||
/> | ||
<Rect | ||
x={24} | ||
y={12} | ||
width={120} | ||
height={8} | ||
/> | ||
</SkeletonViewContentLoader> | ||
</View> | ||
); | ||
} | ||
|
||
MoneyReportHeaderStatusBarSkeleton.displayName = 'MoneyReportHeaderStatusBarSkeleton'; | ||
|
||
export default MoneyReportHeaderStatusBarSkeleton; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ import {useFocusEffect} from '@react-navigation/native'; | |
import isEmpty from 'lodash/isEmpty'; | ||
import React, {memo, useCallback, useMemo, useState} from 'react'; | ||
import {View} from 'react-native'; | ||
import Animated, {FadeIn, FadeOut} from 'react-native-reanimated'; | ||
import type {TupleToUnion} from 'type-fest'; | ||
import {getButtonRole} from '@components/Button/utils'; | ||
import Checkbox from '@components/Checkbox'; | ||
|
@@ -55,6 +56,9 @@ type MoneyRequestReportTransactionListProps = { | |
/** Whether the report that these transactions belong to has any chat comments */ | ||
hasComments: boolean; | ||
|
||
/** Whether the report actions are being loaded, used to show 'Comments' during loading state */ | ||
isLoadingInitialReportActions?: boolean; | ||
|
||
/** scrollToNewTransaction callback used for scrolling to new transaction when it is created */ | ||
scrollToNewTransaction: (offset: number) => void; | ||
}; | ||
|
@@ -97,7 +101,15 @@ const getTransactionKey = (transaction: OnyxTypes.Transaction, key: SortableColu | |
return key === CONST.SEARCH.TABLE_COLUMNS.DATE ? dateKey : key; | ||
}; | ||
|
||
function MoneyRequestReportTransactionList({report, transactions, newTransactions, reportActions, hasComments, scrollToNewTransaction}: MoneyRequestReportTransactionListProps) { | ||
function MoneyRequestReportTransactionList({ | ||
report, | ||
transactions, | ||
newTransactions, | ||
reportActions, | ||
hasComments, | ||
isLoadingInitialReportActions: isLoadingReportActions, | ||
scrollToNewTransaction, | ||
}: MoneyRequestReportTransactionListProps) { | ||
const styles = useThemeStyles(); | ||
const StyleUtils = useStyleUtils(); | ||
const {translate} = useLocalize(); | ||
|
@@ -292,7 +304,13 @@ function MoneyRequestReportTransactionList({report, transactions, newTransaction | |
</View> | ||
)} | ||
<View style={[styles.dFlex, styles.flexRow, listHorizontalPadding, styles.justifyContentBetween, styles.mb2]}> | ||
<Text style={[styles.textLabelSupporting]}>{hasComments ? translate('common.comments') : ''}</Text> | ||
<Animated.Text | ||
style={[styles.textLabelSupporting]} | ||
entering={hasComments ? undefined : FadeIn} | ||
exiting={FadeOut} | ||
> | ||
{hasComments || isLoadingReportActions ? translate('common.comments') : ''} | ||
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. Why do we need to hasComments condition? 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. Previously, we didn't show the comments string when there were no comments, so this condition comes from the past. |
||
</Animated.Text> | ||
<View style={[styles.dFlex, styles.flexRow, styles.alignItemsCenter, styles.pr3]}> | ||
<Text style={[styles.mr3, styles.textLabelSupporting]}>{translate('common.total')}</Text> | ||
<Text style={[shouldUseNarrowLayout ? styles.mnw64p : styles.mnw100p, styles.textAlignRight, styles.textBold]}> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React from 'react'; | ||
import Animated, {FadeIn, FadeOut} from 'react-native-reanimated'; | ||
import ReportActionsSkeletonView from '@components/ReportActionsSkeletonView'; | ||
|
||
function ReportActionsListLoadingSkeleton() { | ||
return ( | ||
<Animated.View | ||
entering={FadeIn} | ||
exiting={FadeOut} | ||
> | ||
<ReportActionsSkeletonView possibleVisibleContentItems={3} /> | ||
</Animated.View> | ||
); | ||
} | ||
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. Display name |
||
|
||
ReportActionsListLoadingSkeleton.displayName = 'ReportActionsListLoadingSkeleton'; | ||
|
||
export default ReportActionsListLoadingSkeleton; |
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.
displayName