Skip to content

Commit

Permalink
Merge pull request #46649 from software-mansion-labs/filip-solecki/em…
Browse files Browse the repository at this point in the history
…pty-state-modal-height-fix
  • Loading branch information
francoisl authored Aug 6, 2024
2 parents 0988e7a + aca8eb1 commit 6c3dcc2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/components/EmptyStateComponent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import Lottie from '@components/Lottie';
import ScrollView from '@components/ScrollView';
import Text from '@components/Text';
import VideoPlayer from '@components/VideoPlayer';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useThemeStyles from '@hooks/useThemeStyles';
import CONST from '@src/CONST';
import type {EmptyStateComponentProps, VideoLoadedEventType} from './types';
Expand All @@ -25,9 +24,9 @@ function EmptyStateComponent({
headerStyles,
headerContentStyles,
emptyStateForegroundStyles,
minModalHeight = 400,
}: EmptyStateComponentProps) {
const styles = useThemeStyles();
const {shouldUseNarrowLayout} = useResponsiveLayout();
const [videoAspectRatio, setVideoAspectRatio] = useState(VIDEO_ASPECT_RATIO);

const setAspectRatio = (event: VideoReadyForDisplayEvent | VideoLoadedEventType | undefined) => {
Expand Down Expand Up @@ -79,14 +78,15 @@ function EmptyStateComponent({
}, [headerMedia, headerMediaType, headerContentStyles, videoAspectRatio, styles.emptyStateVideo]);

return (
<ScrollView contentContainerStyle={styles.emptyStateScrollView}>
<ScrollView contentContainerStyle={[styles.emptyStateScrollView, {minHeight: minModalHeight}]}>
<View style={styles.skeletonBackground}>
<SkeletonComponent
gradientOpacityEnabled
shouldAnimate={false}
/>
</View>
<View style={[styles.emptyStateForeground(shouldUseNarrowLayout), emptyStateForegroundStyles]}>

<View style={[styles.emptyStateForeground, emptyStateForegroundStyles]}>
<View style={styles.emptyStateContent}>
<View style={[styles.emptyStateHeader(headerMediaType === CONST.EMPTY_STATE_MEDIA.ILLUSTRATION), headerStyles]}>{HeaderComponent}</View>
<View style={styles.p8}>
Expand Down
1 change: 1 addition & 0 deletions src/components/EmptyStateComponent/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type SharedProps<T> = {
headerMediaType: T;
headerContentStyles?: StyleProp<ViewStyle & ImageStyle>;
emptyStateForegroundStyles?: StyleProp<ViewStyle>;
minModalHeight?: number;
};

type MediaType<HeaderMedia, T extends MediaTypes> = SharedProps<T> & {
Expand Down
1 change: 1 addition & 0 deletions src/pages/workspace/expensifyCard/EmptyCardView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ function EmptyCardView() {
title={translate('workspace.expensifyCard.issueAndManageCards')}
subtitle={translate('workspace.expensifyCard.getStartedIssuing')}
emptyStateForegroundStyles={isSmallScreenWidth && {justifyContent: 'flex-start'}}
minModalHeight={500}
/>
</View>
<Text style={[styles.textMicroSupporting, styles.m5]}>{translate('workspace.expensifyCard.disclaimer')}</Text>
Expand Down
11 changes: 4 additions & 7 deletions src/styles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5110,19 +5110,16 @@ const styles = (theme: ThemeColors) =>
},

emptyStateScrollView: {
marginTop: 12,
minHeight: 400,
height: '100%',
flex: 1,
},

emptyStateForeground: (isSmallScreenWidth: boolean) => ({
emptyStateForeground: {
margin: 32,
justifyContent: 'center',
alignItems: 'center',
height: '100%',
padding: isSmallScreenWidth ? 32 : 0,
width: '100%',
}),
flex: 1,
},

emptyStateContent: {
backgroundColor: theme.cardBG,
Expand Down

0 comments on commit 6c3dcc2

Please sign in to comment.