File tree Expand file tree Collapse file tree 4 files changed +9
-46
lines changed
packages/react-native/ReactCommon/react/renderer Expand file tree Collapse file tree 4 files changed +9
-46
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -155,15 +155,14 @@ void UIManagerBinding::dispatchEventToJS(
155155 LOG (WARNING) << " instanceHandle is null, event will be dropped" ;
156156 }
157157
158- auto & eventHandlerWrapper =
159- static_cast <const EventHandlerWrapper&>(*eventHandler_);
160-
161158 currentEventPriority_ = priority;
162- eventHandlerWrapper.callback .call (
163- runtime,
164- {std::move (instanceHandle),
165- jsi::String::createFromUtf8 (runtime, type),
166- std::move (payload)});
159+ if (eventHandler_) {
160+ eventHandler_->call (
161+ runtime,
162+ std::move (instanceHandle),
163+ jsi::String::createFromUtf8 (runtime, type),
164+ std::move (payload));
165+ }
167166 currentEventPriority_ = ReactEventPriority::Default;
168167}
169168
@@ -545,7 +544,7 @@ jsi::Value UIManagerBinding::get(
545544 auto eventHandler =
546545 arguments[0 ].getObject (runtime).getFunction (runtime);
547546 eventHandler_ =
548- std::make_unique<EventHandlerWrapper >(std::move (eventHandler));
547+ std::make_unique<jsi::Function >(std::move (eventHandler));
549548 return jsi::Value::undefined ();
550549 });
551550 }
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ class UIManagerBinding : public jsi::HostObject {
8484 const EventPayload& payload) const ;
8585
8686 std::shared_ptr<UIManager> uiManager_;
87- std::unique_ptr<const EventHandler > eventHandler_;
87+ std::unique_ptr<jsi::Function > eventHandler_;
8888 mutable PointerEventsProcessor pointerEventsProcessor_;
8989 mutable ReactEventPriority currentEventPriority_;
9090};
Original file line number Diff line number Diff line change 1212#include < jsi/jsi.h>
1313#include < react/debug/react_native_assert.h>
1414#include < react/renderer/components/text/RawTextShadowNode.h>
15- #include < react/renderer/core/EventHandler.h>
1615#include < react/renderer/core/LayoutMetrics.h>
1716#include < react/renderer/core/ShadowNode.h>
1817#include < react/renderer/core/TraitCast.h>
@@ -23,13 +22,6 @@ namespace facebook::react {
2322using BackgroundExecutor =
2423 std::function<void (std::function<void ()>&& callback)>;
2524
26- struct EventHandlerWrapper : public EventHandler {
27- EventHandlerWrapper (jsi::Function eventHandler)
28- : callback(std::move(eventHandler)) {}
29-
30- jsi::Function callback;
31- };
32-
3325struct ShadowNodeListWrapper : public jsi ::NativeState {
3426 ShadowNodeListWrapper (ShadowNode::UnsharedListOfShared shadowNodeList)
3527 : shadowNodeList(std::move(shadowNodeList)) {}
You can’t perform that action at this time.
0 commit comments