mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
ReactImageView - fix double imageSource check (#46248)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/46248 Only null check and grab the url once. Changelog: [Internal] Reviewed By: rshest Differential Revision: D61934974 fbshipit-source-id: 2214a79b34ecc9182e88551a7b04b58d371e5e7d
This commit is contained in:
committed by
Facebook GitHub Bot
parent
84ec424e8a
commit
48c4380a9b
+3
-7
@@ -481,9 +481,7 @@ public class ReactImageView(
|
||||
}
|
||||
|
||||
private fun maybeUpdateViewFromRequest(doResize: Boolean) {
|
||||
if (imageSource == null) {
|
||||
return
|
||||
}
|
||||
val uri = this.imageSource?.uri ?: return
|
||||
|
||||
val postprocessorList = mutableListOf<Postprocessor>()
|
||||
iterativeBoxBlurPostProcessor?.let { postprocessorList.add(it) }
|
||||
@@ -492,10 +490,8 @@ public class ReactImageView(
|
||||
|
||||
val resizeOptions = if (doResize) resizeOptions else null
|
||||
|
||||
val imageSourceSafe = this.imageSource ?: return
|
||||
|
||||
val imageRequestBuilder =
|
||||
ImageRequestBuilder.newBuilderWithSource(imageSourceSafe.uri)
|
||||
ImageRequestBuilder.newBuilderWithSource(uri)
|
||||
.setPostprocessor(postprocessor)
|
||||
.setResizeOptions(resizeOptions)
|
||||
.setAutoRotateEnabled(true)
|
||||
@@ -504,7 +500,7 @@ public class ReactImageView(
|
||||
val imageRequest: ImageRequest =
|
||||
ReactNetworkImageRequest.fromBuilderWithHeaders(imageRequestBuilder, headers)
|
||||
|
||||
globalImageLoadListener?.onLoadAttempt(imageSourceSafe.uri)
|
||||
globalImageLoadListener?.onLoadAttempt(uri)
|
||||
|
||||
@Suppress("UNCHECKED_CAST") // Unsafe cast necessary as this java class used raw generics
|
||||
val builder =
|
||||
|
||||
Reference in New Issue
Block a user