mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
3d6464d0e1
Summary: RootFlatShadowNode always mounts to a (top-level) View but was never marked as one that mounts to a View. This diff fixes it. Nothing in the code relied on it being marked as mounting to a View, so it worked fine. A follow up path that implements UIImplementation.measure() for nodes that don't mount to a View goes up until it finds first mounting node, and it was crashing with NPE because it tried to access RootFlatShadowNode's parent (and there isn't one). Reviewed By: sriramramani Differential Revision: D2800818
48 lines
1.4 KiB
Java
48 lines
1.4 KiB
Java
/**
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*/
|
|
|
|
package com.facebook.react.flat;
|
|
|
|
/**
|
|
* Root node of the shadow node hierarchy. Currently, the only node that can actually map to a View.
|
|
*/
|
|
/* package */ final class FlatRootShadowNode extends FlatShadowNode {
|
|
|
|
/* package */ FlatRootShadowNode() {
|
|
forceMountToView();
|
|
signalBackingViewIsCreated();
|
|
}
|
|
|
|
private boolean mIsUpdated;
|
|
|
|
/**
|
|
* Returns true when this CSSNode tree needs to be re-laid out. If true, FlatUIImplementation
|
|
* will request LayoutEngine to perform a layout pass to update node boundaries. This is used
|
|
* to avoid unnecessary node updates.
|
|
*/
|
|
/* package */ boolean needsLayout() {
|
|
return isDirty();
|
|
}
|
|
|
|
/**
|
|
* Returns true if there are updates to the node tree other than layout (such as a change in
|
|
* background color) that would require StateBuilder to re-collect drawing state.
|
|
*/
|
|
/* package */ boolean isUpdated() {
|
|
return mIsUpdated;
|
|
}
|
|
|
|
/**
|
|
* Marks the node tree as requiring or not requiring a StateBuilder pass to collect drawing state.
|
|
*/
|
|
/* package */ void markUpdated(boolean isUpdated) {
|
|
mIsUpdated = isUpdated;
|
|
}
|
|
}
|