Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jetpack Compose Alpha-07 #1761

Closed
jgavazzisp opened this issue Mar 12, 2021 · 0 comments · Fixed by #1765
Closed

Jetpack Compose Alpha-07 #1761

jgavazzisp opened this issue Mar 12, 2021 · 0 comments · Fixed by #1765

Comments

@jgavazzisp
Copy link

Lottie is supported and developed on nights and weekends. Issues from Lottie sponsors will be prioritized.

Describe the bug
LottieAnimation is not respecting the "Modifier.size()"

Steps To Reproduce
To reproduce copy use this code:

@Composable
fun LoadingView(fullScreen: Boolean, darkTheme: Boolean = isSystemInDarkTheme()) {
    if (fullScreen) {
        Box(modifier = Modifier.fillMaxSize()) {
            LoadingAnimation(
                modifier = Modifier.align(Alignment.Center),
                darkTheme = darkTheme
            )
        }
    } else {
        LoadingAnimation(darkTheme = darkTheme)
    }
}

@Composable
internal fun LoadingAnimation(modifier: Modifier = Modifier, darkTheme: Boolean) {
    val fileName = <some_lottie_animation>

    val animationSpec = remember { LottieAnimationSpec.Asset(fileName) }

    val animationState = rememberLottieAnimationState(
        autoPlay = true,
        repeatCount = Integer.MAX_VALUE
    )

    LottieAnimation(
        spec = animationSpec,
        animationState = animationState,
        modifier = modifier.size(64.dp)
    )
}

The result I'm getting is a full-screen animation without the bounds being respected as shown here:
image

Thanks

gpeal added a commit that referenced this issue Mar 22, 2021
This makes LottieAnimation modifiers behave as they are supposed to given the Compose guidelines

Fixes #1761
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant