diff --git a/src/components/EmptyStateComponent/index.tsx b/src/components/EmptyStateComponent/index.tsx index 1efa526355f1..178267de8429 100644 --- a/src/components/EmptyStateComponent/index.tsx +++ b/src/components/EmptyStateComponent/index.tsx @@ -23,7 +23,6 @@ function EmptyStateComponent({ subtitle, headerStyles, headerContentStyles, - emptyStateForegroundStyles, minModalHeight = 400, }: EmptyStateComponentProps) { const styles = useThemeStyles(); @@ -85,8 +84,7 @@ function EmptyStateComponent({ shouldAnimate={false} /> - - + {HeaderComponent} diff --git a/src/components/EmptyStateComponent/types.ts b/src/components/EmptyStateComponent/types.ts index 94860893c2c4..80fac980864f 100644 --- a/src/components/EmptyStateComponent/types.ts +++ b/src/components/EmptyStateComponent/types.ts @@ -19,7 +19,6 @@ type SharedProps = { headerStyles?: StyleProp; headerMediaType: T; headerContentStyles?: StyleProp; - emptyStateForegroundStyles?: StyleProp; minModalHeight?: number; }; diff --git a/src/hooks/useEmptyViewHeaderHeight/const.ts b/src/hooks/useEmptyViewHeaderHeight/const.ts new file mode 100644 index 000000000000..83327ad36c8b --- /dev/null +++ b/src/hooks/useEmptyViewHeaderHeight/const.ts @@ -0,0 +1,5 @@ +const HEADER_HEIGHT = 80; +const BUTTON_HEIGHT = 40; +const BUTTON_MARGIN = 12; + +export {HEADER_HEIGHT, BUTTON_HEIGHT, BUTTON_MARGIN}; diff --git a/src/hooks/useEmptyViewHeaderHeight/index.ios.ts b/src/hooks/useEmptyViewHeaderHeight/index.ios.ts new file mode 100644 index 000000000000..d59e105574bf --- /dev/null +++ b/src/hooks/useEmptyViewHeaderHeight/index.ios.ts @@ -0,0 +1,10 @@ +import useSafeAreaInsets from '@hooks/useSafeAreaInsets'; +import {BUTTON_HEIGHT, BUTTON_MARGIN, HEADER_HEIGHT} from './const'; + +function useEmptyViewHeaderHeight(isSmallScreenWidth: boolean): number { + const safeAreaInsets = useSafeAreaInsets(); + + return isSmallScreenWidth ? HEADER_HEIGHT + BUTTON_HEIGHT + BUTTON_MARGIN + safeAreaInsets.top : HEADER_HEIGHT; +} + +export default useEmptyViewHeaderHeight; diff --git a/src/hooks/useEmptyViewHeaderHeight/index.ts b/src/hooks/useEmptyViewHeaderHeight/index.ts new file mode 100644 index 000000000000..d241d95b236f --- /dev/null +++ b/src/hooks/useEmptyViewHeaderHeight/index.ts @@ -0,0 +1,7 @@ +import {BUTTON_HEIGHT, BUTTON_MARGIN, HEADER_HEIGHT} from './const'; + +function useEmptyViewHeaderHeight(isSmallScreenWidth: boolean): number { + return isSmallScreenWidth ? HEADER_HEIGHT + BUTTON_HEIGHT + BUTTON_MARGIN : HEADER_HEIGHT; +} + +export default useEmptyViewHeaderHeight; diff --git a/src/pages/workspace/expensifyCard/EmptyCardView.tsx b/src/pages/workspace/expensifyCard/EmptyCardView.tsx index ace0b84165d8..f83095444036 100644 --- a/src/pages/workspace/expensifyCard/EmptyCardView.tsx +++ b/src/pages/workspace/expensifyCard/EmptyCardView.tsx @@ -5,26 +5,23 @@ import * as Illustrations from '@components/Icon/Illustrations'; import ScrollView from '@components/ScrollView'; import CardRowSkeleton from '@components/Skeletons/CardRowSkeleton'; import Text from '@components/Text'; +import useEmptyViewHeaderHeight from '@hooks/useEmptyViewHeaderHeight'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; import colors from '@styles/theme/colors'; import CONST from '@src/CONST'; -const HEADER_HEIGHT = 80; -const BUTTON_HEIGHT = 40; -const BUTTON_MARGIN = 12; - function EmptyCardView() { const {translate} = useLocalize(); const styles = useThemeStyles(); const {windowHeight, isSmallScreenWidth} = useWindowDimensions(); - const headerHeight = isSmallScreenWidth ? HEADER_HEIGHT + BUTTON_HEIGHT + BUTTON_MARGIN : HEADER_HEIGHT; + const headerHeight = useEmptyViewHeaderHeight(isSmallScreenWidth); return ( - +