fornewid / material-motion-compose Goto Github PK
View Code? Open in Web Editor NEWMaterial Motion for Jetpack Compose and Compose Multiplatform
Home Page: https://fornewid.github.io/material-motion-compose/
License: Apache License 2.0
Material Motion for Jetpack Compose and Compose Multiplatform
Home Page: https://fornewid.github.io/material-motion-compose/
License: Apache License 2.0
New AnimatedContent
composable is introduced in compose-animation 1.0.0-beta09. (I2c3df)
So I think, I need to change the implementation.
Would love to have this available on mavenCentral()
material motion compose = 1.0.2
compose version = 2023.05.01
compose compiler = 1.4.7
java.lang.NoSuchMethodError: No static method mutableStateOf(F)Landroidx/compose/runtime/MutableFloatState; in class Landroidx/compose/runtime/PrimitiveSnapshotStateKt; or its super classes (declaration of 'androidx.compose.runtime.PrimitiveSnapshotStateKt'
at soup.compose.material.motion.MaterialMotionKt.MaterialMotion(MaterialMotion.kt:79)
at soup.compose.material.motion.MaterialMotionKt.MaterialMotion(MaterialMotion.kt:53)
at soup.compose.material.motion.MaterialFadeThroughKt.MaterialFadeThrough(MaterialFadeThrough.kt:40)
On Accompanist Navigation Animation, it can be done like this:
composable(
route = "home",
enterTransition = { _, _ ->
slideInVertically() + fadeIn()
},
)
But when i tried in Material Motion Navigation:
composable(
route = "home",
enterMotionSpec = { _, _ ->
translateYIn() + holdIn()
},
)
It gives error Type mismatch: inferred type is Unit but EnterMotionSpec was expected
So basically i wanted to use translate/slide and fade transition at the same time.
I have 4 navigation routes: first, second, third, fourth.
When i try to navigate first
-> second
-> third
-> fourth
, the transitions behave normally as it should.
However when i try to navigate back (back press) first
<- second
<- third
<- fourth
, the only transition that behave normally is the first pop backstack (in this case third
<- fourth
), other pop backstack just overlaps the current backstack.
I'm not sure how to explain it well but i have included a sample project for testing it here and a video here
Use onClick
slot for Card
and Surface
, instead of Modifier.clickable
.
Refer to https://issuetracker.google.com/issues/189965768
"After updating the 'compose bom' to version '2023.03.00', the app crashes with the following exception:
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/compose/animation/AnimatedContentScope; at soup.compose.material.motion.MaterialMotionKt$MaterialMotion$3$1.invoke(MaterialMotion.kt:85) at androidx.compose.animation.AnimatedContentKt.AnimatedContent(AnimatedContent.kt:759) at soup.compose.material.motion.MaterialMotionKt.MaterialMotion(MaterialMotion.kt:83) at soup.compose.material.motion.MaterialMotionKt.MaterialMotion(MaterialMotion.kt:55) at soup.compose.material.motion.MaterialFadeThroughKt.MaterialFadeThrough(MaterialFadeThrough.kt:111)
Steps to reproduce the behavior:
On v0.7.4, the back press behavior issue is fixed but when using navigation.navigateUp()
it still occured.
I have 3 routes, for example: splash, main, search
. When i'm navigating splash -> main -> search
, i called navigation.navigateUp()
on search
. It returns to main
then splash
reappears again.
The splash
route should not reappears after calling navigation.navigateUp()
on search
.
Add any other context about the problem here.
The navigation sample usage does not actually work, as rememberSlideDistance()
cannot be called from the lambda, it needs to be in a composable function
Steps to reproduce the behavior:
Implement the usage sample
It works
It is expected that transition animations can be applied to navigation-compose after some time.
The following link is related to this.
Then, it seems that it needs to be changed to a form that can be combined with navigation-compose.
Getting this error and app crashes when navigating frequently
java.lang.IllegalStateException: You cannot access the NavBackStackEntry's ViewModels after the NavBackStackEntry is destroyed.
Full log
java.lang.IllegalStateException: You cannot access the NavBackStackEntry's ViewModels after the NavBackStackEntry is destroyed.
at androidx.navigation.NavBackStackEntry.getViewModelStore(NavBackStackEntry.kt:213)
at androidx.lifecycle.viewmodel.compose.ViewModelKt.get(ViewModel.kt:206)
at androidx.lifecycle.viewmodel.compose.ViewModelKt.viewModel(ViewModel.kt:156)
.
.
.
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:162)
at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2443)
at androidx.compose.runtime.ComposerImpl.skipToGroupEnd(Composer.kt:2734)
at com.marketpulse.sniper.vte.view.bottom_panel.BottomPanelKt.Container(BottomPanel.kt:77)
at com.marketpulse.sniper.vte.view.bottom_panel.BottomPanelKt.access$Container(BottomPanel.kt:1)
at com.marketpulse.sniper.vte.view.bottom_panel.BottomPanelKt$BottomPanel$1.invoke(BottomPanel.kt:38)
at com.marketpulse.sniper.vte.view.bottom_panel.BottomPanelKt$BottomPanel$1.invoke(BottomPanel.kt:37)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:135)
at androidx.compose.runtime.internal.ComposableLambdaImpl$invoke$2.invoke(ComposableLambda.jvm.kt:141)
at androidx.compose.runtime.internal.ComposableLambdaImpl$invoke$2.invoke(ComposableLambda.jvm.kt:141)
at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:162)
at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2443)
at androidx.compose.runtime.ComposerImpl.skipCurrentGroup(Composer.kt:2711)
at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:3342)
at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:3320)
at androidx.compose.runtime.SnapshotStateKt__DerivedStateKt.observeDerivedStateRecalculations(DerivedState.kt:341)
at androidx.compose.runtime.SnapshotStateKt.observeDerivedStateRecalculations(Unknown Source:1)
at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:3320)
at androidx.compose.runtime.ComposerImpl.recompose$runtime_release(Composer.kt:3285)
at androidx.compose.runtime.CompositionImpl.recompose(Composition.kt:772)
at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:1047)
at androidx.compose.runtime.Recomposer.access$performRecompose(Recomposer.kt:124)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:541)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:510)
at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(AndroidUiFrameClock.android.kt:34)
at androidx.compose.ui.platform.AndroidUiDispatcher.performFrameDispatch(AndroidUiDispatcher.android.kt:109)
at androidx.compose.ui.platform.AndroidUiDispatcher.access$performFrameDispatch(AndroidUiDispatcher.android.kt:41)
at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(AndroidUiDispatcher.android.kt:69)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1035)
at android.view.Choreographer.doCallbacks(Choreographer.java:845)
at android.view.Choreographer.doFrame(Choreographer.java:775)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1022)
2023-03-30 16:38:05.722 20395-20395 AndroidRuntime com.marketpulse.sniper.vte E at android.os.Handler.handleCallback(Handler.java:978)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loopOnce(Looper.java:238)
at android.os.Looper.loop(Looper.java:357)
at android.app.ActivityThread.main(ActivityThread.java:8090)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1026)
Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [androidx.compose.runtime.PausableMonotonicFrameClock@21a437e, androidx.compose.ui.platform.MotionDurationScaleImpl@73350df, StandaloneCoroutine{Cancelling}@ef7912c, AndroidUiDispatcher@1ac67f5]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.