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 *CSSNodeDEPRECATED to *ShadowView (or sth similar) as it's no longer is used solely
for layouting| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_TEXT_SHADOW_COLOR |
protected boolean |
mContainsImages |
protected int |
mFontSize |
protected float |
mFontSizeInput |
protected float |
mLineHeightInput |
protected int |
mNumberOfLines |
protected int |
mTextAlign |
protected int |
mTextBreakStrategy |
static java.lang.String |
PROP_SHADOW_COLOR |
static java.lang.String |
PROP_SHADOW_OFFSET |
static java.lang.String |
PROP_SHADOW_OFFSET_HEIGHT |
static java.lang.String |
PROP_SHADOW_OFFSET_WIDTH |
static java.lang.String |
PROP_SHADOW_RADIUS |
static java.lang.String |
PROP_TEXT |
static int |
UNSET |
| Constructor and Description |
|---|
ReactTextShadowNode() |
| Modifier and Type | Method and Description |
|---|---|
protected static android.text.Spannable |
fromTextCSSNode(ReactTextShadowNode textCSSNode) |
float |
getEffectiveLineHeight() |
boolean |
isVirtualAnchor()
Nodes that return
true will be treated as a root view for the virtual nodes tree. |
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 |
setAllowFontScaling(boolean allowFontScaling) |
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)
/* This code is duplicated in ReactTextInputManager
/* TODO: Factor into a common place they can both use
|
void |
setFontWeight(java.lang.String fontWeightString)
/* This code is duplicated in ReactTextInputManager
/* TODO: Factor into a common place they can both use
|
void |
setLineHeight(float lineHeight) |
void |
setNumberOfLines(int numberOfLines) |
void |
setText(java.lang.String text) |
void |
setTextAlign(java.lang.String textAlign) |
void |
setTextBreakStrategy(java.lang.String textBreakStrategy) |
void |
setTextDecorationLine(java.lang.String textDecorationLineString) |
void |
setTextShadowColor(int textShadowColor) |
void |
setTextShadowOffset(ReadableMap offsetMap) |
void |
setTextShadowRadius(float textShadowRadius) |
setAlignContent, setAlignItems, setAlignSelf, setAspectRatio, setBorderWidths, setDisplay, setFlex, setFlexBasis, setFlexDirection, setFlexGrow, setFlexShrink, setFlexWrap, setHeight, setJustifyContent, setMargins, setMaxHeight, setMaxWidth, setMinHeight, setMinWidth, setOverflow, setPaddings, setPosition, setPositionValues, setShouldNotifyOnLayout, setWidthaddChildAt, addNativeChildAt, calculateLayout, dirty, dispose, getChildAt, getChildCount, getLayoutDirection, getLayoutHeight, getLayoutWidth, getLayoutX, getLayoutY, getNativeChildCount, getNativeOffsetForChild, getNativeParent, getPadding, getParent, getReactTag, getRootNode, getScreenHeight, getScreenWidth, getScreenX, getScreenY, getStyleHeight, getStylePadding, getStyleWidth, getThemedContext, getTotalNativeChildren, getViewClass, hasNewLayout, hasUnseenUpdates, hasUpdates, indexOf, indexOfNativeChild, isDescendantOf, isDirty, isLayoutOnly, isVirtual, markLayoutSeen, markUpdateSeen, onAfterUpdateTransaction, removeAllNativeChildren, removeAndDisposeAllChildren, removeChildAt, removeNativeChildAt, setAlignContent, setAlignItems, setAlignSelf, setBorder, setDefaultPadding, setDisplay, setFlexBasis, setFlexBasisAuto, setFlexBasisPercent, setFlexDirection, setFlexWrap, setIsLayoutOnly, setJustifyContent, setLayoutDirection, setMargin, setMarginAuto, setMarginPercent, setMeasureFunction, setOverflow, setPadding, setPaddingPercent, setPosition, setPositionPercent, setPositionType, setReactTag, setStyleAspectRatio, setStyleHeight, setStyleHeightAuto, setStyleHeightPercent, setStyleMaxHeight, setStyleMaxHeightPercent, setStyleMaxWidth, setStyleMaxWidthPercent, setStyleMinHeight, setStyleMinHeightPercent, setStyleMinWidth, setStyleMinWidthPercent, setStyleWidth, setStyleWidthAuto, setStyleWidthPercent, setThemedContext, shouldNotifyOnLayout, toString, updatePropertiespublic static final int UNSET
public static final java.lang.String PROP_TEXT
public static final java.lang.String PROP_SHADOW_OFFSET
public static final java.lang.String PROP_SHADOW_OFFSET_WIDTH
public static final java.lang.String PROP_SHADOW_OFFSET_HEIGHT
public static final java.lang.String PROP_SHADOW_RADIUS
public static final java.lang.String PROP_SHADOW_COLOR
public static final int DEFAULT_TEXT_SHADOW_COLOR
protected int mNumberOfLines
protected int mFontSize
protected float mFontSizeInput
protected float mLineHeightInput
protected int mTextAlign
protected int mTextBreakStrategy
protected boolean mContainsImages
protected static android.text.Spannable fromTextCSSNode(ReactTextShadowNode textCSSNode)
public float getEffectiveLineHeight()
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 ReactShadowNodepublic void markUpdated()
markUpdated in class ReactShadowNodepublic void setText(@Nullable
java.lang.String text)
public void setNumberOfLines(int numberOfLines)
public void setLineHeight(float lineHeight)
public void setAllowFontScaling(boolean allowFontScaling)
public void setTextAlign(@Nullable
java.lang.String textAlign)
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 void setTextDecorationLine(@Nullable
java.lang.String textDecorationLineString)
public void setTextBreakStrategy(@Nullable
java.lang.String textBreakStrategy)
public void setTextShadowOffset(ReadableMap offsetMap)
public void setTextShadowRadius(float textShadowRadius)
public void setTextShadowColor(int textShadowColor)
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 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