LottieFiles / lottie-react

lottie web player as a react component
https://lottiefiles.com
MIT License
717 stars 80 forks source link

fix: fix cross-platform layout inconsistency when used with lottie-react-native #155

Closed adamhari closed 6 months ago

adamhari commented 6 months ago

Description

lottie-react-native supports web by leveraging this library under the hood.

The lf-player-container div is a problem for universal apps because it cannot be styled via props and it's default styling is not consistent with the default React Native View's styling, which causes the web lottie components to have a different layout than their native counterparts.

On web, the default display and margin values cause the Lottie container to occupy the full width of it's container and, as a result, the lottie animation content is horizontally centered.

image

On native, the same component will only occupy the width of the lottie animation.

image

Type of change

Replace the lf-player-container div with a react fragment.

Checklist

changeset-bot[bot] commented 6 months ago

🦋 Changeset detected

Latest commit: 2c7f9b458ef1edebddcaced5f43de60a610e9789

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | -------------------------------- | ----- | | @lottiefiles/react-lottie-player | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR