mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-06 00:12:21 +00:00
fix #111
reset ownedPropList everytime mergeProperties method is called.
This commit is contained in:
@@ -42,7 +42,7 @@ public class RNSVGGroupShadowNode extends RNSVGPathShadowNode {
|
||||
RNSVGVirtualNode child = (RNSVGVirtualNode) getChildAt(i);
|
||||
child.setupDimensions(canvas);
|
||||
|
||||
child.mergeProperties(this, mPropList, true);
|
||||
child.mergeProperties(this, mOwnedPropList, true);
|
||||
child.draw(canvas, paint, opacity * mOpacity);
|
||||
|
||||
if (child.isResponsible()) {
|
||||
|
||||
@@ -20,7 +20,6 @@ import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.Region;
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
|
||||
import com.facebook.common.executors.UiThreadImmediateExecutorService;
|
||||
import com.facebook.common.logging.FLog;
|
||||
|
||||
@@ -72,6 +72,7 @@ public class RNSVGPathShadowNode extends RNSVGVirtualNode {
|
||||
private ArrayList<String> mChangedList;
|
||||
private ArrayList<Object> mOriginProperties;
|
||||
protected ReadableArray mPropList = new JavaOnlyArray();
|
||||
protected WritableArray mOwnedPropList = new JavaOnlyArray();
|
||||
|
||||
@ReactProp(name = "d")
|
||||
public void setPath(@Nullable ReadableArray shapePath) {
|
||||
@@ -196,8 +197,11 @@ public class RNSVGPathShadowNode extends RNSVGVirtualNode {
|
||||
|
||||
if (propList != null) {
|
||||
for (int i = 0; i < propList.size(); i++) {
|
||||
copy.pushString(propertyNameToFieldName(propList.getString(i)));
|
||||
String fieldName = propertyNameToFieldName(propList.getString(i));
|
||||
copy.pushString(fieldName);
|
||||
mOwnedPropList.pushString(fieldName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
mPropList = copy;
|
||||
@@ -404,6 +408,7 @@ public class RNSVGPathShadowNode extends RNSVGVirtualNode {
|
||||
for (int i = 0; i < mPropList.size(); i++) {
|
||||
propList.pushString(mPropList.getString(i));
|
||||
}
|
||||
mOwnedPropList = propList;
|
||||
|
||||
for (int i = 0, size = mergeList.size(); i < size; i++) {
|
||||
try {
|
||||
@@ -425,11 +430,6 @@ public class RNSVGPathShadowNode extends RNSVGVirtualNode {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
|
||||
if (inherited) {
|
||||
mPropList = propList;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -467,8 +467,8 @@ public class RNSVGPathShadowNode extends RNSVGVirtualNode {
|
||||
}
|
||||
|
||||
private boolean hasOwnProperty(String propName) {
|
||||
for (int i = mPropList.size() - 1; i >= 0; i--) {
|
||||
if (mPropList.getString(i).equals(propName)) {
|
||||
for (int i = mOwnedPropList.size() - 1; i >= 0; i--) {
|
||||
if (mOwnedPropList.getString(i).equals(propName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,13 +20,11 @@ import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.ReactRootView;
|
||||
import com.facebook.react.bridge.Arguments;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
import com.facebook.react.common.SystemClock;
|
||||
import com.facebook.react.uimanager.ThemedReactContext;
|
||||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
import com.facebook.react.uimanager.events.RCTEventEmitter;
|
||||
import com.facebook.react.uimanager.events.TouchEvent;
|
||||
|
||||
@@ -59,7 +59,7 @@ public class RNSVGUseShadowNode extends RNSVGPathShadowNode {
|
||||
int count = saveAndSetupCanvas(canvas);
|
||||
|
||||
clip(canvas, paint);
|
||||
template.mergeProperties(this, mPropList);
|
||||
template.mergeProperties(this, mOwnedPropList);
|
||||
template.draw(canvas, paint, opacity * mOpacity);
|
||||
template.resetProperties();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user