2018-03-18 19:04:25 -07:00
|
|
|
/**
|
2018-09-11 15:27:47 -07:00
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
2018-03-18 19:04:25 -07:00
|
|
|
*
|
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ViewShadowNode.h"
|
|
|
|
|
|
|
|
namespace facebook {
|
|
|
|
namespace react {
|
|
|
|
|
2018-08-04 09:30:13 -07:00
|
|
|
const char ViewComponentName[] = "View";
|
2018-03-18 19:04:25 -07:00
|
|
|
|
2018-09-30 22:01:51 -07:00
|
|
|
bool ViewShadowNode::isLayoutOnly() const {
|
|
|
|
const auto &viewProps = *std::static_pointer_cast<const ViewProps>(props_);
|
|
|
|
|
2018-11-02 12:42:34 -07:00
|
|
|
return viewProps.collapsable &&
|
2018-10-05 11:01:08 -07:00
|
|
|
// Event listeners
|
|
|
|
!viewProps.onLayout &&
|
|
|
|
// Generic Props
|
|
|
|
viewProps.nativeId.empty() &&
|
|
|
|
// Accessibility Props
|
|
|
|
!viewProps.accessible &&
|
|
|
|
// Style Props
|
|
|
|
viewProps.yogaStyle.overflow == YGOverflowVisible &&
|
|
|
|
viewProps.opacity == 1.0 && !viewProps.backgroundColor &&
|
|
|
|
!viewProps.foregroundColor && !viewProps.shadowColor &&
|
|
|
|
viewProps.transform == Transform{} && viewProps.zIndex == 0 &&
|
|
|
|
// Layout Metrics
|
|
|
|
getLayoutMetrics().borderWidth == EdgeInsets{};
|
2018-09-30 22:01:51 -07:00
|
|
|
}
|
|
|
|
|
2018-03-18 19:04:25 -07:00
|
|
|
} // namespace react
|
|
|
|
} // namespace facebook
|