Valentin Shergin 6942408a47 Fabric: Dispatching onLayout events to only nodes which requested it
Summary:
@public
The current Fabric architecture, in general, does not support "subscribing" for events, so all kinds of events are always delivered no matter have JavaScript components `on`-handlers for them or not.
At this point, we are not sure should it be this way or not. But we are sure that for some extremely noisy events (like onLayout) we have to make an exception right now (otherwise overall performance will suffer).
So, this diff implements that for `onLayout`.

Reviewed By: fkgozali

Differential Revision: D8597408

fbshipit-source-id: 6933b7cb96e24f0660bd7850b625ff27e3146a2b
2018-06-22 18:46:39 -07:00

72 lines
1.6 KiB
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.
*/
#pragma once
#include <fabric/core/Props.h>
#include <fabric/graphics/Geometry.h>
#include <fabric/graphics/Color.h>
#include <fabric/view/AccessibilityProps.h>
#include <fabric/view/primitives.h>
#include <fabric/view/YogaStylableProps.h>
namespace facebook {
namespace react {
class ViewProps;
using SharedViewProps = std::shared_ptr<const ViewProps>;
class ViewProps:
public Props,
public YogaStylableProps,
public AccessibilityProps {
public:
ViewProps() = default;
ViewProps(const YGStyle &yogaStyle);
ViewProps(const ViewProps &sourceProps, const RawProps &rawProps);
#pragma mark - Props
// Color
const Float opacity {1};
const SharedColor foregroundColor {nullptr};
const SharedColor backgroundColor {nullptr};
// Borders
const EdgeInsets borderWidth {};
const CornerInsets borderRadius {};
const SharedColor borderColor {};
const BorderStyle borderStyle {};
// Shadow
const SharedColor shadowColor {nullptr};
const Size shadowOffset {};
const Float shadowOpacity {};
const Float shadowRadius {};
// Transform
const Transform transform {};
const bool backfaceVisibility {false};
const bool shouldRasterize {false};
const int zIndex {0};
// Events
const PointerEventsMode pointerEvents {};
const EdgeInsets hitSlop {};
const bool onLayout {false};
#pragma mark - DebugStringConvertible
SharedDebugStringConvertibleList getDebugProps() const override;
};
} // namespace react
} // namespace facebook