本文整理汇总了Java中com.facebook.react.uimanager.ReactShadowNode类的典型用法代码示例。如果您正苦于以下问题:Java ReactShadowNode类的具体用法?Java ReactShadowNode怎么用?Java ReactShadowNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ReactShadowNode类属于com.facebook.react.uimanager包,在下文中一共展示了ReactShadowNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: invalidate
import com.facebook.react.uimanager.ReactShadowNode; //导入依赖的package包/类
/**
* Marks root node as updated to trigger a StateBuilder pass to collect DrawCommands for the node
* tree. Use it when FlatShadowNode is updated but doesn't require a layout pass (e.g. background
* color is changed).
*/
protected final void invalidate() {
FlatShadowNode node = this;
while (true) {
if (node.mountsToView()) {
if (node.mIsUpdated) {
// already updated
return;
}
node.mIsUpdated = true;
}
ReactShadowNode parent = node.getParent();
if (parent == null) {
// not attached to a hierarchy yet
return;
}
node = (FlatShadowNode) parent;
}
}
示例2: createRootShadowNode
import com.facebook.react.uimanager.ReactShadowNode; //导入依赖的package包/类
@Override
protected ReactShadowNode createRootShadowNode() {
if (mRCTImageViewManager != null) {
// This is not the best place to initialize DraweeRequestHelper, but order of module
// initialization is undefined, and this is pretty much the earliest when we are guarantied
// that Fresco is initalized and DraweeControllerBuilder can be queried. This also happens
// relatively rarely to have any performance considerations.
mReactContext.getNativeModule(FrescoModule.class); // initialize Fresco
DraweeRequestHelper.setDraweeControllerBuilder(
mRCTImageViewManager.getDraweeControllerBuilder());
mRCTImageViewManager = null;
}
ReactShadowNode node = new FlatRootShadowNode();
I18nUtil sharedI18nUtilInstance = I18nUtil.getInstance();
if (sharedI18nUtilInstance.isRTL(mReactContext)) {
node.setLayoutDirection(YogaDirection.RTL);
}
return node;
}
示例3: handleCreateView
import com.facebook.react.uimanager.ReactShadowNode; //导入依赖的package包/类
@Override
protected void handleCreateView(
ReactShadowNode cssNode,
int rootViewTag,
@Nullable ReactStylesDiffMap styles) {
if (cssNode instanceof FlatShadowNode) {
FlatShadowNode node = (FlatShadowNode) cssNode;
if (styles != null) {
node.handleUpdateProperties(styles);
}
if (node.mountsToView()) {
mStateBuilder.enqueueCreateOrUpdateView(node, styles);
}
} else {
super.handleCreateView(cssNode, rootViewTag, styles);
}
}
示例4: handleUpdateView
import com.facebook.react.uimanager.ReactShadowNode; //导入依赖的package包/类
@Override
protected void handleUpdateView(
ReactShadowNode cssNode,
String className,
ReactStylesDiffMap styles) {
if (cssNode instanceof FlatShadowNode) {
FlatShadowNode node = (FlatShadowNode) cssNode;
node.handleUpdateProperties(styles);
if (node.mountsToView()) {
mStateBuilder.enqueueCreateOrUpdateView(node, styles);
}
} else {
super.handleUpdateView(cssNode, className, styles);
}
}
示例5: manageChildren
import com.facebook.react.uimanager.ReactShadowNode; //导入依赖的package包/类
@Override
public void manageChildren(
int viewTag,
@Nullable ReadableArray moveFrom,
@Nullable ReadableArray moveTo,
@Nullable ReadableArray addChildTags,
@Nullable ReadableArray addAtIndices,
@Nullable ReadableArray removeFrom) {
ReactShadowNode parentNode = resolveShadowNode(viewTag);
// moveFrom and removeFrom are defined in original order before any mutations.
removeChildren(parentNode, moveFrom, moveTo, removeFrom);
// moveTo and addAtIndices are defined in final order after all the mutations applied.
addChildren(parentNode, addChildTags, addAtIndices);
}
示例6: setJSResponder
import com.facebook.react.uimanager.ReactShadowNode; //导入依赖的package包/类
@Override
public void setJSResponder(int possiblyVirtualReactTag, boolean blockNativeResponder) {
ReactShadowNode node = resolveShadowNode(possiblyVirtualReactTag);
while (node.isVirtual()) {
node = node.getParent();
}
int tag = node.getReactTag();
// if the node in question doesn't mount to a View, find the first parent that does mount to
// a View. without this, we'll crash when we try to set the JSResponder, since part of that
// is to find the parent view and ask it to not intercept touch events.
while (node instanceof FlatShadowNode && !((FlatShadowNode) node).mountsToView()) {
node = node.getParent();
}
FlatUIViewOperationQueue operationsQueue = mStateBuilder.getOperationsQueue();
operationsQueue.enqueueSetJSResponder(
node == null ? tag : node.getReactTag(),
possiblyVirtualReactTag,
blockNativeResponder);
}
示例7: addChildAt
import com.facebook.react.uimanager.ReactShadowNode; //导入依赖的package包/类
/**
* We need to set the styleWidth and styleHeight of the one child (represented by the <View/>
* within the <RCTModalHostView/> in Modal.js. This needs to fill the entire window.
*/
@Override
@TargetApi(16)
public void addChildAt(ReactShadowNode child, int i) {
super.addChildAt(child, i);
Context context = getThemedContext();
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
// getCurrentSizeRange will return the min and max width and height that the window can be
display.getCurrentSizeRange(mMinPoint, mMaxPoint);
int width, height;
int rotation = display.getRotation();
if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_180) {
// If we are vertical the width value comes from min width and height comes from max height
width = mMinPoint.x;
height = mMaxPoint.y;
} else {
// If we are horizontal the width value comes from max width and height comes from min height
width = mMaxPoint.x;
height = mMinPoint.y;
}
child.setStyleWidth(width);
child.setStyleHeight(height);
}
示例8: NativeViewWrapper
import com.facebook.react.uimanager.ReactShadowNode; //导入依赖的package包/类
NativeViewWrapper(ViewManager viewManager) {
ReactShadowNode reactShadowNode = viewManager.createShadowNodeInstance();
if (reactShadowNode instanceof YogaMeasureFunction) {
mReactShadowNode = reactShadowNode;
setMeasureFunction((YogaMeasureFunction) reactShadowNode);
} else {
mReactShadowNode = null;
}
if (viewManager instanceof ViewGroupManager) {
ViewGroupManager viewGroupManager = (ViewGroupManager) viewManager;
mNeedsCustomLayoutForChildren = viewGroupManager.needsCustomLayoutForChildren();
mForceMountGrandChildrenToView = viewGroupManager.shouldPromoteGrandchildren();
} else {
mNeedsCustomLayoutForChildren = false;
}
forceMountToView();
forceMountChildrenToView();
}
示例9: getTextRoot
import com.facebook.react.uimanager.ReactShadowNode; //导入依赖的package包/类
@android.support.annotation.Nullable
GroupShadowNode getTextRoot() {
VirtualNode node = this;
if (mTextRoot == null) {
while (node != null) {
if (node instanceof GroupShadowNode && ((GroupShadowNode) node).getGlyphContext() != null) {
mTextRoot = (GroupShadowNode)node;
break;
}
ReactShadowNode parent = node.getParent();
if (!(parent instanceof VirtualNode)) {
node = null;
} else {
node = (VirtualNode)parent;
}
}
}
return mTextRoot;
}
示例10: getSvgShadowNode
import com.facebook.react.uimanager.ReactShadowNode; //导入依赖的package包/类
SvgViewShadowNode getSvgShadowNode() {
if (mSvgShadowNode != null) {
return mSvgShadowNode;
}
ReactShadowNode parent = getParent();
if (parent instanceof SvgViewShadowNode) {
mSvgShadowNode = (SvgViewShadowNode)parent;
} else if (parent instanceof VirtualNode) {
mSvgShadowNode = ((VirtualNode) parent).getSvgShadowNode();
} else {
FLog.e(ReactConstants.TAG, "RNSVG: " + getClass().getName() + " should be descendant of a SvgViewShadow.");
}
return mSvgShadowNode;
}
示例11: getAlignmentBaseline
import com.facebook.react.uimanager.ReactShadowNode; //导入依赖的package包/类
AlignmentBaseline getAlignmentBaseline() {
if (mAlignmentBaseline == null) {
ReactShadowNode parent = this.getParent();
while (parent != null) {
if (parent instanceof TextShadowNode) {
TextShadowNode node = (TextShadowNode)parent;
final AlignmentBaseline baseline = node.mAlignmentBaseline;
if (baseline != null) {
mAlignmentBaseline = baseline;
return baseline;
}
}
parent = parent.getParent();
}
}
if (mAlignmentBaseline == null) {
mAlignmentBaseline = AlignmentBaseline.baseline;
}
return mAlignmentBaseline;
}
示例12: getBaselineShift
import com.facebook.react.uimanager.ReactShadowNode; //导入依赖的package包/类
String getBaselineShift() {
if (mBaselineShift == null) {
ReactShadowNode parent = this.getParent();
while (parent != null) {
if (parent instanceof TextShadowNode) {
TextShadowNode node = (TextShadowNode)parent;
final String baselineShift = node.mBaselineShift;
if (baselineShift != null) {
mBaselineShift = baselineShift;
return baselineShift;
}
}
parent = parent.getParent();
}
}
return mBaselineShift;
}
示例13: forceMountChildrenToView
import com.facebook.react.uimanager.ReactShadowNode; //导入依赖的package包/类
final void forceMountChildrenToView() {
if (mForceMountChildrenToView) {
return;
}
mForceMountChildrenToView = true;
for (int i = 0, childCount = getChildCount(); i != childCount; ++i) {
ReactShadowNode child = getChildAt(i);
if (child instanceof FlatShadowNode) {
((FlatShadowNode) child).forceMountToView();
}
}
}
示例14: addChildAt
import com.facebook.react.uimanager.ReactShadowNode; //导入依赖的package包/类
@Override
public void addChildAt(ReactShadowNode child, int i) {
super.addChildAt(child, i);
if (mForceMountChildrenToView && child instanceof FlatShadowNode) {
((FlatShadowNode) child).forceMountToView();
}
}
示例15: createShadowNode
import com.facebook.react.uimanager.ReactShadowNode; //导入依赖的package包/类
@Override
protected ReactShadowNode createShadowNode(String className) {
ReactShadowNode cssNode = super.createShadowNode(className);
if (cssNode instanceof FlatShadowNode || cssNode.isVirtual()) {
return cssNode;
}
ViewManager viewManager = resolveViewManager(className);
return new NativeViewWrapper(viewManager);
}