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

navigation animation is laggy #699

Open
proxiti opened this issue Nov 5, 2024 · 0 comments
Open

navigation animation is laggy #699

proxiti opened this issue Nov 5, 2024 · 0 comments

Comments

@proxiti
Copy link

proxiti commented Nov 5, 2024

version: 1.11.7
navigation-compose version: 2.8.3
Navigation animation is laggy when ui changes.

Here is a simple demo, when navigating to Detail from any destination, skip frames occur when updating the text.

Navigation animation is:

enterTransition = {
    slideIntoContainer(
        AnimatedContentTransitionScope.SlideDirection.Left,
        tween(400)
    )
}

ViewModel:

class DetailViewModel : ViewModel() {
    val textState = MutableStateFlow("test")

    init {
        viewModelScope.launch {
            delay(300)
            textState.value = "this is a performance test" // skip frames when updating text
        }
    }
}

UI:

private fun Detail() {
    val vm: DetailViewModel = viewModel()
    val text by vm.textState.collectAsState()
    Column(
        modifier = Modifier
            .fillMaxSize()
            .background(Color.Gray),
    ) {
        for (i in 1..100)
            Text(text = text)
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant