Skip to content

Commit

Permalink
[chore] coil AsyncImage placeholder 제거 및 crossfade 효과 적용 (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
medi-jihun-lee committed Feb 4, 2025
1 parent a530ada commit 96d4005
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalInspectionMode
import androidx.compose.ui.res.painterResource
import coil.compose.AsyncImage
import coil.request.ImageRequest
import com.nexters.ziine.android.presentation.R
import com.nexters.ziine.android.presentation.preview.ComponentPreview
import com.nexters.ziine.android.presentation.ui.theme.ZiineTheme
Expand All @@ -21,8 +23,8 @@ fun NetworkImage(
// failureImage: Painter = painterResource(id = R.drawable.placeholder),
contentScale: ContentScale = ContentScale.Crop,
) {
// val context = LocalContext.current
//
val context = LocalContext.current

// if (LocalInspectionMode.current) {
// Image(
// painter = loadingImage,
Expand Down Expand Up @@ -54,16 +56,13 @@ fun NetworkImage(
)
} else {
AsyncImage(
// model = ImageRequest.Builder(LocalContext.current)
// .data(imageUrl)
// .crossfade(true)
// .build(),
model = imageUrl,
model = ImageRequest.Builder(context)
.data(imageUrl)
.crossfade(true)
.build(),
contentDescription = contentDescription,
modifier = modifier,
contentScale = contentScale,
// 사진이 어떻게 나오는지 확인하기 위해 개발용으로 넣어둠, API 연동 후 제거 예정
placeholder = loadingImage,
)
}
}
Expand Down

0 comments on commit 96d4005

Please sign in to comment.