Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,24 @@ void ImageShadowNode::updateStateIfNeeded() {
return;
}

#ifdef ANDROID
// Check if we should skip prefetching based on shouldResize logic
if (ReactNativeFeatureFlags::enableImagePrefetchingAndroid()) {
const auto& resizeMethod = imageProps.resizeMethod;
const auto& uri = newImageSource.uri;
bool shouldResize = (resizeMethod == "resize") ||
// Only resize for local content/file URIs
(resizeMethod == "auto" &&
(uri.starts_with("content://") || uri.starts_with("file://")));
// If we would resize but have no dimensions, skip creating the request
if (shouldResize &&
(newImageSource.size.width == 0 || newImageSource.size.height == 0)) {
// Keep the old state - don't create a new image request
return;
}
}
#endif

ImageState state{
newImageSource,
imageManager_->requestImage(
Expand Down
Loading