Fabric: Migrating SwitchEventEmitter to JSI-based payload

Summary: Pretty straight-forward migration to using `JSI` instead of `folly::dynamic` in SwitchEventEmitter.

Reviewed By: sahrens

Differential Revision: D13123046

fbshipit-source-id: f2e4905a96191540ceec633bae1871c93be724db
This commit is contained in:
Valentin Shergin 2018-11-27 20:58:28 -08:00 коммит произвёл Facebook Github Bot
Родитель dea8773c19
Коммит eeaf0096b1
2 изменённых файлов: 7 добавлений и 3 удалений

Просмотреть файл

@ -10,8 +10,12 @@
namespace facebook {
namespace react {
void SwitchEventEmitter::onChange(const bool &value) const {
dispatchEvent("change", folly::dynamic::object("value", value));
void SwitchEventEmitter::onChange(bool value) const {
dispatchEvent("change", [value](jsi::Runtime &runtime) {
auto payload = jsi::Object(runtime);
payload.setProperty(runtime, "value", value);
return payload;
});
}
} // namespace react

Просмотреть файл

@ -15,7 +15,7 @@ class SwitchEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
void onChange(const bool &value) const;
void onChange(bool value) const;
};
} // namespace react