Skip to content

Commit

Permalink
Changed animation to match the iOS default one
Browse files Browse the repository at this point in the history
  • Loading branch information
Antoine Robiez committed Apr 16, 2024
1 parent 0a47c89 commit e7dcb85
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.androidmakers.ui

import androidx.compose.animation.slideInHorizontally
import androidx.compose.animation.slideOutHorizontally
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.staticCompositionLocalOf
Expand All @@ -17,6 +19,7 @@ import moe.tlaster.precompose.navigation.Navigator
import moe.tlaster.precompose.navigation.SwipeProperties
import moe.tlaster.precompose.navigation.path
import moe.tlaster.precompose.navigation.rememberNavigator
import moe.tlaster.precompose.navigation.transition.NavTransition
import org.koin.core.parameter.parametersOf

/**
Expand Down Expand Up @@ -80,7 +83,8 @@ private fun MainNavHost(
scene(
route = "${MainNavigationRoute.SESSION_DETAIL.name}/{sessionId}",
swipeProperties = SwipeProperties(),
deepLinks = listOf("https://androidmakers.fr/session/{sessionId}")
deepLinks = listOf("https://androidmakers.fr/session/{sessionId}"),
navTransition = defaultTransition
) {

val sessionId = it.path<String>("sessionId")
Expand All @@ -96,6 +100,7 @@ private fun MainNavHost(
route = "${MainNavigationRoute.SPEAKER_DETAIL.name}/{speakerId}",
deepLinks = listOf("https://androidmakers.fr/speaker/{speakerId}"),
swipeProperties = SwipeProperties(),
navTransition = defaultTransition
) { backstackEntry ->
val speakerId = backstackEntry.path<String>("speakerId")

Expand All @@ -109,6 +114,14 @@ private fun MainNavHost(
}
}

private val defaultTransition = NavTransition(
createTransition = slideInHorizontally { it },
pauseTransition = slideOutHorizontally { -it / 4 },
destroyTransition = slideOutHorizontally { it },
resumeTransition = slideInHorizontally { -it / 4 },
exitTargetContentZIndex = 1f
)

expect class PlatformContext

val LocalPlatformContext = staticCompositionLocalOf<Any?> { null }

0 comments on commit e7dcb85

Please sign in to comment.