mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Revert "Use RN_SERIALIZABLE_STATE for conditional getDiffProps code (#51516)"
This reverts commit f900551216.
This commit is contained in:
@@ -174,7 +174,7 @@ void ImageProps::setProp(
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#ifdef ANDROID
|
||||
|
||||
static folly::dynamic convertImageSource(const ImageSource& imageSource) {
|
||||
folly::dynamic imageSourceResult = folly::dynamic::object();
|
||||
|
||||
@@ -46,8 +46,10 @@ class ImageProps final : public ViewProps {
|
||||
Float fadeDuration{};
|
||||
bool progressiveRenderingEnabled{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#ifdef ANDROID
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -592,7 +592,7 @@ SharedDebugStringConvertibleList ScrollViewProps::getDebugProps() const {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#ifdef ANDROID
|
||||
|
||||
static folly::dynamic convertScrollViewMaintainVisibleContentPosition(
|
||||
const ScrollViewMaintainVisibleContentPosition& value) {
|
||||
|
||||
+3
-1
@@ -83,8 +83,10 @@ class ScrollViewProps final : public ViewProps {
|
||||
SharedDebugStringConvertibleList getDebugProps() const override;
|
||||
#endif
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#ifdef ANDROID
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -357,7 +357,7 @@ SharedDebugStringConvertibleList BaseTextProps::getDebugProps() const {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#ifdef ANDROID
|
||||
|
||||
static folly::dynamic toDynamic(const Size& size) {
|
||||
folly::dynamic sizeResult = folly::dynamic::object();
|
||||
|
||||
@@ -42,10 +42,12 @@ class BaseTextProps {
|
||||
SharedDebugStringConvertibleList getDebugProps() const;
|
||||
#endif
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#ifdef ANDROID
|
||||
|
||||
void appendTextAttributesProps(
|
||||
folly::dynamic& result,
|
||||
const BaseTextProps* prevProps) const;
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ SharedDebugStringConvertibleList ParagraphProps::getDebugProps() const {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#ifdef ANDROID
|
||||
|
||||
folly::dynamic ParagraphProps::getDiffProps(const Props* prevProps) const {
|
||||
static const auto defaultProps = ParagraphProps();
|
||||
|
||||
@@ -58,8 +58,10 @@ class ParagraphProps : public ViewProps, public BaseTextProps {
|
||||
SharedDebugStringConvertibleList getDebugProps() const override;
|
||||
#endif
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#ifdef ANDROID
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ SharedDebugStringConvertibleList RawTextProps::getDebugProps() const {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#ifdef ANDROID
|
||||
|
||||
folly::dynamic RawTextProps::getDiffProps(const Props* prevProps) const {
|
||||
folly::dynamic result = folly::dynamic::object();
|
||||
|
||||
@@ -37,8 +37,10 @@ class RawTextProps : public Props {
|
||||
SharedDebugStringConvertibleList getDebugProps() const override;
|
||||
#endif
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#ifdef ANDROID
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ SharedDebugStringConvertibleList TextProps::getDebugProps() const {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#ifdef ANDROID
|
||||
|
||||
folly::dynamic TextProps::getDiffProps(const Props* prevProps) const {
|
||||
folly::dynamic result = folly::dynamic::object();
|
||||
|
||||
@@ -35,8 +35,10 @@ class TextProps : public Props, public BaseTextProps {
|
||||
SharedDebugStringConvertibleList getDebugProps() const override;
|
||||
#endif
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#ifdef ANDROID
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
+1
-3
@@ -17,8 +17,7 @@ ComponentName UnimplementedViewProps::getComponentName() const {
|
||||
return componentName_;
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
|
||||
#ifdef ANDROID
|
||||
folly::dynamic UnimplementedViewProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = UnimplementedViewProps();
|
||||
@@ -35,7 +34,6 @@ folly::dynamic UnimplementedViewProps::getDiffProps(
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace facebook::react
|
||||
|
||||
+3
-1
@@ -27,8 +27,10 @@ class UnimplementedViewProps final : public ViewProps {
|
||||
void setComponentName(ComponentName componentName);
|
||||
ComponentName getComponentName() const;
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#ifdef ANDROID
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
+1
-1
@@ -144,7 +144,7 @@ SharedDebugStringConvertibleList HostPlatformViewProps::getDebugProps() const {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#ifdef ANDROID
|
||||
|
||||
inline static void updateEventProp(
|
||||
folly::dynamic& result,
|
||||
|
||||
+3
-1
@@ -57,8 +57,10 @@ class HostPlatformViewProps : public BaseViewProps {
|
||||
SharedDebugStringConvertibleList getDebugProps() const override;
|
||||
#endif
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#ifdef ANDROID
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ class ConcreteComponentDescriptor : public ComponentDescriptor {
|
||||
// Note that we just check if `Props` has this flag set, no matter
|
||||
// the type of ShadowNode; it acts as the single global flag.
|
||||
if (ReactNativeFeatureFlags::enableCppPropsIteratorSetter()) {
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#ifdef ANDROID
|
||||
const auto& dynamic = shadowNodeProps->rawProps;
|
||||
#else
|
||||
const auto& dynamic = static_cast<folly::dynamic>(rawProps);
|
||||
|
||||
@@ -32,7 +32,7 @@ void Props::initialize(
|
||||
nativeId = ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
|
||||
? sourceProps.nativeId
|
||||
: convertRawProp(context, rawProps, "nativeID", sourceProps.nativeId, {});
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#ifdef ANDROID
|
||||
if (ReactNativeFeatureFlags::enableAccumulatedUpdatesInRawPropsAndroid()) {
|
||||
auto& oldRawProps = sourceProps.rawProps;
|
||||
auto newRawProps = rawProps.toDynamic(filterObjectKeys);
|
||||
|
||||
@@ -63,12 +63,13 @@ class Props : public virtual Sealable, public virtual DebugStringConvertible {
|
||||
|
||||
std::string nativeId;
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#ifdef ANDROID
|
||||
folly::dynamic rawProps = folly::dynamic::object();
|
||||
|
||||
virtual folly::dynamic getDiffProps(const Props* prevProps) const {
|
||||
return folly::dynamic::object();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if RN_DEBUG_STRING_CONVERTIBLE
|
||||
|
||||
@@ -50,7 +50,7 @@ ShadowNode::SharedListOfShared ShadowNode::emptySharedShadowNodeSharedList() {
|
||||
Props::Shared ShadowNode::propsForClonedShadowNode(
|
||||
const ShadowNode& sourceShadowNode,
|
||||
const Props::Shared& props) {
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#ifdef ANDROID
|
||||
bool hasBeenMounted = sourceShadowNode.hasBeenMounted_;
|
||||
bool sourceNodeHasRawProps = !sourceShadowNode.getProps()->rawProps.empty();
|
||||
if (!hasBeenMounted && sourceNodeHasRawProps && props) {
|
||||
|
||||
Reference in New Issue
Block a user