Skip to content

Commit

Permalink
Changed animation to match the iOS default one (#283)
Browse files Browse the repository at this point in the history
* Changed animation to match the iOS default one

* Use the default on Android too

---------
  • Loading branch information
enthuan authored Apr 16, 2024
1 parent 31738ef commit 8fbaf53
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.androidmakers.ui

import moe.tlaster.precompose.navigation.transition.NavTransition

actual val defaultTransition: NavTransition = NavTransition()
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,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 +81,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 +98,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 +112,8 @@ private fun MainNavHost(
}
}

expect val defaultTransition: NavTransition

expect class PlatformContext

val LocalPlatformContext = staticCompositionLocalOf<Any?> { null }
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.androidmakers.ui

import androidx.compose.animation.slideInHorizontally
import androidx.compose.animation.slideOutHorizontally
import moe.tlaster.precompose.navigation.transition.NavTransition

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

0 comments on commit 8fbaf53

Please sign in to comment.