Skip to content

Commit ae798f0

Browse files
zeyapfacebook-github-bot
authored andcommitted
[skip ci] Add EventEmitterListener when ShadowNodeFamily is created (facebook#50264)
Summary: ## Changelog: [General] [Internal] - Add EventEmitterListener when ShadowNodeFamily is created Differential Revision: D71817720
1 parent 75f60a3 commit ae798f0

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

packages/react-native/ReactCommon/react/renderer/core/ConcreteComponentDescriptor.h

+4
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ class ConcreteComponentDescriptor : public ComponentDescriptor {
171171
std::make_shared<EventTarget>(
172172
fragment.instanceHandle, fragment.surfaceId),
173173
eventDispatcher_);
174+
if (ReactNativeFeatureFlags::cxxNativeAnimatedEnabled() &&
175+
fragment.eventEmitterListener) {
176+
eventEmitter->addListener(fragment.eventEmitterListener);
177+
}
174178
return std::make_shared<ShadowNodeFamily>(
175179
fragment, std::move(eventEmitter), eventDispatcher_, *this);
176180
}

packages/react-native/ReactCommon/react/renderer/core/ShadowNodeFamily.h

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ struct ShadowNodeFamilyFragment {
3333
const Tag tag;
3434
const SurfaceId surfaceId;
3535
const std::shared_ptr<const InstanceHandle> instanceHandle;
36+
const std::shared_ptr<const EventEmitterListener> eventEmitterListener;
3637
};
3738

3839
/*

packages/react-native/ReactCommon/react/renderer/mounting/ShadowTree.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ ShadowTree::ShadowTree(
179179
layoutContext);
180180

181181
auto family = globalRootComponentDescriptor->createFamily(
182-
{surfaceId, surfaceId, nullptr});
182+
{surfaceId, surfaceId, nullptr, nullptr});
183183

184184
auto rootShadowNode = std::static_pointer_cast<const RootShadowNode>(
185185
globalRootComponentDescriptor->createShadowNode(

packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ std::shared_ptr<ShadowNode> UIManager::createNode(
9292
PropsParserContext propsParserContext{surfaceId, *contextContainer_.get()};
9393

9494
auto family = componentDescriptor.createFamily(
95-
{tag, surfaceId, std::move(instanceHandle)});
95+
{tag, surfaceId, std::move(instanceHandle), eventEmitterListener_});
9696
const auto props = componentDescriptor.cloneProps(
9797
propsParserContext, nullptr, std::move(rawProps));
9898
const auto state = componentDescriptor.createInitialState(props, family);

0 commit comments

Comments
 (0)