Skip to content

Commit

Permalink
make the animations responsive
Browse files Browse the repository at this point in the history
  • Loading branch information
kosmydel committed Dec 8, 2023
1 parent e908c93 commit df5da55
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,7 @@ const CONST = {
3: 100,
},
},
CENTRAL_PANE_ANIMATION_HEIGHT: 200,
LHN_SKELETON_VIEW_ITEM_HEIGHT: 64,
EXPENSIFY_PARTNER_NAME: 'expensify.com',
EMAIL: {
Expand Down
8 changes: 6 additions & 2 deletions src/components/IllustratedHeaderPageLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import PropTypes from 'prop-types';
import React from 'react';
import useTheme from '@styles/themes/useTheme';
import useThemeStyles from '@styles/useThemeStyles';
import useWindowDimensions from '@hooks/useWindowDimensions';
import CONST from '@src/CONST';
import HeaderPageLayout from './HeaderPageLayout';
import headerWithBackButtonPropTypes from './HeaderWithBackButton/headerWithBackButtonPropTypes';
import Lottie from './Lottie';
Expand Down Expand Up @@ -34,6 +36,8 @@ const defaultProps = {
function IllustratedHeaderPageLayout({backgroundColor, children, illustration, footer, overlayContent, ...propsToPassToHeader}) {
const theme = useTheme();
const styles = useThemeStyles();
const {isSmallScreenWidth} = useWindowDimensions();

return (
<HeaderPageLayout
backgroundColor={backgroundColor || theme.appBG}
Expand All @@ -43,15 +47,15 @@ function IllustratedHeaderPageLayout({backgroundColor, children, illustration, f
<Lottie
source={illustration}
style={styles.w100}
webStyle={styles.h100}
webStyle={isSmallScreenWidth ? styles.w100 : styles.h100}
autoPlay
loop
/>
{overlayContent && overlayContent()}
</>
}
// TODO: move to variables
headerContainerStyles={[styles.justifyContentCenter, styles.w100, {height: 200}]}
headerContainerStyles={[styles.justifyContentCenter, styles.w100, !isSmallScreenWidth && {height: CONST.CENTRAL_PANE_ANIMATION_HEIGHT}]}
footer={footer}
// eslint-disable-next-line react/jsx-props-no-spreading
{...propsToPassToHeader}
Expand Down

0 comments on commit df5da55

Please sign in to comment.