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 {
|
|
|
|
#ifdef ANDROID
|
|
|
|
// This feature is not properly tested on Android yet.
|
|
|
|
return false;
|
|
|
|
#else
|
|
|
|
const auto &viewProps = *std::static_pointer_cast<const ViewProps>(props_);
|
|
|
|
|
|
|
|
return
|
|
|
|
// 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 {};
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2018-03-18 19:04:25 -07:00
|
|
|
} // namespace react
|
|
|
|
} // namespace facebook
|