public class ReactTextShadowNode extends LayoutShadowNode
ReactShadowNode class for spannable text view.
This node calculates Spannable based on subnodes of the same type and passes the
resulting object down to textview's shadowview and actual native TextView instance. It is
important to keep in mind that Spannable is calculated only on layout step, so if there
are any text properties that may/should affect the result of Spannable they should be set
in a corresponding ReactTextShadowNode. Resulting Spannable object is then then
passed as "computedDataFromMeasure" down to shadow and native view.
TODO(7255858): Rename *CSSNode to *ShadowView (or sth similar) as it's no longer is used solely
for layoutingCSSNode.MeasureFunction| Modifier and Type | Field and Description |
|---|---|
protected boolean |
mContainsImages |
protected int |
mFontSize |
protected int |
mNumberOfLines |
static java.lang.String |
PROP_TEXT |
static int |
UNSET |
| Constructor and Description |
|---|
ReactTextShadowNode(boolean isVirtual) |
| Modifier and Type | Method and Description |
|---|---|
protected static android.text.Spannable |
fromTextCSSNode(ReactTextShadowNode textCSSNode) |
boolean |
isVirtual()
Nodes that return
true will be treated as "virtual" nodes. |
boolean |
isVirtualAnchor()
Nodes that return
true will be treated as a root view for the virtual nodes tree. |
protected void |
markUpdated() |
void |
onBeforeLayout()
This method will be called by
UIManagerModule once per batch, before calculating
layout. |
void |
onCollectExtraUpdates(UIViewOperationQueue uiViewOperationQueue)
Called after layout step at the end of the UI batch from
UIManagerModule. |
void |
setBackgroundColor(java.lang.Integer color) |
void |
setColor(java.lang.Integer color) |
void |
setFontFamily(java.lang.String fontFamily) |
void |
setFontSize(float fontSize) |
void |
setFontStyle(java.lang.String fontStyleString) |
void |
setFontWeight(java.lang.String fontWeightString) |
void |
setLineHeight(int lineHeight) |
void |
setNumberOfLines(int numberOfLines) |
void |
setText(java.lang.String text) |
setAlignItems, setAlignSelf, setBorderWidths, setBottom, setFlex, setFlexDirection, setFlexWrap, setHeight, setJustifyContent, setLeft, setMargins, setPaddings, setPosition, setRight, setShouldNotifyOnLayout, setTop, setWidthaddChildAt, addNativeChildAt, dirty, getChildAt, getNativeChildCount, getNativeOffsetForChild, getNativeParent, getParent, getReactTag, getRootNode, getScreenHeight, getScreenWidth, getScreenX, getScreenY, getThemedContext, getTotalNativeChildren, getViewClass, hasUpdates, indexOfNativeChild, isLayoutOnly, markUpdateSeen, onAfterUpdateTransaction, removeAllChildren, removeAllNativeChildren, removeChildAt, removeNativeChildAt, setIsLayoutOnly, setThemedContext, updatePropertiescalculateLayout, getAlignItems, getAlignSelf, getBorder, getChildCount, getFlex, getFlexDirection, getJustifyContent, getLayoutDirection, getLayoutHeight, getLayoutWidth, getLayoutX, getLayoutY, getMargin, getPadding, getPositionBottom, getPositionLeft, getPositionRight, getPositionTop, getPositionType, getStyleDirection, getStyleHeight, getStyleWidth, hasNewLayout, indexOf, isDirty, isMeasureDefined, markLayoutSeen, reset, setAlignItems, setAlignSelf, setBorder, setDefaultPadding, setDirection, setFlexDirection, setJustifyContent, setMargin, setMeasureFunction, setPadding, setPositionBottom, setPositionLeft, setPositionRight, setPositionTop, setPositionType, setStyleHeight, setStyleWidth, setWrap, toString, valuesEqualpublic static final int UNSET
public static final java.lang.String PROP_TEXT
protected int mNumberOfLines
protected int mFontSize
protected boolean mContainsImages
protected static final android.text.Spannable fromTextCSSNode(ReactTextShadowNode textCSSNode)
public void onBeforeLayout()
ReactShadowNodeUIManagerModule once per batch, before calculating
layout. Will be only called for nodes that are marked as updated with ReactShadowNode.markUpdated()
or require layouting (marked with ReactShadowNode.dirty()).onBeforeLayout in class ReactShadowNodeprotected void markUpdated()
markUpdated in class ReactShadowNodepublic void setText(@Nullable
java.lang.String text)
public void setNumberOfLines(int numberOfLines)
public void setLineHeight(int lineHeight)
public void setFontSize(float fontSize)
public void setColor(@Nullable
java.lang.Integer color)
public void setBackgroundColor(java.lang.Integer color)
public void setFontFamily(@Nullable
java.lang.String fontFamily)
public void setFontWeight(@Nullable
java.lang.String fontWeightString)
public void setFontStyle(@Nullable
java.lang.String fontStyleString)
public boolean isVirtualAnchor()
ReactShadowNodetrue will be treated as a root view for the virtual nodes tree. It
means that NativeViewHierarchyManager will not try to perform manageChildren
operation on such views. Good example is InputText view that may have children
Text nodes but this whole hierarchy will be mapped to a single android EditText
view.isVirtualAnchor in class ReactShadowNodepublic boolean isVirtual()
ReactShadowNodetrue will be treated as "virtual" nodes. That is, nodes that are not
mapped into native views (e.g. nested text node). By default this method returns false.isVirtual in class ReactShadowNodepublic void onCollectExtraUpdates(UIViewOperationQueue uiViewOperationQueue)
ReactShadowNodeUIManagerModule. May be used
to enqueue additional ui operations for the native view. Will only be called on nodes marked
as updated either with ReactShadowNode.dirty() or ReactShadowNode.markUpdated().onCollectExtraUpdates in class ReactShadowNodeuiViewOperationQueue - interface for enqueueing UI operations