|
16 | 16 | package com.amplifyframework.ui.authenticator.ui |
17 | 17 |
|
18 | 18 | import androidx.compose.animation.AnimatedContent |
19 | | -import androidx.compose.animation.AnimatedContentScope |
| 19 | +import androidx.compose.animation.AnimatedContentTransitionScope |
20 | 20 | import androidx.compose.animation.ContentTransform |
21 | | -import androidx.compose.animation.ExperimentalAnimationApi |
22 | 21 | import androidx.compose.animation.core.tween |
23 | 22 | import androidx.compose.animation.fadeIn |
24 | 23 | import androidx.compose.animation.fadeOut |
25 | 24 | import androidx.compose.animation.scaleIn |
26 | 25 | import androidx.compose.animation.scaleOut |
27 | | -import androidx.compose.animation.with |
| 26 | +import androidx.compose.animation.togetherWith |
28 | 27 | import androidx.compose.foundation.layout.Box |
29 | 28 | import androidx.compose.foundation.layout.Column |
30 | 29 | import androidx.compose.foundation.rememberScrollState |
@@ -76,7 +75,6 @@ import com.amplifyframework.ui.authenticator.util.AuthenticatorMessage |
76 | 75 | * @param onDisplayMessage Override the default handling for displaying an [AuthenticatorMessage]. |
77 | 76 | * @param content The content shown when the Authenticator reaches the [SignedInState]. |
78 | 77 | */ |
79 | | -@OptIn(ExperimentalAnimationApi::class) |
80 | 78 | @Composable |
81 | 79 | fun Authenticator( |
82 | 80 | modifier: Modifier = Modifier, |
@@ -111,7 +109,8 @@ fun Authenticator( |
111 | 109 | Box(modifier = modifier) { |
112 | 110 | AnimatedContent( |
113 | 111 | targetState = stepState, |
114 | | - transitionSpec = { defaultTransition() } |
| 112 | + transitionSpec = { defaultTransition() }, |
| 113 | + label = "AuthenticatorContentTransition" |
115 | 114 | ) { targetState -> |
116 | 115 | Column( |
117 | 116 | modifier = Modifier.verticalScroll(rememberScrollState()) |
@@ -152,16 +151,14 @@ fun Authenticator( |
152 | 151 | } |
153 | 152 | } |
154 | 153 |
|
155 | | -@OptIn(ExperimentalAnimationApi::class) |
156 | | -internal fun AnimatedContentScope<AuthenticatorStepState>.defaultTransition(): ContentTransform { |
| 154 | +internal fun AnimatedContentTransitionScope<AuthenticatorStepState>.defaultTransition(): ContentTransform { |
157 | 155 | // Show reverse transition when going back to signIn |
158 | 156 | if (targetState is SignInState && initialState != LoadingState) { |
159 | | - return fadeIn(animationSpec = tween(220, delayMillis = 90)) with |
160 | | - scaleOut(targetScale = 0.92f, animationSpec = tween(90)) + |
161 | | - fadeOut(animationSpec = tween(90)) |
| 157 | + return fadeIn(animationSpec = tween(220, delayMillis = 90)) togetherWith |
| 158 | + scaleOut(targetScale = 0.92f, animationSpec = tween(90)) + fadeOut(animationSpec = tween(90)) |
162 | 159 | } |
163 | 160 | // Show forward transition for all others |
164 | 161 | return fadeIn(animationSpec = tween(220, delayMillis = 90)) + |
165 | | - scaleIn(initialScale = 0.92f, animationSpec = tween(220, delayMillis = 90)) with |
| 162 | + scaleIn(initialScale = 0.92f, animationSpec = tween(220, delayMillis = 90)) togetherWith |
166 | 163 | fadeOut(animationSpec = tween(90)) |
167 | 164 | } |
0 commit comments