mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-03 23:16:13 +00:00
Cache textRoot for getTextRootGlyphContext.
Use getTextRootGlyphContext() instead of getTextRoot().getGlyphContext() in TextShadowNode.pushGlyphContext()
This commit is contained in:
@@ -29,6 +29,7 @@ class GroupShadowNode extends RenderableShadowNode {
|
||||
@Nullable ReadableMap mFont;
|
||||
|
||||
private GlyphContext mGlyphContext;
|
||||
private GroupShadowNode textRoot;
|
||||
|
||||
@ReactProp(name = "font")
|
||||
public void setFont(@Nullable ReadableMap font) {
|
||||
@@ -47,7 +48,10 @@ class GroupShadowNode extends RenderableShadowNode {
|
||||
}
|
||||
|
||||
GlyphContext getTextRootGlyphContext() {
|
||||
return getTextRoot().getGlyphContext();
|
||||
if (textRoot == null) {
|
||||
textRoot = getTextRoot();
|
||||
}
|
||||
return textRoot.getGlyphContext();
|
||||
}
|
||||
|
||||
void pushGlyphContext() {
|
||||
|
||||
@@ -178,6 +178,6 @@ class TextShadowNode extends GroupShadowNode {
|
||||
@Override
|
||||
void pushGlyphContext() {
|
||||
boolean isTextNode = !(this instanceof TextPathShadowNode) && !(this instanceof TSpanShadowNode);
|
||||
getTextRoot().getGlyphContext().pushContext(this, mFont, mRotate, mDeltaX, mDeltaY, mPositionX, mPositionY, isTextNode);
|
||||
getTextRootGlyphContext().pushContext(this, mFont, mRotate, mDeltaX, mDeltaY, mPositionX, mPositionY, isTextNode);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user