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 layoutingCSSNodeAPI.MeasureFunction
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_TEXT_SHADOW_COLOR |
protected boolean |
mContainsImages |
protected int |
mFontSize |
protected int |
mNumberOfLines |
protected int |
mTextAlign |
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(boolean isVirtual) |
Modifier and Type | Method and Description |
---|---|
protected static android.text.Spannable |
fromTextCSSNode(ReactTextShadowNode textCSSNode) |
float |
getEffectiveLineHeight() |
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. |
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)
/* 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(int lineHeight) |
void |
setNumberOfLines(int numberOfLines) |
void |
setText(java.lang.String text) |
void |
setTextAlign(java.lang.String textAlign) |
void |
setTextDecorationLine(java.lang.String textDecorationLineString) |
void |
setTextShadowColor(int textShadowColor) |
void |
setTextShadowOffset(ReadableMap offsetMap) |
void |
setTextShadowRadius(float textShadowRadius) |
setAlignItems, setAlignSelf, setBorderWidths, setFlex, setFlexBasis, setFlexDirection, setFlexGrow, setFlexShrink, setFlexWrap, setHeight, setJustifyContent, setMargins, setMaxHeight, setMaxWidth, setMinHeight, setMinWidth, setPaddings, setPosition, setPositionValues, setShouldNotifyOnLayout, setWidth
addChildAt, addNativeChildAt, dirty, getChildAt, getNativeChildCount, getNativeOffsetForChild, getNativeParent, getParent, getReactTag, getRootNode, getScreenHeight, getScreenWidth, getScreenX, getScreenY, getThemedContext, getTotalNativeChildren, getViewClass, hasUnseenUpdates, hasUpdates, indexOfNativeChild, isLayoutOnly, markUpdateSeen, onAfterUpdateTransaction, removeAllChildren, removeAllNativeChildren, removeChildAt, removeNativeChildAt, setDefaultPadding, setIsLayoutOnly, setPadding, setThemedContext, shouldNotifyOnLayout, updateProperties
calculateLayout, getAlignContent, getAlignItems, getAlignSelf, getBorder, getChildCount, getData, getFlex, getFlexBasis, getFlexDirection, getFlexGrow, getFlexShrink, getJustifyContent, getLayoutDirection, getLayoutHeight, getLayoutWidth, getLayoutX, getLayoutY, getMargin, getOverflow, getPadding, getPosition, getPositionType, getStyleDirection, getStyleHeight, getStyleMaxHeight, getStyleMaxWidth, getStyleMinHeight, getStyleMinWidth, getStyleWidth, hasNewLayout, indexOf, init, isDirty, isMeasureDefined, isTextNode, markLayoutSeen, reset, setAlignContent, setAlignItems, setAlignSelf, setBorder, setData, setDirection, setFlexDirection, setIsTextNode, setJustifyContent, setMargin, setMeasureFunction, setOverflow, setPosition, setPositionType, setStyleHeight, setStyleMaxHeight, setStyleMaxWidth, setStyleMinHeight, setStyleMinWidth, setStyleWidth, setWrap, toString, valuesEqual
public 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 int mTextAlign
protected boolean mContainsImages
protected static android.text.Spannable fromTextCSSNode(ReactTextShadowNode textCSSNode)
public float getEffectiveLineHeight()
public void onBeforeLayout()
ReactShadowNode
UIManagerModule
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 ReactShadowNode
public void markUpdated()
markUpdated
in class ReactShadowNode
public void setText(@Nullable java.lang.String text)
public void setNumberOfLines(int numberOfLines)
public void setLineHeight(int lineHeight)
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 setTextShadowOffset(ReadableMap offsetMap)
public void setTextShadowRadius(float textShadowRadius)
public void setTextShadowColor(int textShadowColor)
public boolean isVirtualAnchor()
ReactShadowNode
true
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 ReactShadowNode
public boolean isVirtual()
ReactShadowNode
true
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 ReactShadowNode
public void onCollectExtraUpdates(UIViewOperationQueue uiViewOperationQueue)
ReactShadowNode
UIManagerModule
. 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 ReactShadowNode
uiViewOperationQueue
- interface for enqueueing UI operations