Thread
#compose
    m

    merono

    2 years ago
    🤔 Did recomposing on
    Configuration
    changes stop working recently? That’s what it seems like when I use the code snippet below and specify
    android:configChanges="uiMode"
    in my manifest.
    MaterialTheme(
        colors = if (isSystemInDarkTheme()) darkColors() else lightColors()
    ) {
        Box(
            Modifier.size(48.dp),
            backgroundColor = MaterialTheme.colors.onBackground
        )
    }
    The color of the
    Box
    doesn’t change when I toggle dark mode on my device (pixel 3), but I feel like it did on an older version of compose. The color does get updated correctly if I kill the app and re-open it. I’m seeing this behavior on
    alpha01
    and
    dev17
    , using API 29. I also tried similar things by using
    ConfigurationAmbient.current
    directly, and saw the same behavior. When debugging the app, I was able to see
    AndroidComposeView.onConfigurationChanged
    get called with the new
    Configuration
    though.
    l

    Louis Pullen-Freilich [G]

    2 years ago
    This should still work, if you have a project that reproduces this could you file a bug?
    m

    merono

    2 years ago
    @Louis Pullen-Freilich [G] filed the bug here: https://issuetracker.google.com/issues/166667488
    l

    Louis Pullen-Freilich [G]

    2 years ago
    Pretty strange, I tried using a recent snapshot build, and it seems to work - so I guess something must have fixed this since alpha01 release, not sure what. If you use the snapshot build ( add
    maven { url '<https://androidx.dev/snapshots/builds/6798052/artifacts/ui/repository>' }
    inside the
    allProjects {
        repositories {
    block, and then change the version to be:
    compose_version = '1.0.0-SNAPSHOT'
    ) Does this then work correctly for you on your setup?
    m

    merono

    2 years ago
    I just tried using the snapshot build and it worked for me too. Thanks!
    So I guess it would be fixed in either alpha02 or alpha03?
    l

    Louis Pullen-Freilich [G]

    2 years ago
    Yup looks like it should be fixed in alpha02