mirror of
https://github.com/status-im/react-native.git
synced 2025-02-24 23:28:12 +00:00
Summary: All code styles are terribly ugly. We have the only choise - choise something and embrace it. This particular code style was borrowed from a neibour Fabric-friendly project because it follows established Facebook guides and respects client-side traditions. Reviewed By: mdvacca Differential Revision: D10218598 fbshipit-source-id: 8c4cf6713c07768566dadef479191661c79988f0
41 lines
1.0 KiB
C++
41 lines
1.0 KiB
C++
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#include "ViewEventEmitter.h"
|
|
|
|
namespace facebook {
|
|
namespace react {
|
|
|
|
#pragma mark - Accessibility
|
|
|
|
void ViewEventEmitter::onAccessibilityAction(const std::string &name) const {
|
|
dispatchEvent("accessibilityAction", folly::dynamic::object("action", name));
|
|
}
|
|
|
|
void ViewEventEmitter::onAccessibilityTap() const {
|
|
dispatchEvent("accessibilityTap");
|
|
}
|
|
|
|
void ViewEventEmitter::onAccessibilityMagicTap() const {
|
|
dispatchEvent("magicTap");
|
|
}
|
|
|
|
#pragma mark - Layout
|
|
|
|
void ViewEventEmitter::onLayout(const LayoutMetrics &layoutMetrics) const {
|
|
folly::dynamic payload = folly::dynamic::object();
|
|
const auto &frame = layoutMetrics.frame;
|
|
payload["layout"] =
|
|
folly::dynamic::object("x", frame.origin.x)("y", frame.origin.y)(
|
|
"width", frame.size.width)("height", frame.size.height);
|
|
|
|
dispatchEvent("layout", payload);
|
|
}
|
|
|
|
} // namespace react
|
|
} // namespace facebook
|