Revert "Use RN_SERIALIZABLE_STATE for conditional getDiffProps code (#51516)"

This reverts commit f900551216.
This commit is contained in:
Riccardo Cipolleschi
2025-05-26 16:59:41 +02:00
parent 827a6851d0
commit 4e855dffbb
21 changed files with 39 additions and 24 deletions
+2 -2
View File
@@ -439,11 +439,11 @@ jobs:
uses: ./.github/actions/build-android
with:
release-type: ${{ needs.set_release_type.outputs.RELEASE_TYPE }}
run-e2e-tests: ${{ github.ref == 'refs/heads/main' || contains(github.ref, 'stable') || inputs.run-e2e-tests }}
run-e2e-tests: true # ${{ github.ref == 'refs/heads/main' || contains(github.ref, 'stable') || inputs.run-e2e-tests }}
gradle-cache-encryption-key: ${{ secrets.GRADLE_CACHE_ENCRYPTION_KEY }}
test_e2e_android_rntester:
if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, 'stable') || inputs.run-e2e-tests }}
# if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, 'stable') || inputs.run-e2e-tests }}
runs-on: 4-core-ubuntu
needs: [build_android]
strategy:
@@ -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
};
@@ -592,7 +592,7 @@ SharedDebugStringConvertibleList ScrollViewProps::getDebugProps() const {
}
#endif
#ifdef RN_SERIALIZABLE_STATE
#ifdef ANDROID
static folly::dynamic convertScrollViewMaintainVisibleContentPosition(
const ScrollViewMaintainVisibleContentPosition& value) {
@@ -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
};
@@ -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
@@ -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:
@@ -144,7 +144,7 @@ SharedDebugStringConvertibleList HostPlatformViewProps::getDebugProps() const {
}
#endif
#ifdef RN_SERIALIZABLE_STATE
#ifdef ANDROID
inline static void updateEventProp(
folly::dynamic& result,
@@ -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) {