Reverting image source null so the fix can go all once later
Summary: Image source null which is in RC D8628053 has a bug which has a fix but didn't make to RC. Reverting so it can be cleaned up before going in RC. Reviewed By: achen1 Differential Revision: D8751687 fbshipit-source-id: e08b23a031455be23047880871813bdc840542dd
This commit is contained in:
parent
6292e2707a
commit
816d302e98
|
@ -190,6 +190,9 @@ let Image = (
|
|||
props.loadingIndicatorSource,
|
||||
);
|
||||
|
||||
// As opposed to the ios version, here we render `null` when there is no source, source.uri
|
||||
// or source array.
|
||||
|
||||
if (source && source.uri === '') {
|
||||
console.warn('source.uri should not be an empty string');
|
||||
}
|
||||
|
@ -212,13 +215,13 @@ let Image = (
|
|||
);
|
||||
}
|
||||
|
||||
if (source && !source?.uri && !Array.isArray(source)) {
|
||||
if (!source || (!source.uri && !Array.isArray(source))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let style;
|
||||
let sources;
|
||||
if (source?.uri != null) {
|
||||
if (source.uri) {
|
||||
const {width, height} = source;
|
||||
style = flattenStyle([{width, height}, styles.base, props.style]);
|
||||
sources = [{uri: source.uri}];
|
||||
|
@ -232,7 +235,7 @@ let Image = (
|
|||
style,
|
||||
shouldNotifyLoadEvents: !!(onLoadStart || onLoad || onLoadEnd || onError),
|
||||
src: sources,
|
||||
headers: source?.headers,
|
||||
headers: source.headers,
|
||||
defaultSrc: defaultSource ? defaultSource.uri : null,
|
||||
loadingIndicatorSrc: loadingIndicatorSource
|
||||
? loadingIndicatorSource.uri
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
*
|
||||
|
@ -70,9 +71,6 @@ public class ReactImageView extends GenericDraweeView {
|
|||
|
||||
public static final int REMOTE_IMAGE_FADE_DURATION_MS = 300;
|
||||
|
||||
public static final String REMOTE_TRANSPARENT_BITMAP_URI =
|
||||
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";
|
||||
|
||||
private static float[] sComputedCornerRadii = new float[4];
|
||||
|
||||
/*
|
||||
|
@ -341,10 +339,7 @@ public class ReactImageView extends GenericDraweeView {
|
|||
|
||||
public void setSource(@Nullable ReadableArray sources) {
|
||||
mSources.clear();
|
||||
if (sources == null || sources.size() == 0) {
|
||||
ImageSource imageSource = new ImageSource(getContext(), REMOTE_TRANSPARENT_BITMAP_URI);
|
||||
mSources.add(imageSource);
|
||||
} else {
|
||||
if (sources != null && sources.size() != 0) {
|
||||
// Optimize for the case where we have just one uri, case in which we don't need the sizes
|
||||
if (sources.size() == 1) {
|
||||
ReadableMap source = sources.getMap(0);
|
||||
|
@ -578,9 +573,9 @@ public class ReactImageView extends GenericDraweeView {
|
|||
private void setSourceImage() {
|
||||
mImageSource = null;
|
||||
if (mSources.isEmpty()) {
|
||||
ImageSource imageSource = new ImageSource(getContext(), REMOTE_TRANSPARENT_BITMAP_URI);
|
||||
mSources.add(imageSource);
|
||||
} else if (hasMultipleSources()) {
|
||||
return;
|
||||
}
|
||||
if (hasMultipleSources()) {
|
||||
MultiSourceResult multiSource =
|
||||
MultiSourceHelper.getBestSourceForSize(getWidth(), getHeight(), mSources);
|
||||
mImageSource = multiSource.getBestResult();
|
||||
|
|
Loading…
Reference in New Issue