mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-23 11:57:46 +08:00
If source is null , source uri is null or source is not an array should respect style
Summary: If source is null , source uri is null or source is not an array should respect style like in iOS Reviewed By: yungsters Differential Revision: D9018005 fbshipit-source-id: 5f695e8e3007c96e6004973e7fcbc6b57cc15249
This commit is contained in:
committed by
Facebook Github Bot
parent
a6e27c3f55
commit
9f8b5a9ed5
@@ -71,6 +71,9 @@ 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];
|
||||
|
||||
/*
|
||||
@@ -339,7 +342,10 @@ public class ReactImageView extends GenericDraweeView {
|
||||
|
||||
public void setSource(@Nullable ReadableArray sources) {
|
||||
mSources.clear();
|
||||
if (sources != null && sources.size() != 0) {
|
||||
if (sources == null || sources.size() == 0) {
|
||||
ImageSource imageSource = new ImageSource(getContext(), REMOTE_TRANSPARENT_BITMAP_URI);
|
||||
mSources.add(imageSource);
|
||||
} else {
|
||||
// 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);
|
||||
@@ -573,9 +579,9 @@ public class ReactImageView extends GenericDraweeView {
|
||||
private void setSourceImage() {
|
||||
mImageSource = null;
|
||||
if (mSources.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
if (hasMultipleSources()) {
|
||||
ImageSource imageSource = new ImageSource(getContext(), REMOTE_TRANSPARENT_BITMAP_URI);
|
||||
mSources.add(imageSource);
|
||||
} else if (hasMultipleSources()) {
|
||||
MultiSourceResult multiSource =
|
||||
MultiSourceHelper.getBestSourceForSize(getWidth(), getHeight(), mSources);
|
||||
mImageSource = multiSource.getBestResult();
|
||||
|
||||
Reference in New Issue
Block a user