Skip to content

Commit

Permalink
fix(android): fixed occasional incorrect view measure for FastImage
Browse files Browse the repository at this point in the history
  • Loading branch information
IjzerenHein committed Aug 28, 2019
1 parent e9e6848 commit ec32eb2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
@@ -1,15 +1,13 @@
package com.ijzerenhein.sharedelement;

import android.view.View;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.widget.ImageView;

import com.facebook.drawee.view.GenericDraweeView;
import com.facebook.drawee.generic.GenericDraweeHierarchy;
import com.facebook.drawee.interfaces.DraweeController;
import com.facebook.drawee.drawable.ScalingUtils.ScaleType;

class RNSharedElementContent {
View view;
Expand All @@ -35,6 +33,9 @@ else if (view instanceof ImageView) {
if (drawable == null) return null;
int width = drawable.getIntrinsicWidth();
int height = drawable.getIntrinsicHeight();
if ((width <= 0) || (height <= 0)) {
return null;
}
return new RectF(0, 0, width, height);
}
return new RectF(0, 0, view.getWidth(), view.getHeight());
Expand Down
Expand Up @@ -77,6 +77,7 @@ ViewType update(
if ((mStyle != null) && (style != null) && !invalidated) {
switch (viewType) {
case REACTIMAGEVIEW:
case IMAGEVIEW:
if ((mStyle.compare(style) &
(RNSharedElementStyle.PROP_BORDER
| RNSharedElementStyle.PROP_BACKGROUND_COLOR
Expand All @@ -87,15 +88,6 @@ ViewType update(
invalidated = false;
}
break;
case IMAGEVIEW:
if ((mStyle.compare(style) &
(RNSharedElementStyle.PROP_BORDER | RNSharedElementStyle.PROP_BACKGROUND_COLOR)) != 0) {
//Log.d(LOG_TAG, "drawableChanged, viewType: " + viewType + ", changes: " + mStyle.compare(style));
invalidated = true;
} else {
invalidated = false;
}
break;
case PLAIN:
if ((mStyle.compare(style) &
(RNSharedElementStyle.PROP_BORDER
Expand Down

0 comments on commit ec32eb2

Please sign in to comment.