mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-08 09:10:44 +00:00
[android] Fix cache invalidation
This commit is contained in:
@@ -8,7 +8,6 @@ import android.graphics.Path;
|
|||||||
import android.graphics.RectF;
|
import android.graphics.RectF;
|
||||||
import android.graphics.Region;
|
import android.graphics.Region;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.view.ViewParent;
|
import android.view.ViewParent;
|
||||||
|
|
||||||
import com.facebook.common.logging.FLog;
|
import com.facebook.common.logging.FLog;
|
||||||
@@ -96,6 +95,7 @@ abstract public class VirtualView extends ReactViewGroup {
|
|||||||
public void invalidate() {
|
public void invalidate() {
|
||||||
super.invalidate();
|
super.invalidate();
|
||||||
clearPath();
|
clearPath();
|
||||||
|
clearPathsUpToRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearPath() {
|
private void clearPath() {
|
||||||
@@ -103,6 +103,7 @@ abstract public class VirtualView extends ReactViewGroup {
|
|||||||
canvasHeight = -1;
|
canvasHeight = -1;
|
||||||
canvasWidth = -1;
|
canvasWidth = -1;
|
||||||
fontSize = -1;
|
fontSize = -1;
|
||||||
|
mStrokeRegion = null;
|
||||||
mRegion = null;
|
mRegion = null;
|
||||||
mPath = null;
|
mPath = null;
|
||||||
}
|
}
|
||||||
@@ -117,6 +118,18 @@ abstract public class VirtualView extends ReactViewGroup {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void clearPathsUpToRoot() {
|
||||||
|
VirtualView node = this;
|
||||||
|
while (true) {
|
||||||
|
ViewParent parent = node.getParent();
|
||||||
|
if (!(parent instanceof VirtualView)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
node.clearPath();
|
||||||
|
node = (VirtualView)parent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
GroupView getTextRoot() {
|
GroupView getTextRoot() {
|
||||||
VirtualView node = this;
|
VirtualView node = this;
|
||||||
@@ -254,6 +267,7 @@ abstract public class VirtualView extends ReactViewGroup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
super.invalidate();
|
super.invalidate();
|
||||||
|
clearPathsUpToRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ReactProp(name = "responsible")
|
@ReactProp(name = "responsible")
|
||||||
@@ -465,8 +479,6 @@ abstract public class VirtualView extends ReactViewGroup {
|
|||||||
* @param pright Right position, relative to parent
|
* @param pright Right position, relative to parent
|
||||||
* @param pbottom Bottom position, relative to parent
|
* @param pbottom Bottom position, relative to parent
|
||||||
*/
|
*/
|
||||||
|
|
||||||
RectF layoutRect = new RectF();
|
|
||||||
protected void onLayout(boolean changed, int pleft, int ptop, int pright, int pbottom) {
|
protected void onLayout(boolean changed, int pleft, int ptop, int pright, int pbottom) {
|
||||||
if (mClientRect == null) {
|
if (mClientRect == null) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user