mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-06 16:32:24 +00:00
Ensure that getTextRoot and getGlyphContext works correctly independent of if it is wrapped by a G element or not
This commit is contained in:
@@ -39,11 +39,20 @@ public class GroupShadowNode extends RenderableShadowNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected GroupShadowNode getTextRoot() {
|
protected GroupShadowNode getTextRoot() {
|
||||||
|
GroupShadowNode shadowNode = getShadowNode(GroupShadowNode.class);
|
||||||
|
if (shadowNode == null) {
|
||||||
|
return getShadowNode(TextShadowNode.class);
|
||||||
|
}
|
||||||
|
return shadowNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@android.support.annotation.Nullable
|
||||||
|
private GroupShadowNode getShadowNode(Class shadowNodeClass) {
|
||||||
if (mTextRoot == null) {
|
if (mTextRoot == null) {
|
||||||
mTextRoot = this;
|
mTextRoot = this;
|
||||||
|
|
||||||
while (mTextRoot != null) {
|
while (mTextRoot != null) {
|
||||||
if (mTextRoot.getClass() == GroupShadowNode.class) {
|
if (mTextRoot.getClass() == shadowNodeClass) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,6 +75,9 @@ public class GroupShadowNode extends RenderableShadowNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected GlyphContext getGlyphContext() {
|
protected GlyphContext getGlyphContext() {
|
||||||
|
if (mGlyphContext == null) {
|
||||||
|
setupGlyphContext();
|
||||||
|
}
|
||||||
return mGlyphContext;
|
return mGlyphContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user