perf: avoid unnecessary shared_ptr copies in Fabric components (#2164)

Ports the upstream best-practice around props handling of shared_ptr in https://github.com/facebook/react-native/commit/a855013fc6c963aca2282b6b43aeeb621eeb88d7
This commit is contained in:
Pieter De Baets
2023-10-25 11:23:14 +01:00
committed by GitHub
parent a5dae2f54d
commit 5208a2f6a7
21 changed files with 22 additions and 23 deletions
+1 -1
View File
@@ -58,7 +58,7 @@ using namespace facebook::react;
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
{
const auto &newProps = *std::static_pointer_cast<const RNSVGTSpanProps>(props);
const auto &newProps = static_cast<const RNSVGTSpanProps &>(*props);
self.content = RCTNSStringFromStringNilIfEmpty(newProps.content);
+1 -1
View File
@@ -49,7 +49,7 @@ using namespace facebook::react;
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
{
const auto &newProps = *std::static_pointer_cast<const RNSVGTextProps>(props);
const auto &newProps = static_cast<const RNSVGTextProps &>(*props);
setCommonTextProps(newProps, self);
_props = std::static_pointer_cast<RNSVGTextProps const>(props);
+1 -1
View File
@@ -39,7 +39,7 @@ using namespace facebook::react;
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
{
const auto &newProps = *std::static_pointer_cast<const RNSVGTextPathProps>(props);
const auto &newProps = static_cast<const RNSVGTextPathProps &>(*props);
self.href = RCTNSStringFromStringNilIfEmpty(newProps.href);
self.side = RCTNSStringFromStringNilIfEmpty(newProps.side);