diff --git a/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/preview/ElementPreview.kt b/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/preview/ElementPreview.kt index 6a25dd72fe..9a1548a687 100644 --- a/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/preview/ElementPreview.kt +++ b/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/preview/ElementPreview.kt @@ -9,9 +9,14 @@ package io.element.android.libraries.designsystem.preview import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.runtime.Composable +import androidx.compose.runtime.CompositionLocalProvider +import coil3.annotation.ExperimentalCoilApi +import coil3.compose.AsyncImagePreviewHandler +import coil3.compose.LocalAsyncImagePreviewHandler import io.element.android.compound.theme.ElementTheme import io.element.android.libraries.designsystem.theme.components.Surface +@OptIn(ExperimentalCoilApi::class) @Composable @Suppress("ModifierMissing") fun ElementPreview( @@ -19,12 +24,14 @@ fun ElementPreview( showBackground: Boolean = true, content: @Composable () -> Unit ) { - ElementTheme(darkTheme = darkTheme) { - if (showBackground) { - // If we have a proper contentColor applied we need a Surface instead of a Box - Surface(content = content) - } else { - content() + CompositionLocalProvider(LocalAsyncImagePreviewHandler provides AsyncImagePreviewHandler { null }) { + ElementTheme(darkTheme = darkTheme) { + if (showBackground) { + // If we have a proper contentColor applied we need a Surface instead of a Box + Surface(content = content) + } else { + content() + } } } }