remove transition from image view (#1044)

This commit is contained in:
ryanh2o3 2024-04-23 15:09:30 -04:00 committed by GitHub
parent 384e80805e
commit 817f6decd6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 9 additions and 3 deletions

View File

@ -25,6 +25,12 @@ private let imagePipeline = {
// - instead of removing first source on failure, just safe index into sources // - instead of removing first source on failure, just safe index into sources
// TODO: currently SVGs are only supported for logos, which are only used in a few places. // TODO: currently SVGs are only supported for logos, which are only used in a few places.
// make it so when displaying an SVG there is a unified `image` caller modifier // make it so when displaying an SVG there is a unified `image` caller modifier
// TODO: `LazyImage` uses a transaction for view swapping, which will fade out old views
// and fade in new views, causing a black "flash" between the placeholder and final image.
// Since we use blur hashes, we actually just want the final image to fade in on top while
// the blur hash view is at full opacity.
// - refactor for option
// - take a look at `RotateContentView`
struct ImageView: View { struct ImageView: View {
@State @State

View File

@ -44,7 +44,7 @@ extension ItemView {
usePrimaryImage ? .primary : .backdrop, usePrimaryImage ? .primary : .backdrop,
maxWidth: UIScreen.main.bounds.width maxWidth: UIScreen.main.bounds.width
)) ))
.aspectRatio(contentMode: .fill) .aspectRatio(usePrimaryImage ? (2 / 3) : 1.77, contentMode: .fill)
.frame(height: UIScreen.main.bounds.height * 0.6) .frame(height: UIScreen.main.bounds.height * 0.6)
.bottomEdgeGradient(bottomColor: blurHashBottomEdgeColor) .bottomEdgeGradient(bottomColor: blurHashBottomEdgeColor)
.onAppear { .onAppear {

View File

@ -29,7 +29,7 @@ extension ItemView {
@ViewBuilder @ViewBuilder
private var headerView: some View { private var headerView: some View {
ImageView(viewModel.item.imageSource(.backdrop, maxHeight: UIScreen.main.bounds.height * 0.35)) ImageView(viewModel.item.imageSource(.backdrop, maxHeight: UIScreen.main.bounds.height * 0.35))
.aspectRatio(contentMode: .fill) .aspectRatio(1.77, contentMode: .fill)
.frame(height: UIScreen.main.bounds.height * 0.35) .frame(height: UIScreen.main.bounds.height * 0.35)
.bottomEdgeGradient(bottomColor: blurHashBottomEdgeColor) .bottomEdgeGradient(bottomColor: blurHashBottomEdgeColor)
.onAppear { .onAppear {

View File

@ -37,7 +37,7 @@ extension ItemView {
@ViewBuilder @ViewBuilder
private var headerView: some View { private var headerView: some View {
ImageView(viewModel.item.imageSource(.backdrop, maxWidth: UIScreen.main.bounds.width)) ImageView(viewModel.item.imageSource(.backdrop, maxWidth: UIScreen.main.bounds.width))
.aspectRatio(contentMode: .fill) .aspectRatio(1.77, contentMode: .fill)
.frame(height: UIScreen.main.bounds.height * 0.35) .frame(height: UIScreen.main.bounds.height * 0.35)
.bottomEdgeGradient(bottomColor: blurHashBottomEdgeColor) .bottomEdgeGradient(bottomColor: blurHashBottomEdgeColor)
.onAppear { .onAppear {