From cc1ad2fe41dc16ca2b8af439a8fe00c3e5a42c2c Mon Sep 17 00:00:00 2001 From: "dima.avdeev" <99798741+dima-avdeev-jb@users.noreply.github.com> Date: Sat, 8 Apr 2023 13:05:29 +0300 Subject: [PATCH] hotifx bug with related pictures (#3017) --- .../kotlin/example/imageviewer/ImageViewer.common.kt | 4 ++-- .../kotlin/example/imageviewer/view/MemoryScreen.kt | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/imageviewer/shared/src/commonMain/kotlin/example/imageviewer/ImageViewer.common.kt b/examples/imageviewer/shared/src/commonMain/kotlin/example/imageviewer/ImageViewer.common.kt index 3901bc53e7..24ca0c24c7 100644 --- a/examples/imageviewer/shared/src/commonMain/kotlin/example/imageviewer/ImageViewer.common.kt +++ b/examples/imageviewer/shared/src/commonMain/kotlin/example/imageviewer/ImageViewer.common.kt @@ -94,8 +94,8 @@ fun ImageViewerWithProvidedDependencies( MemoryScreen( pictures = pictures, memoryPage = page, - onSelectRelatedMemory = { pictureIndex -> - navigationStack.push(MemoryPage(pictureIndex)) + onSelectRelatedMemory = { picture: PictureData -> + navigationStack.push(MemoryPage(pictures.indexOf(picture))) }, onBack = { resetNavigation -> if (resetNavigation) { diff --git a/examples/imageviewer/shared/src/commonMain/kotlin/example/imageviewer/view/MemoryScreen.kt b/examples/imageviewer/shared/src/commonMain/kotlin/example/imageviewer/view/MemoryScreen.kt index 7623a60f60..2ba14bc247 100644 --- a/examples/imageviewer/shared/src/commonMain/kotlin/example/imageviewer/view/MemoryScreen.kt +++ b/examples/imageviewer/shared/src/commonMain/kotlin/example/imageviewer/view/MemoryScreen.kt @@ -43,7 +43,7 @@ import org.jetbrains.compose.resources.ExperimentalResourceApi fun MemoryScreen( pictures: SnapshotStateList, memoryPage: MemoryPage, - onSelectRelatedMemory: (index: Int) -> Unit, + onSelectRelatedMemory: (picture: PictureData) -> Unit, onBack: (resetNavigation: Boolean) -> Unit, onHeaderClick: (index: Int) -> Unit, ) { @@ -273,7 +273,7 @@ fun Headliner(s: String) { @Composable fun RelatedMemoriesVisualizer( pictures: List, - onSelectRelatedMemory: (index: Int) -> Unit + onSelectRelatedMemory: (picture: PictureData) -> Unit ) { Box( modifier = Modifier.padding(10.dp, 0.dp).clip(RoundedCornerShape(10.dp)).fillMaxWidth() @@ -287,7 +287,7 @@ fun RelatedMemoriesVisualizer( SquareThumbnail( picture = item, isHighlighted = false, - onClick = { onSelectRelatedMemory(index) }) + onClick = { onSelectRelatedMemory(item) }) } } }