Skip to content

Fix: Empty state screen is not at the middle #59141

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

Merged
merged 1 commit into from
Mar 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/pages/Search/EmptySearchView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,10 @@ function EmptySearchView({type, hasResults}: EmptySearchViewProps) {

return (
<>
<ScrollView showsVerticalScrollIndicator={false}>
<ScrollView
showsVerticalScrollIndicator={false}
contentContainerStyle={[styles.flexGrow1, styles.flexShrink0]}
>
<EmptyStateComponent
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@twilight2294 is there any way that we can put this [styles.flexGrow1, styles.flexShrink0] into EmptyStateComponent? To avoid repeated code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ScrollView takes the full screen view, so it has to be added to the container which is being used, so I guess this is the way

SkeletonComponent={SearchRowSkeleton}
headerMediaType={CONST.EMPTY_STATE_MEDIA.ANIMATION}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ function WorkspaceCategoriesPage({route}: WorkspaceCategoriesPageProps) {
)}

{!hasVisibleCategories && !isLoading && (
<ScrollView>
<ScrollView contentContainerStyle={[styles.flexGrow1, styles.flexShrink0]}>
<EmptyStateComponent
SkeletonComponent={TableListItemSkeleton}
headerMediaType={CONST.EMPTY_STATE_MEDIA.ANIMATION}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function WorkspaceCompanyCardsFeedAddedEmptyPage({handleAssignCard, isDisabledAs
const styles = useThemeStyles();

return (
<ScrollView>
<ScrollView contentContainerStyle={[styles.flexGrow1, styles.flexShrink0]}>
<EmptyStateComponent
SkeletonComponent={CardRowSkeleton}
headerMediaType={CONST.EMPTY_STATE_MEDIA.ILLUSTRATION}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function WorkspaceCompanyCardsFeedPendingPage() {
const styles = useThemeStyles();

return (
<ScrollView>
<ScrollView contentContainerStyle={[styles.flexGrow1, styles.flexShrink0]}>
<EmptyStateComponent
SkeletonComponent={CardRowSkeleton}
containerStyles={styles.mt5}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/workspace/expensifyCard/EmptyCardView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function EmptyCardView({isBankAccountVerified}: EmptyCardViewProps) {
const headerHeight = useEmptyViewHeaderHeight(shouldUseNarrowLayout, isBankAccountVerified);

return (
<ScrollView>
<ScrollView contentContainerStyle={[styles.flexGrow1, styles.flexShrink0]}>
<View style={[{height: windowHeight - headerHeight}, styles.pt5]}>
<EmptyStateComponent
SkeletonComponent={CardRowSkeleton}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/workspace/perDiem/WorkspacePerDiemPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ function WorkspacePerDiemPage({route}: WorkspacePerDiemPageProps) {
)}

{!hasVisibleSubRates && !isLoading && (
<ScrollView>
<ScrollView contentContainerStyle={[styles.flexGrow1, styles.flexShrink0]}>
<EmptyStateComponent
SkeletonComponent={TableListItemSkeleton}
headerMediaType={CONST.EMPTY_STATE_MEDIA.ANIMATION}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ function ReportFieldsListValuesPage({
<Text style={[styles.sidebarLinkText, styles.optionAlternateText]}>{translate('workspace.reportFields.listInputSubtitle')}</Text>
</View>
{shouldShowEmptyState && (
<ScrollView>
<ScrollView contentContainerStyle={[styles.flexGrow1, styles.flexShrink0]}>
<EmptyStateComponent
title={translate('workspace.reportFields.emptyReportFieldsValues.title')}
subtitle={translate('workspace.reportFields.emptyReportFieldsValues.subtitle')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ function WorkspaceReportFieldsPage({
/>
)}
{shouldShowEmptyState && (
<ScrollView>
<ScrollView contentContainerStyle={[styles.flexGrow1, styles.flexShrink0]}>
<EmptyStateComponent
title={translate('workspace.reportFields.emptyReportFields.title')}
subtitle={translate('workspace.reportFields.emptyReportFields.subtitle')}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/workspace/tags/WorkspaceTagsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ function WorkspaceTagsPage({route}: WorkspaceTagsPageProps) {
/>
)}
{!hasVisibleTags && !isLoading && (
<ScrollView>
<ScrollView contentContainerStyle={[styles.flexGrow1, styles.flexShrink0]}>
<EmptyStateComponent
SkeletonComponent={TableListItemSkeleton}
headerMediaType={CONST.EMPTY_STATE_MEDIA.ANIMATION}
Expand Down
Loading