-
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 3 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,36 @@ | ||
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> | ||
); | ||
} | ||
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. displayName |
||
|
||
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'; | ||
|
@@ -52,6 +53,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 */ | ||
isLoadingReportActions?: boolean; | ||
}; | ||
|
||
type TransactionWithOptionalHighlight = OnyxTypes.Transaction & { | ||
|
@@ -81,7 +85,7 @@ const getTransactionKey = (transaction: OnyxTypes.Transaction, key: SortableColu | |
return key === CONST.SEARCH.TABLE_COLUMNS.DATE ? dateKey : key; | ||
}; | ||
|
||
function MoneyRequestReportTransactionList({report, transactions, reportActions, hasComments}: MoneyRequestReportTransactionListProps) { | ||
function MoneyRequestReportTransactionList({report, transactions, reportActions, hasComments, isLoadingReportActions}: MoneyRequestReportTransactionListProps) { | ||
const styles = useThemeStyles(); | ||
const StyleUtils = useStyleUtils(); | ||
const {translate} = useLocalize(); | ||
|
@@ -289,7 +293,13 @@ function MoneyRequestReportTransactionList({report, transactions, reportActions, | |
</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={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,16 @@ | ||
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 |
||
|
||
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.
@SzymczakJ shouldShowNextStep is also used for isMoreContentShown and shouldAddGapToContents. Does this change impact on it?
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.
Good catch, from what I know(this knowledge comes from @trjExpensify) we are always showing the next steps in expense Reports(this kind of reports always has
MoneyReportHeader
) and never(at least for now) for the invoice reports(this is the only other report type that usesMoneyReportHeader
).I've added
!isInvoiceReport
check to reflect it.So when the
shouldShowNextStep
is true, theisMoreContentShown
is also true, and "more content" is either skeleton or real next steps and we don't need to worry about optimisticNextStep?.message?.length.