2018-05-22 22:48:24 +00:00
|
|
|
/**
|
|
|
|
* 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 "ViewEventHandlers.h"
|
|
|
|
|
|
|
|
namespace facebook {
|
|
|
|
namespace react {
|
|
|
|
|
|
|
|
#pragma mark - Accessibility
|
|
|
|
|
|
|
|
void ViewEventHandlers::onAccessibilityAction(const std::string &name) const {
|
|
|
|
dispatchEvent("accessibilityAction", folly::dynamic::object("action", name));
|
|
|
|
}
|
|
|
|
|
|
|
|
void ViewEventHandlers::onAccessibilityTap() const {
|
|
|
|
dispatchEvent("accessibilityTap");
|
|
|
|
}
|
|
|
|
|
|
|
|
void ViewEventHandlers::onAccessibilityMagicTap() const {
|
|
|
|
dispatchEvent("magicTap");
|
|
|
|
}
|
|
|
|
|
2018-05-25 01:23:13 +00:00
|
|
|
#pragma mark - Layout
|
|
|
|
|
|
|
|
void ViewEventHandlers::onLayout(const LayoutMetrics &layoutMetrics) const {
|
|
|
|
folly::dynamic payload = folly::dynamic::object();
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2018-05-22 22:48:24 +00:00
|
|
|
} // namespace react
|
|
|
|
} // namespace facebook
|