diff --git a/packages/react-native/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp b/packages/react-native/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp index cb94ab0bed19c9..1aa2de1d98e5d5 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp @@ -368,7 +368,7 @@ void YogaLayoutableShadowNode::updateYogaChildren() { void YogaLayoutableShadowNode::updateYogaProps() { ensureUnsealed(); - auto props = static_cast(*props_); + auto& props = static_cast(*props_); auto styleResult = applyAliasedProps(props.yogaStyle, props); // Resetting `dirty` flag only if `yogaStyle` portion of `Props` was changed. diff --git a/packages/react-native/ReactCommon/react/renderer/core/ConcreteShadowNode.h b/packages/react-native/ReactCommon/react/renderer/core/ConcreteShadowNode.h index e91c757d8d77e0..14c3e9ac481833 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/ConcreteShadowNode.h +++ b/packages/react-native/ReactCommon/react/renderer/core/ConcreteShadowNode.h @@ -76,7 +76,8 @@ class ConcreteShadowNode : public BaseShadowNodeT { const Props::Shared& baseProps = nullptr) { return std::make_shared( context, - baseProps ? static_cast(*baseProps) : PropsT(), + baseProps ? static_cast(*baseProps) + : *defaultSharedProps(), rawProps); } diff --git a/packages/react-native/ReactCommon/react/renderer/core/Props.h b/packages/react-native/ReactCommon/react/renderer/core/Props.h index 6b25617d2d362f..b17a54541ee27b 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/Props.h +++ b/packages/react-native/ReactCommon/react/renderer/core/Props.h @@ -36,6 +36,9 @@ class Props : public virtual Sealable, public virtual DebugStringConvertible { const RawProps& rawProps); virtual ~Props() = default; + Props(const Props& other) = delete; + Props& operator=(const Props& other) = delete; + /** * Set a prop value via iteration (see enableIterator above). * If setProp is defined for a particular props struct, it /must/ diff --git a/packages/react-native/ReactCommon/react/renderer/uimanager/PointerEventsProcessor.cpp b/packages/react-native/ReactCommon/react/renderer/uimanager/PointerEventsProcessor.cpp index d1f48491f43dee..cdb83add952f2a 100644 --- a/packages/react-native/ReactCommon/react/renderer/uimanager/PointerEventsProcessor.cpp +++ b/packages/react-native/ReactCommon/react/renderer/uimanager/PointerEventsProcessor.cpp @@ -33,9 +33,7 @@ static bool isViewListeningToEvents( const ShadowNode& shadowNode, std::initializer_list eventTypes) { if (shadowNode.getTraits().check(ShadowNodeTraits::Trait::ViewKind)) { - auto props = shadowNode.getProps(); - auto viewProps = static_cast(*props); - + auto& viewProps = static_cast(*shadowNode.getProps()); for (const ViewEvents::Offset eventType : eventTypes) { if (viewProps.events[eventType]) { return true;