diff --git a/ReactCommon/fabric/core/events/EventPrimitives.h b/ReactCommon/fabric/core/events/EventPrimitives.h index 46b715796..5dc5cb5d6 100644 --- a/ReactCommon/fabric/core/events/EventPrimitives.h +++ b/ReactCommon/fabric/core/events/EventPrimitives.h @@ -22,11 +22,15 @@ enum class EventPriority { Deferred = AsynchronousBatched, }; -// `InstanceHandler`, `EventTarget`, and `EventHandler` are all opaque -// raw pointers. We use `struct {} *` trick to differentiate them in compiler's -// eyes to ensure type safety. -using EventTarget = struct {} *; -using EventHandler = struct {} *; +/* `InstanceHandler`, `EventTarget`, and `EventHandler` are all opaque + * raw pointers. We use `struct {} *` trick to differentiate them in compiler's + * eyes to ensure type safety. + * These structs must have names (and the names must be exported) + * to allow consistent template (e.g. `std::function`) instantiating + * across different modules. + */ +using EventTarget = struct EventTargetDummyStruct {} *; +using EventHandler = struct EventHandlerDummyStruct {} *; } // namespace react } // namespace facebook diff --git a/ReactCommon/fabric/core/primitives/ReactPrimitives.h b/ReactCommon/fabric/core/primitives/ReactPrimitives.h index 0b5004ab2..c81f0ac93 100644 --- a/ReactCommon/fabric/core/primitives/ReactPrimitives.h +++ b/ReactCommon/fabric/core/primitives/ReactPrimitives.h @@ -19,7 +19,7 @@ namespace react { * `Tag` and `InstanceHandle` are used to address React Native components. */ using Tag = int32_t; -using InstanceHandle = void *; +using InstanceHandle = struct InstanceHandleDummyStruct {} *; /* * `RawProps` represents untyped map with props comes from JavaScript side. diff --git a/ReactCommon/fabric/uimanager/FabricUIManager.cpp b/ReactCommon/fabric/uimanager/FabricUIManager.cpp index 94b630c74..7bedbfc8e 100644 --- a/ReactCommon/fabric/uimanager/FabricUIManager.cpp +++ b/ReactCommon/fabric/uimanager/FabricUIManager.cpp @@ -78,7 +78,7 @@ FabricUIManager::FabricUIManager(SharedComponentDescriptorRegistry componentDesc FabricUIManager::~FabricUIManager() { if (eventHandler_) { - releaseEventTargetFunction_(eventHandler_); + releaseEventHandlerFunction_(eventHandler_); } } @@ -106,11 +106,11 @@ void FabricUIManager::setReleaseEventHandlerFunction(std::function createEventTargetFunction_; std::function dispatchEventFunction_; std::function releaseEventTargetFunction_;