Skip to content

Commit

Permalink
fix: fix svg problem on native
Browse files Browse the repository at this point in the history
  • Loading branch information
koko57 committed Jul 19, 2024
1 parent 121dd3f commit 237ff7f
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 32 deletions.
56 changes: 29 additions & 27 deletions assets/images/emptystate__expensifycard.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 13 additions & 2 deletions src/components/EmptyStateComponent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,18 @@ import type {EmptyStateComponentProps, VideoLoadedEventType} from './types';

const VIDEO_ASPECT_RATIO = 400 / 225;

function EmptyStateComponent({SkeletonComponent, headerMediaType, headerMedia, buttonText, buttonAction, title, subtitle, headerStyles, headerContentStyles}: EmptyStateComponentProps) {
function EmptyStateComponent({
SkeletonComponent,
headerMediaType,
headerMedia,
buttonText,
buttonAction,
title,
subtitle,
headerStyles,
headerContentStyles,
emptyStateContentStyles,
}: EmptyStateComponentProps) {
const styles = useThemeStyles();
const {isSmallScreenWidth} = useWindowDimensions();
const [videoAspectRatio, setVideoAspectRatio] = useState(VIDEO_ASPECT_RATIO);
Expand Down Expand Up @@ -76,7 +87,7 @@ function EmptyStateComponent({SkeletonComponent, headerMediaType, headerMedia, b
/>
</View>
<View style={styles.emptyStateForeground(isSmallScreenWidth)}>
<View style={styles.emptyStateContent}>
<View style={[styles.emptyStateContent, emptyStateContentStyles]}>
<View style={[styles.emptyStateHeader(headerMediaType === CONST.EMPTY_STATE_MEDIA.ILLUSTRATION), headerStyles]}>{HeaderComponent}</View>
<View style={styles.p8}>
<Text style={[styles.textAlignCenter, styles.textHeadlineH1, styles.mb2]}>{title}</Text>
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 @@ -19,6 +19,7 @@ type SharedProps<T> = {
headerStyles?: StyleProp<ViewStyle>;
headerMediaType: T;
headerContentStyles?: StyleProp<ViewStyle & ImageStyle>;
emptyStateContentStyles?: StyleProp<ViewStyle>;
};

type MediaType<HeaderMedia, T extends MediaTypes> = SharedProps<T> & {
Expand Down
5 changes: 2 additions & 3 deletions src/pages/workspace/expensifyCard/EmptyCardView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import ScrollView from '@components/ScrollView';
import CardRowSkeleton from '@components/Skeletons/CardRowSkeleton';
import Text from '@components/Text';
import useLocalize from '@hooks/useLocalize';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import useWindowDimensions from '@hooks/useWindowDimensions';
import CONST from '@src/CONST';
Expand All @@ -18,7 +17,6 @@ const BUTTON_MARGIN = 12;
function EmptyCardView() {
const {translate} = useLocalize();
const styles = useThemeStyles();
const theme = useTheme();
const {windowHeight, isSmallScreenWidth} = useWindowDimensions();

const headerHeight = isSmallScreenWidth ? HEADER_HEIGHT + BUTTON_HEIGHT + BUTTON_MARGIN : HEADER_HEIGHT;
Expand All @@ -30,9 +28,10 @@ function EmptyCardView() {
SkeletonComponent={CardRowSkeleton}
headerMediaType={CONST.EMPTY_STATE_MEDIA.ILLUSTRATION}
headerMedia={Illustrations.EmptyCardState}
headerStyles={{backgroundColor: theme.buttonHoveredBG, overflow: 'hidden'}}
headerStyles={[{overflow: 'hidden'}, isSmallScreenWidth && {maxHeight: 300}]}
title={translate('workspace.expensifyCard.issueAndManageCards')}
subtitle={translate('workspace.expensifyCard.getStartedIssuing')}
emptyStateContentStyles={isSmallScreenWidth ? {top: -BUTTON_HEIGHT} : undefined}
/>
</View>
<Text style={[styles.textMicroSupporting, styles.m5]}>{translate('workspace.expensifyCard.disclaimer')}</Text>
Expand Down

0 comments on commit 237ff7f

Please sign in to comment.