Skip to content

Commit

Permalink
MediaVIew: Fix incorrect normalization target when the page is forced
Browse files Browse the repository at this point in the history
Signed-off-by: IacobIonut01 <[email protected]>
  • Loading branch information
IacobIonut01 committed Jan 19, 2025
1 parent dd1f8c3 commit ff2f326
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,16 @@ fun <T : Media> MediaViewScreen(
mediaState.value,
sheetHeightDp.value,
lastSheetHeightDp,
lastOrientation
lastOrientation,
shouldForcePage
) {
lastOrientation == configuration.orientation
&& lastSheetHeightDp.dp == sheetHeightDp
&& currentPage == pagerState.currentPage
&& storedNormalizationTarget > 0f
&& storedNormalizationTarget < 0.6f
&& !mediaState.value.isLoading
&& !shouldForcePage
}

LaunchedEffect(sheetHeightDp.value, configuration.orientation) {
Expand Down Expand Up @@ -292,6 +295,12 @@ fun <T : Media> MediaViewScreen(
}
}

LaunchedEffect(shouldForcePage) {
if (!shouldForcePage) {
storedNormalizationTarget = sheetState.offset
}
}

val normalizedOffset by rememberedDerivedState(
normalizationTarget,
isNormalizationTargetSet
Expand Down

0 comments on commit ff2f326

Please sign in to comment.