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:
Родитель
dea8773c19
Коммит
eeaf0096b1
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче