mirror of
https://github.com/status-im/react-native.git
synced 2025-01-17 21:11:45 +00:00
eabf29e320
Summary: @public After reading about move-semantic and rvalue refs I realized that we (I) definitely overuse `auto &&` (aka universal reference) construction. Even if this is harmless, does not look good and idiomatic. Whenever I used that from a semantical point of view I always meant "I need an alias for this" which is actually "read-only reference" which is `const auto &`. This is also fit good to our policy where "everything is const (immutable) by default". Hence I change that to how it should be. Reviewed By: fkgozali Differential Revision: D8475637 fbshipit-source-id: 0a691ededa0e798db8ffa053bff0f400913ab7b8
42 lines
1015 B
C++
42 lines
1015 B
C++
/**
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#include "ScrollViewShadowNode.h"
|
|
|
|
#include <fabric/core/LayoutMetrics.h>
|
|
|
|
#include "ScrollViewLocalData.h"
|
|
|
|
namespace facebook {
|
|
namespace react {
|
|
|
|
ComponentName ScrollViewShadowNode::getComponentName() const {
|
|
return ComponentName("ScrollView");
|
|
}
|
|
|
|
void ScrollViewShadowNode::updateLocalData() {
|
|
ensureUnsealed();
|
|
|
|
Rect contentBoundingRect;
|
|
for (const auto &childNode : getLayoutableChildNodes()) {
|
|
contentBoundingRect.unionInPlace(childNode->getLayoutMetrics().frame);
|
|
}
|
|
|
|
const auto &localData = std::make_shared<const ScrollViewLocalData>(contentBoundingRect);
|
|
setLocalData(localData);
|
|
}
|
|
|
|
#pragma mark - LayoutableShadowNode
|
|
|
|
void ScrollViewShadowNode::layout(LayoutContext layoutContext) {
|
|
ConcreteViewShadowNode::layout(layoutContext);
|
|
updateLocalData();
|
|
}
|
|
|
|
} // namespace react
|
|
} // namespace facebook
|