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

Update to Compose 1.5 #195

Merged
merged 9 commits into from
Sep 4, 2023
Merged

Update to Compose 1.5 #195

merged 9 commits into from
Sep 4, 2023

Conversation

Syer10
Copy link
Contributor

@Syer10 Syer10 commented Aug 30, 2023

Closes #192
Closes #182
Closes #191

Koin was annoying because its dependency configuration is broken, it expects 1.4.3, and only 1.4.3, I was able to exclude its Compose dependency and swap it for 1.5 manually

@GazimSoliev
Copy link

Nice, I hope contributor will accept it

@ferranpons
Copy link

@adrielcafe please check it out! Also, a new RC with the changes already merged would be great.
Many thanks for considering my request. 🙏

@hellaandrew
Copy link

I would also like to ask @adrielcafe to inspect this request. I am unable to use transitions at this time due to this issue. Thanks!

@gkiss01
Copy link

gkiss01 commented Sep 4, 2023

I would also like to ask @adrielcafe to inspect this request. I am unable to use transitions at this time due to this issue. Thanks!

@Shamyyoun
Copy link

@hellaandrew , @gkiss01
As a temporary solution until the fix is merged, here is my workaround to get my project working,
Just add this file to the project and import transitions from it not from the library:

package golf.waitlist.presentation.composables.voyager

import androidx.compose.animation.AnimatedContent
import androidx.compose.animation.AnimatedContentTransitionScope
import androidx.compose.animation.AnimatedVisibilityScope
import androidx.compose.animation.ContentTransform
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.togetherWith
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import cafe.adriel.voyager.core.screen.Screen
import cafe.adriel.voyager.navigator.Navigator


private typealias ScreenTransitionContent = @Composable AnimatedVisibilityScope.(Screen) -> Unit

@ExperimentalAnimationApi
@Composable
private fun ScreenTransition(
    navigator: Navigator,
    transition: AnimatedContentTransitionScope<Screen>.() -> ContentTransform,
    modifier: Modifier = Modifier,
    content: ScreenTransitionContent = { it.Content() }
) {
    AnimatedContent(
        targetState = navigator.lastItem,
        transitionSpec = transition,
        modifier = modifier
    ) { screen ->
        navigator.saveableState("transition", screen) {
            content(screen)
        }
    }
}

@ExperimentalAnimationApi
@Composable
internal fun FadeTransition(
    navigator: Navigator,
    modifier: Modifier = Modifier,
    animationSpec: androidx.compose.animation.core.FiniteAnimationSpec<Float> = androidx.compose.animation.core.spring(
        stiffness = androidx.compose.animation.core.Spring.StiffnessMediumLow
    ),
    content: ScreenTransitionContent = { it.Content() }
) {
    ScreenTransition(
        navigator = navigator,
        modifier = modifier,
        content = content,
        transition = { fadeIn(animationSpec = animationSpec) togetherWith fadeOut(animationSpec = animationSpec) }
    )
}

@adrielcafe
Copy link
Owner

Thanks again for your contribution @Syer10 ❤️

@adrielcafe adrielcafe merged commit c385c70 into adrielcafe:main Sep 4, 2023
@Syer10 Syer10 deleted the 1.5.0 branch September 4, 2023 15:48
JeppeLeth added a commit to matadorapp/voyager that referenced this pull request Sep 13, 2023
…ted dependencies

* Add compose multiplatform support to voyager-koin (adrielcafe#159)

* Update hilt version to 2.46.1 (adrielcafe#162)

Co-authored-by: Adriel Café <[email protected]>

* Update to Compose 1.5 (adrielcafe#195)

* Update to Compose 1.5

* Fix sample

* Fix bottom sheet navigator

* Remove test function

* Fix RxJava multiplatform

* Runtime saveable is now added by default

* Remove accidental change

* Update other dependencies

* Fix runtimeSaveable

* chore: bump dependencies

* feat: add sheetGesturesEnabled param

* chore: fix lint

* chore: update to java 17 on release workflow

* fix AndroidScreenLifecycleOwner.kt merge

* sheet hidden fix

* return true

* update kotlin and compose versions to latest

---------

Co-authored-by: florian schoeberl <[email protected]>
Co-authored-by: Aftab Ahmad <[email protected]>
Co-authored-by: Adriel Café <[email protected]>
Co-authored-by: Mitchell Syer <[email protected]>
programadorthi pushed a commit to programadorthi/voyager that referenced this pull request Sep 20, 2023
* Update to Compose 1.5

* Fix sample

* Fix bottom sheet navigator

* Remove test function

* Fix RxJava multiplatform

* Runtime saveable is now added by default

* Remove accidental change

* Update other dependencies

* Fix runtimeSaveable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants