Skip to content

Commit

Permalink
Update styles for lottie
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhenjaHorbach committed Oct 4, 2023
1 parent c0b5f21 commit 4b1e93f
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 77 deletions.
73 changes: 0 additions & 73 deletions patches/lottie-react-native+6.3.1.patch

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/ConfirmationPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function ConfirmationPage(props) {
source={props.animation}
autoPlay
loop
style={styles.confirmationAnimation}
style={[styles.confirmationAnimation, styles.aspectRatioLottie(props.animation)]}
/>
<Text style={[styles.textHeadline, styles.textAlignCenter, styles.mv2]}>{props.heading}</Text>
<Text style={styles.textAlignCenter}>{props.description}</Text>
Expand Down
2 changes: 1 addition & 1 deletion src/components/IllustratedHeaderPageLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function IllustratedHeaderPageLayout({backgroundColor, children, illustration, f
<>
<Lottie
source={illustration}
style={styles.w100}
style={[styles.w100, styles.aspectRatioLottie(illustration)]}
autoPlay
loop
/>
Expand Down
2 changes: 1 addition & 1 deletion src/components/ReimbursementAccountLoadingIndicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function ReimbursementAccountLoadingIndicator(props) {
source={LottieAnimations.ReviewingBankInfo}
autoPlay
loop
style={styles.loadingVBAAnimation}
style={[styles.loadingVBAAnimation, styles.aspectRatioLottie(LottieAnimations.ReviewingBankInfo)]}
/>
<View style={[styles.ph6]}>
<Text style={[styles.textAlignCenter]}>{translate('reimbursementAccountLoadingAnimation.explanationLine')}</Text>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/signin/SignInHeroImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function SignInHeroImage(props) {
source={LottieAnimations.Hands}
loop
autoPlay
style={[styles.alignSelfCenter, imageSize]}
style={[styles.alignSelfCenter, imageSize, styles.aspectRatioLottie(LottieAnimations.Hands)]}
/>
);
}
Expand Down
7 changes: 7 additions & 0 deletions src/styles/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -3694,6 +3694,13 @@ const styles = (theme) => ({
fontSize: variables.fontSizeSmall,
lineHeight: variables.lineHeightLarge,
},

aspectRatioLottie: (source) => {
if (typeof source === 'object' && !source.uri) {
return {aspectRatio: source.w / source.h};
}
return {aspectRatio: '1'};
},
});

// For now we need to export the styles function that takes the theme as an argument
Expand Down

0 comments on commit 4b1e93f

Please sign in to comment.