Skip to content
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
1 change: 1 addition & 0 deletions assets/images/product-illustrations/fireworks.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/components/BlockingViews/BlockingView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,5 @@ function BlockingView({

BlockingView.displayName = 'BlockingView';

export type {BlockingViewProps};
export default BlockingView;
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';
import EmptyStateComponent from '.';
import type {EmptyStateComponentProps, GenericEmptyStateComponentProps} from './types';

// Only use this component when you need to pass/spread the props in a generic way, as
// EmptyStateComponent component wouldn't allow it in some cases.
function GenericEmptyStateComponent(props: GenericEmptyStateComponentProps) {
// eslint-disable-next-line react/jsx-props-no-spreading
return <EmptyStateComponent {...(props as EmptyStateComponentProps)} />;
}

export default GenericEmptyStateComponent;
4 changes: 2 additions & 2 deletions src/components/EmptyStateComponent/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type {VideoReadyForDisplayEvent} from 'expo-av';
import isEmpty from 'lodash/isEmpty';
import React, {useMemo, useState} from 'react';
import {View} from 'react-native';
import {StyleSheet, View} from 'react-native';
import Button from '@components/Button';
import ButtonWithDropdownMenu from '@components/ButtonWithDropdownMenu';
import ImageSVG from '@components/ImageSVG';
Expand Down Expand Up @@ -80,7 +80,7 @@ function EmptyStateComponent({
case CONST.EMPTY_STATE_MEDIA.ILLUSTRATION:
return (
<ImageSVG
style={headerContentStyles}
style={StyleSheet.flatten(headerContentStyles)}
src={headerMedia}
/>
);
Expand Down
12 changes: 7 additions & 5 deletions src/components/EmptyStateComponent/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import type IconAsset from '@src/types/utils/IconAsset';

type ValidSkeletons = typeof SearchRowSkeleton | typeof TableRowSkeleton;
type MediaTypes = ValueOf<typeof CONST.EMPTY_STATE_MEDIA>;
type HeaderMedia = string | IconAsset | DotLottieAnimation;
type EmptyStateButton = {
buttonText?: string;
buttonAction?: () => void;
Expand All @@ -24,7 +25,7 @@ type EmptyStateButton = {
>;
};

type SharedProps<T> = {
type SharedProps<TMediaType> = {
SkeletonComponent?: ValidSkeletons;
title: string;
titleStyles?: StyleProp<TextStyle>;
Expand All @@ -35,22 +36,23 @@ type SharedProps<T> = {
cardStyles?: StyleProp<ViewStyle>;
cardContentStyles?: StyleProp<ViewStyle>;
headerStyles?: StyleProp<ViewStyle>;
headerMediaType: T;
headerMediaType: TMediaType;
headerContentStyles?: StyleProp<ViewStyle & ImageStyle>;
lottieWebViewStyles?: React.CSSProperties | undefined;
minModalHeight?: number;
subtitleText?: React.ReactNode;
};

type MediaType<HeaderMedia, T extends MediaTypes> = SharedProps<T> & {
headerMedia: HeaderMedia;
type MediaType<THeaderMedia, TMediaType extends MediaTypes> = SharedProps<TMediaType> & {
headerMedia: THeaderMedia;
};

type VideoProps = MediaType<string, 'video'>;
type IllustrationProps = MediaType<IconAsset, 'illustration'>;
type AnimationProps = MediaType<DotLottieAnimation, 'animation'>;

type EmptyStateComponentProps = VideoProps | IllustrationProps | AnimationProps;
type GenericEmptyStateComponentProps = SharedProps<MediaTypes> & {headerMedia: HeaderMedia};

type VideoLoadedEventType = {
srcElement: {
Expand All @@ -59,4 +61,4 @@ type VideoLoadedEventType = {
};
};

export type {EmptyStateComponentProps, VideoLoadedEventType, EmptyStateButton};
export type {EmptyStateComponentProps, VideoLoadedEventType, EmptyStateButton, GenericEmptyStateComponentProps, MediaTypes, HeaderMedia};
6 changes: 6 additions & 0 deletions src/components/Icon/chunks/illustrations.chunk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,16 @@ import DjBoothReferenceHands from '@assets/images/product-illustrations/dj-booth
import EmptyStateExpenses from '@assets/images/product-illustrations/emptystate__expenses.svg';
import HoldExpense from '@assets/images/product-illustrations/emptystate__holdexpense.svg';
import ReceiptFairy from '@assets/images/product-illustrations/emptystate__receiptfairy.svg';
import Fireworks from '@assets/images/product-illustrations/fireworks.svg';
import FolderWithPapersAndWatch from '@assets/images/product-illustrations/folder-with-papers-and-watch.svg';
import FolderWithPapers from '@assets/images/product-illustrations/folder-with-papers.svg';
import Hands from '@assets/images/product-illustrations/home-illustration-hands.svg';
import CardReplacementSuccess from '@assets/images/product-illustrations/illustration__card-replacement-success.svg';
import MagicCode from '@assets/images/product-illustrations/magic-code.svg';
import ModalHoldOrReject from '@assets/images/product-illustrations/modal-hold-or-reject.svg';
import MushroomTopHat from '@assets/images/product-illustrations/mushroom-top-hat.svg';
import PaymentHands from '@assets/images/product-illustrations/payment-hands.svg';
import PlanetWithMobileApp from '@assets/images/product-illustrations/planet-with-mobile-app.svg';
import ReceiptsStackedOnPin from '@assets/images/product-illustrations/receipts-stacked-on-pin.svg';
import RocketBlue from '@assets/images/product-illustrations/rocket--blue.svg';
import RocketDude from '@assets/images/product-illustrations/rocket-dude.svg';
Expand Down Expand Up @@ -204,13 +207,16 @@ const Illustrations = {
EmptyStateExpenses,
HoldExpense,
ReceiptFairy,
Fireworks,
FolderWithPapersAndWatch,
FolderWithPapers,
Hands,
CardReplacementSuccess,
MagicCode,
ModalHoldOrReject,
MushroomTopHat,
PaymentHands,
PlanetWithMobileApp,
ReceiptsStackedOnPin,
RocketBlue,
RocketDude,
Expand Down
Loading
Loading