diff --git a/packages/react-native/Libraries/Components/View/__tests__/View-itest.js b/packages/react-native/Libraries/Components/View/__tests__/View-itest.js index 240babf7ddc4..4ca19b624719 100644 --- a/packages/react-native/Libraries/Components/View/__tests__/View-itest.js +++ b/packages/react-native/Libraries/Components/View/__tests__/View-itest.js @@ -6,6 +6,7 @@ * * @flow strict-local * @fantom_flags enableNativeCSSParsing:* + * @fantom_flags enableCppPropsIteratorSetter:* * @format */ diff --git a/packages/react-native/ReactCommon/react/renderer/components/image/ImageProps.cpp b/packages/react-native/ReactCommon/react/renderer/components/image/ImageProps.cpp index 6a6c293521c6..3645736ea94f 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/image/ImageProps.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/image/ImageProps.cpp @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -#include #include #include #include @@ -19,131 +18,85 @@ ImageProps::ImageProps( const RawProps& rawProps) : ViewProps(context, sourceProps, rawProps), sources( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.sources - : convertRawProp( - context, - rawProps, - "source", - sourceProps.sources, - {})), - defaultSource( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.defaultSource - : convertRawProp( - context, - rawProps, - "defaultSource", - sourceProps.defaultSource, - {})), - loadingIndicatorSource( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.loadingIndicatorSource - : convertRawProp( - context, - rawProps, - "loadingIndicatorSource", - sourceProps.loadingIndicatorSource, - {})), - resizeMode( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.resizeMode - : convertRawProp( - context, - rawProps, - "resizeMode", - sourceProps.resizeMode, - ImageResizeMode::Stretch)), - blurRadius( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.blurRadius - : convertRawProp( - context, - rawProps, - "blurRadius", - sourceProps.blurRadius, - {})), - capInsets( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.capInsets - : convertRawProp( - context, - rawProps, - "capInsets", - sourceProps.capInsets, - {})), - tintColor( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.tintColor - : convertRawProp( - context, - rawProps, - "tintColor", - sourceProps.tintColor, - {})), - internal_analyticTag( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.internal_analyticTag - : convertRawProp( - context, - rawProps, - "internal_analyticTag", - sourceProps.internal_analyticTag, - {})), - resizeMethod( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.resizeMethod - : convertRawProp( - context, - rawProps, - "resizeMethod", - sourceProps.resizeMethod, - {"auto"})), - resizeMultiplier( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.resizeMultiplier - : convertRawProp( - context, - rawProps, - "resizeMultiplier", - sourceProps.resizeMultiplier, - 1)), - shouldNotifyLoadEvents( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.shouldNotifyLoadEvents - : convertRawProp( - context, - rawProps, - "shouldNotifyLoadEvents", - sourceProps.shouldNotifyLoadEvents, - {})), - overlayColor( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.overlayColor - : convertRawProp( - context, - rawProps, - "overlayColor", - sourceProps.overlayColor, - {})), - fadeDuration( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.fadeDuration - : convertRawProp( - context, - rawProps, - "fadeDuration", - sourceProps.fadeDuration, - {})), - progressiveRenderingEnabled( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.progressiveRenderingEnabled - : convertRawProp( - context, - rawProps, - "progressiveRenderingEnabled", - sourceProps.progressiveRenderingEnabled, - {})) {} + convertRawProp(context, rawProps, "source", sourceProps.sources, {})), + defaultSource(convertRawProp( + context, + rawProps, + "defaultSource", + sourceProps.defaultSource, + {})), + loadingIndicatorSource(convertRawProp( + context, + rawProps, + "loadingIndicatorSource", + sourceProps.loadingIndicatorSource, + {})), + resizeMode(convertRawProp( + context, + rawProps, + "resizeMode", + sourceProps.resizeMode, + ImageResizeMode::Stretch)), + blurRadius(convertRawProp( + context, + rawProps, + "blurRadius", + sourceProps.blurRadius, + {})), + capInsets(convertRawProp( + context, + rawProps, + "capInsets", + sourceProps.capInsets, + {})), + tintColor(convertRawProp( + context, + rawProps, + "tintColor", + sourceProps.tintColor, + {})), + internal_analyticTag(convertRawProp( + context, + rawProps, + "internal_analyticTag", + sourceProps.internal_analyticTag, + {})), + resizeMethod(convertRawProp( + context, + rawProps, + "resizeMethod", + sourceProps.resizeMethod, + {"auto"})), + resizeMultiplier(convertRawProp( + context, + rawProps, + "resizeMultiplier", + sourceProps.resizeMultiplier, + 1)), + shouldNotifyLoadEvents(convertRawProp( + context, + rawProps, + "shouldNotifyLoadEvents", + sourceProps.shouldNotifyLoadEvents, + {})), + overlayColor(convertRawProp( + context, + rawProps, + "overlayColor", + sourceProps.overlayColor, + {})), + fadeDuration(convertRawProp( + context, + rawProps, + "fadeDuration", + sourceProps.fadeDuration, + {})), + progressiveRenderingEnabled(convertRawProp( + context, + rawProps, + "progressiveRenderingEnabled", + sourceProps.progressiveRenderingEnabled, + {})) {} void ImageProps::setProp( const PropsParserContext& context, diff --git a/packages/react-native/ReactCommon/react/renderer/components/scrollview/BaseScrollViewProps.cpp b/packages/react-native/ReactCommon/react/renderer/components/scrollview/BaseScrollViewProps.cpp index 93f7cc0a29e1..238fa494c142 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/scrollview/BaseScrollViewProps.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/scrollview/BaseScrollViewProps.cpp @@ -7,7 +7,6 @@ #include "BaseScrollViewProps.h" -#include #include #include #include @@ -22,357 +21,240 @@ BaseScrollViewProps::BaseScrollViewProps( const BaseScrollViewProps& sourceProps, const RawProps& rawProps) : ViewProps(context, sourceProps, rawProps), - alwaysBounceHorizontal( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.alwaysBounceHorizontal - : convertRawProp( - context, - rawProps, - "alwaysBounceHorizontal", - sourceProps.alwaysBounceHorizontal, - {})), - alwaysBounceVertical( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.alwaysBounceVertical - : convertRawProp( - context, - rawProps, - "alwaysBounceVertical", - sourceProps.alwaysBounceVertical, - {})), - bounces( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.bounces - : convertRawProp( - context, - rawProps, - "bounces", - sourceProps.bounces, - true)), - bouncesZoom( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.bouncesZoom - : convertRawProp( - context, - rawProps, - "bouncesZoom", - sourceProps.bouncesZoom, - true)), - canCancelContentTouches( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.canCancelContentTouches - : convertRawProp( - context, - rawProps, - "canCancelContentTouches", - sourceProps.canCancelContentTouches, - true)), - centerContent( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.centerContent - : convertRawProp( - context, - rawProps, - "centerContent", - sourceProps.centerContent, - {})), - automaticallyAdjustContentInsets( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.automaticallyAdjustContentInsets - : convertRawProp( - context, - rawProps, - "automaticallyAdjustContentInsets", - sourceProps.automaticallyAdjustContentInsets, - {})), - automaticallyAdjustsScrollIndicatorInsets( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.automaticallyAdjustsScrollIndicatorInsets - : convertRawProp( - context, - rawProps, - "automaticallyAdjustsScrollIndicatorInsets", - sourceProps.automaticallyAdjustsScrollIndicatorInsets, - true)), - automaticallyAdjustKeyboardInsets( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.automaticallyAdjustKeyboardInsets - : convertRawProp( - context, - rawProps, - "automaticallyAdjustKeyboardInsets", - sourceProps.automaticallyAdjustKeyboardInsets, - false)), - decelerationRate( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.decelerationRate - : convertRawProp( - context, - rawProps, - "decelerationRate", - sourceProps.decelerationRate, - (Float)0.998)), - endDraggingSensitivityMultiplier( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.endDraggingSensitivityMultiplier - : convertRawProp( - context, - rawProps, - "endDraggingSensitivityMultiplier", - sourceProps.endDraggingSensitivityMultiplier, - (Float)1)), - directionalLockEnabled( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.directionalLockEnabled - : convertRawProp( - context, - rawProps, - "directionalLockEnabled", - sourceProps.directionalLockEnabled, - {})), - indicatorStyle( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.indicatorStyle - : convertRawProp( - context, - rawProps, - "indicatorStyle", - sourceProps.indicatorStyle, - {})), - keyboardDismissMode( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.keyboardDismissMode - : convertRawProp( - context, - rawProps, - "keyboardDismissMode", - sourceProps.keyboardDismissMode, - {})), - maintainVisibleContentPosition( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.maintainVisibleContentPosition - : convertRawProp( - context, - rawProps, - "maintainVisibleContentPosition", - sourceProps.maintainVisibleContentPosition, - {})), - maximumZoomScale( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.maximumZoomScale - : convertRawProp( - context, - rawProps, - "maximumZoomScale", - sourceProps.maximumZoomScale, - (Float)1.0)), - minimumZoomScale( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.minimumZoomScale - : convertRawProp( - context, - rawProps, - "minimumZoomScale", - sourceProps.minimumZoomScale, - (Float)1.0)), - scrollEnabled( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.scrollEnabled - : convertRawProp( - context, - rawProps, - "scrollEnabled", - sourceProps.scrollEnabled, - true)), - pagingEnabled( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.pagingEnabled - : convertRawProp( - context, - rawProps, - "pagingEnabled", - sourceProps.pagingEnabled, - {})), - pinchGestureEnabled( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.pinchGestureEnabled - : convertRawProp( - context, - rawProps, - "pinchGestureEnabled", - sourceProps.pinchGestureEnabled, - true)), - scrollsToTop( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.scrollsToTop - : convertRawProp( - context, - rawProps, - "scrollsToTop", - sourceProps.scrollsToTop, - true)), - showsHorizontalScrollIndicator( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.showsHorizontalScrollIndicator - : convertRawProp( - context, - rawProps, - "showsHorizontalScrollIndicator", - sourceProps.showsHorizontalScrollIndicator, - true)), - showsVerticalScrollIndicator( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.showsVerticalScrollIndicator - : convertRawProp( - context, - rawProps, - "showsVerticalScrollIndicator", - sourceProps.showsVerticalScrollIndicator, - true)), - persistentScrollbar( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.persistentScrollbar - : convertRawProp( - context, - rawProps, - "persistentScrollbar", - sourceProps.persistentScrollbar, - true)), - horizontal( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.horizontal - : convertRawProp( - context, - rawProps, - "horizontal", - sourceProps.horizontal, - true)), - scrollEventThrottle( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.scrollEventThrottle - : convertRawProp( - context, - rawProps, - "scrollEventThrottle", - sourceProps.scrollEventThrottle, - {})), - zoomScale( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.zoomScale - : convertRawProp( - context, - rawProps, - "zoomScale", - sourceProps.zoomScale, - (Float)1.0)), - contentInset( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.contentInset - : convertRawProp( - context, - rawProps, - "contentInset", - sourceProps.contentInset, - {})), - contentOffset( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.contentOffset - : convertRawProp( - context, - rawProps, - "contentOffset", - sourceProps.contentOffset, - {})), - scrollIndicatorInsets( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.scrollIndicatorInsets - : convertRawProp( - context, - rawProps, - "scrollIndicatorInsets", - sourceProps.scrollIndicatorInsets, - {})), - snapToInterval( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.snapToInterval - : convertRawProp( - context, - rawProps, - "snapToInterval", - sourceProps.snapToInterval, - {})), - snapToAlignment( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.snapToAlignment - : convertRawProp( - context, - rawProps, - "snapToAlignment", - sourceProps.snapToAlignment, - {})), - disableIntervalMomentum( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.disableIntervalMomentum - : convertRawProp( - context, - rawProps, - "disableIntervalMomentum", - sourceProps.disableIntervalMomentum, - {})), - snapToOffsets( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.snapToOffsets - : convertRawProp( - context, - rawProps, - "snapToOffsets", - sourceProps.snapToOffsets, - {})), - snapToStart( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.snapToStart - : convertRawProp( - context, - rawProps, - "snapToStart", - sourceProps.snapToStart, - true)), - snapToEnd( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.snapToEnd - : convertRawProp( - context, - rawProps, - "snapToEnd", - sourceProps.snapToEnd, - true)), - contentInsetAdjustmentBehavior( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.contentInsetAdjustmentBehavior - : convertRawProp( - context, - rawProps, - "contentInsetAdjustmentBehavior", - sourceProps.contentInsetAdjustmentBehavior, - {ContentInsetAdjustmentBehavior::Never})), - scrollToOverflowEnabled( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.scrollToOverflowEnabled - : convertRawProp( - context, - rawProps, - "scrollToOverflowEnabled", - sourceProps.scrollToOverflowEnabled, - {})), - isInvertedVirtualizedList( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.isInvertedVirtualizedList - : convertRawProp( - context, - rawProps, - "isInvertedVirtualizedList", - sourceProps.isInvertedVirtualizedList, - {})) {} + alwaysBounceHorizontal(convertRawProp( + context, + rawProps, + "alwaysBounceHorizontal", + sourceProps.alwaysBounceHorizontal, + {})), + alwaysBounceVertical(convertRawProp( + context, + rawProps, + "alwaysBounceVertical", + sourceProps.alwaysBounceVertical, + {})), + bounces(convertRawProp( + context, + rawProps, + "bounces", + sourceProps.bounces, + true)), + bouncesZoom(convertRawProp( + context, + rawProps, + "bouncesZoom", + sourceProps.bouncesZoom, + true)), + canCancelContentTouches(convertRawProp( + context, + rawProps, + "canCancelContentTouches", + sourceProps.canCancelContentTouches, + true)), + centerContent(convertRawProp( + context, + rawProps, + "centerContent", + sourceProps.centerContent, + {})), + automaticallyAdjustContentInsets(convertRawProp( + context, + rawProps, + "automaticallyAdjustContentInsets", + sourceProps.automaticallyAdjustContentInsets, + {})), + automaticallyAdjustsScrollIndicatorInsets(convertRawProp( + context, + rawProps, + "automaticallyAdjustsScrollIndicatorInsets", + sourceProps.automaticallyAdjustsScrollIndicatorInsets, + true)), + automaticallyAdjustKeyboardInsets(convertRawProp( + context, + rawProps, + "automaticallyAdjustKeyboardInsets", + sourceProps.automaticallyAdjustKeyboardInsets, + false)), + decelerationRate(convertRawProp( + context, + rawProps, + "decelerationRate", + sourceProps.decelerationRate, + (Float)0.998)), + endDraggingSensitivityMultiplier(convertRawProp( + context, + rawProps, + "endDraggingSensitivityMultiplier", + sourceProps.endDraggingSensitivityMultiplier, + (Float)1)), + directionalLockEnabled(convertRawProp( + context, + rawProps, + "directionalLockEnabled", + sourceProps.directionalLockEnabled, + {})), + indicatorStyle(convertRawProp( + context, + rawProps, + "indicatorStyle", + sourceProps.indicatorStyle, + {})), + keyboardDismissMode(convertRawProp( + context, + rawProps, + "keyboardDismissMode", + sourceProps.keyboardDismissMode, + {})), + maintainVisibleContentPosition(convertRawProp( + context, + rawProps, + "maintainVisibleContentPosition", + sourceProps.maintainVisibleContentPosition, + {})), + maximumZoomScale(convertRawProp( + context, + rawProps, + "maximumZoomScale", + sourceProps.maximumZoomScale, + (Float)1.0)), + minimumZoomScale(convertRawProp( + context, + rawProps, + "minimumZoomScale", + sourceProps.minimumZoomScale, + (Float)1.0)), + scrollEnabled(convertRawProp( + context, + rawProps, + "scrollEnabled", + sourceProps.scrollEnabled, + true)), + pagingEnabled(convertRawProp( + context, + rawProps, + "pagingEnabled", + sourceProps.pagingEnabled, + {})), + pinchGestureEnabled(convertRawProp( + context, + rawProps, + "pinchGestureEnabled", + sourceProps.pinchGestureEnabled, + true)), + scrollsToTop(convertRawProp( + context, + rawProps, + "scrollsToTop", + sourceProps.scrollsToTop, + true)), + showsHorizontalScrollIndicator(convertRawProp( + context, + rawProps, + "showsHorizontalScrollIndicator", + sourceProps.showsHorizontalScrollIndicator, + true)), + showsVerticalScrollIndicator(convertRawProp( + context, + rawProps, + "showsVerticalScrollIndicator", + sourceProps.showsVerticalScrollIndicator, + true)), + persistentScrollbar(convertRawProp( + context, + rawProps, + "persistentScrollbar", + sourceProps.persistentScrollbar, + true)), + horizontal(convertRawProp( + context, + rawProps, + "horizontal", + sourceProps.horizontal, + true)), + scrollEventThrottle(convertRawProp( + context, + rawProps, + "scrollEventThrottle", + sourceProps.scrollEventThrottle, + {})), + zoomScale(convertRawProp( + context, + rawProps, + "zoomScale", + sourceProps.zoomScale, + (Float)1.0)), + contentInset(convertRawProp( + context, + rawProps, + "contentInset", + sourceProps.contentInset, + {})), + contentOffset(convertRawProp( + context, + rawProps, + "contentOffset", + sourceProps.contentOffset, + {})), + scrollIndicatorInsets(convertRawProp( + context, + rawProps, + "scrollIndicatorInsets", + sourceProps.scrollIndicatorInsets, + {})), + snapToInterval(convertRawProp( + context, + rawProps, + "snapToInterval", + sourceProps.snapToInterval, + {})), + snapToAlignment(convertRawProp( + context, + rawProps, + "snapToAlignment", + sourceProps.snapToAlignment, + {})), + disableIntervalMomentum(convertRawProp( + context, + rawProps, + "disableIntervalMomentum", + sourceProps.disableIntervalMomentum, + {})), + snapToOffsets(convertRawProp( + context, + rawProps, + "snapToOffsets", + sourceProps.snapToOffsets, + {})), + snapToStart(convertRawProp( + context, + rawProps, + "snapToStart", + sourceProps.snapToStart, + true)), + snapToEnd(convertRawProp( + context, + rawProps, + "snapToEnd", + sourceProps.snapToEnd, + true)), + contentInsetAdjustmentBehavior(convertRawProp( + context, + rawProps, + "contentInsetAdjustmentBehavior", + sourceProps.contentInsetAdjustmentBehavior, + {ContentInsetAdjustmentBehavior::Never})), + scrollToOverflowEnabled(convertRawProp( + context, + rawProps, + "scrollToOverflowEnabled", + sourceProps.scrollToOverflowEnabled, + {})), + isInvertedVirtualizedList(convertRawProp( + context, + rawProps, + "isInvertedVirtualizedList", + sourceProps.isInvertedVirtualizedList, + {})) {} void BaseScrollViewProps::setProp( const PropsParserContext& context, diff --git a/packages/react-native/ReactCommon/react/renderer/components/scrollview/platform/android/react/renderer/components/scrollview/HostPlatformScrollViewProps.cpp b/packages/react-native/ReactCommon/react/renderer/components/scrollview/platform/android/react/renderer/components/scrollview/HostPlatformScrollViewProps.cpp index 7ef93d229526..d8812796d475 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/scrollview/platform/android/react/renderer/components/scrollview/HostPlatformScrollViewProps.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/scrollview/platform/android/react/renderer/components/scrollview/HostPlatformScrollViewProps.cpp @@ -7,7 +7,6 @@ #include "HostPlatformScrollViewProps.h" -#include #include #include #include @@ -21,51 +20,36 @@ HostPlatformScrollViewProps::HostPlatformScrollViewProps( const HostPlatformScrollViewProps& sourceProps, const RawProps& rawProps) : BaseScrollViewProps(context, sourceProps, rawProps), - sendMomentumEvents( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.sendMomentumEvents - : convertRawProp( - context, - rawProps, - "sendMomentumEvents", - sourceProps.sendMomentumEvents, - true)), - nestedScrollEnabled( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.nestedScrollEnabled - : convertRawProp( - context, - rawProps, - "nestedScrollEnabled", - sourceProps.nestedScrollEnabled, - true)), - fadingEdgeLength( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.fadingEdgeLength - : convertRawProp( - context, - rawProps, - "fadingEdgeLength", - sourceProps.fadingEdgeLength, - nullptr)), - overScrollMode( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.overScrollMode - : convertRawProp( - context, - rawProps, - "overScrollMode", - sourceProps.overScrollMode, - "auto")), - endFillColor( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.endFillColor - : convertRawProp( - context, - rawProps, - "endFillColor", - sourceProps.endFillColor, - clearColor())) {} + sendMomentumEvents(convertRawProp( + context, + rawProps, + "sendMomentumEvents", + sourceProps.sendMomentumEvents, + true)), + nestedScrollEnabled(convertRawProp( + context, + rawProps, + "nestedScrollEnabled", + sourceProps.nestedScrollEnabled, + true)), + fadingEdgeLength(convertRawProp( + context, + rawProps, + "fadingEdgeLength", + sourceProps.fadingEdgeLength, + nullptr)), + overScrollMode(convertRawProp( + context, + rawProps, + "overScrollMode", + sourceProps.overScrollMode, + "auto")), + endFillColor(convertRawProp( + context, + rawProps, + "endFillColor", + sourceProps.endFillColor, + clearColor())) {} void HostPlatformScrollViewProps::setProp( const PropsParserContext& context, diff --git a/packages/react-native/ReactCommon/react/renderer/components/text/BaseParagraphProps.cpp b/packages/react-native/ReactCommon/react/renderer/components/text/BaseParagraphProps.cpp index ae173251dbad..9cd9fdbfbc61 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/text/BaseParagraphProps.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/text/BaseParagraphProps.cpp @@ -7,7 +7,6 @@ #include "BaseParagraphProps.h" -#include #include #include #include @@ -23,32 +22,23 @@ BaseParagraphProps::BaseParagraphProps( const RawProps& rawProps) : ViewProps(context, sourceProps, rawProps), BaseTextProps(context, sourceProps, rawProps), - paragraphAttributes( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.paragraphAttributes - : convertRawProp( - context, - rawProps, - sourceProps.paragraphAttributes, - {})), - isSelectable( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.isSelectable - : convertRawProp( - context, - rawProps, - "selectable", - sourceProps.isSelectable, - false)), - onTextLayout( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.onTextLayout - : convertRawProp( - context, - rawProps, - "onTextLayout", - sourceProps.onTextLayout, - {})) { + paragraphAttributes(convertRawProp( + context, + rawProps, + sourceProps.paragraphAttributes, + {})), + isSelectable(convertRawProp( + context, + rawProps, + "selectable", + sourceProps.isSelectable, + false)), + onTextLayout(convertRawProp( + context, + rawProps, + "onTextLayout", + sourceProps.onTextLayout, + {})) { /* * These props are applied to `View`, therefore they must not be a part of * base text attributes. diff --git a/packages/react-native/ReactCommon/react/renderer/components/text/BaseTextProps.cpp b/packages/react-native/ReactCommon/react/renderer/components/text/BaseTextProps.cpp index bf0019e02815..51fd245e4209 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/text/BaseTextProps.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/text/BaseTextProps.cpp @@ -7,7 +7,6 @@ #include "BaseTextProps.h" -#include #include #include #include @@ -230,14 +229,11 @@ BaseTextProps::BaseTextProps( const PropsParserContext& context, const BaseTextProps& sourceProps, const RawProps& rawProps) - : textAttributes( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.textAttributes - : convertRawProp( - context, - rawProps, - sourceProps.textAttributes, - TextAttributes{})) {}; + : textAttributes(convertRawProp( + context, + rawProps, + sourceProps.textAttributes, + TextAttributes{})) {}; void BaseTextProps::setProp( const PropsParserContext& context, diff --git a/packages/react-native/ReactCommon/react/renderer/components/text/platform/android/react/renderer/components/text/HostPlatformParagraphProps.cpp b/packages/react-native/ReactCommon/react/renderer/components/text/platform/android/react/renderer/components/text/HostPlatformParagraphProps.cpp index 3b1d2250d43a..a9a6f1452c1c 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/text/platform/android/react/renderer/components/text/HostPlatformParagraphProps.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/text/platform/android/react/renderer/components/text/HostPlatformParagraphProps.cpp @@ -7,7 +7,6 @@ #include "HostPlatformParagraphProps.h" -#include #include #include #include @@ -24,33 +23,24 @@ HostPlatformParagraphProps::HostPlatformParagraphProps( const HostPlatformParagraphProps& sourceProps, const RawProps& rawProps) : BaseParagraphProps(context, sourceProps, rawProps), - disabled( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.disabled - : convertRawProp( - context, - rawProps, - "disabled", - sourceProps.disabled, - false)), - selectionColor( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.selectionColor - : convertRawProp( - context, - rawProps, - "selectionColor", - sourceProps.selectionColor, - {})), - dataDetectorType( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.dataDetectorType - : convertRawProp( - context, - rawProps, - "dataDetectorType", - sourceProps.dataDetectorType, - {})) + disabled(convertRawProp( + context, + rawProps, + "disabled", + sourceProps.disabled, + false)), + selectionColor(convertRawProp( + context, + rawProps, + "selectionColor", + sourceProps.selectionColor, + {})), + dataDetectorType(convertRawProp( + context, + rawProps, + "dataDetectorType", + sourceProps.dataDetectorType, + {})) {}; diff --git a/packages/react-native/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput/AndroidTextInputProps.cpp b/packages/react-native/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput/AndroidTextInputProps.cpp index 31d5e598a697..00cefce0d1fd 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput/AndroidTextInputProps.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput/AndroidTextInputProps.cpp @@ -6,7 +6,6 @@ */ #include "AndroidTextInputProps.h" -#include #include #include #include @@ -39,155 +38,148 @@ AndroidTextInputProps::AndroidTextInputProps( const AndroidTextInputProps &sourceProps, const RawProps &rawProps) : BaseTextInputProps(context, sourceProps, rawProps), - autoComplete(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.autoComplete : convertRawProp( + autoComplete(convertRawProp( context, rawProps, "autoComplete", sourceProps.autoComplete, {})), - returnKeyLabel(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.autoComplete : convertRawProp(context, rawProps, + returnKeyLabel(convertRawProp(context, rawProps, "returnKeyLabel", sourceProps.returnKeyLabel, {})), - numberOfLines(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.numberOfLines : convertRawProp(context, rawProps, + numberOfLines(convertRawProp(context, rawProps, "numberOfLines", sourceProps.numberOfLines, {0})), - disableFullscreenUI(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.disableFullscreenUI : convertRawProp(context, rawProps, + disableFullscreenUI(convertRawProp(context, rawProps, "disableFullscreenUI", sourceProps.disableFullscreenUI, {false})), - textBreakStrategy(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.textBreakStrategy : convertRawProp(context, rawProps, + textBreakStrategy(convertRawProp(context, rawProps, "textBreakStrategy", sourceProps.textBreakStrategy, {})), - inlineImageLeft(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.inlineImageLeft : convertRawProp(context, rawProps, + inlineImageLeft(convertRawProp(context, rawProps, "inlineImageLeft", sourceProps.inlineImageLeft, {})), - inlineImagePadding(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.inlineImagePadding : convertRawProp(context, rawProps, + inlineImagePadding(convertRawProp(context, rawProps, "inlineImagePadding", sourceProps.inlineImagePadding, {0})), - importantForAutofill(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.importantForAutofill : convertRawProp(context, rawProps, + importantForAutofill(convertRawProp(context, rawProps, "importantForAutofill", sourceProps.importantForAutofill, {})), - showSoftInputOnFocus(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.showSoftInputOnFocus : convertRawProp(context, rawProps, + showSoftInputOnFocus(convertRawProp(context, rawProps, "showSoftInputOnFocus", sourceProps.showSoftInputOnFocus, {false})), - autoCorrect(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.autoCorrect : convertRawProp(context, rawProps, + autoCorrect(convertRawProp(context, rawProps, "autoCorrect", sourceProps.autoCorrect, {false})), - allowFontScaling(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.allowFontScaling : convertRawProp(context, rawProps, + allowFontScaling(convertRawProp(context, rawProps, "allowFontScaling", sourceProps.allowFontScaling, {false})), - maxFontSizeMultiplier(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.maxFontSizeMultiplier : convertRawProp(context, rawProps, + maxFontSizeMultiplier(convertRawProp(context, rawProps, "maxFontSizeMultiplier", sourceProps.maxFontSizeMultiplier, {0.0})), - keyboardType(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.keyboardType : convertRawProp(context, rawProps, + keyboardType(convertRawProp(context, rawProps, "keyboardType", sourceProps.keyboardType, {})), - returnKeyType(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.returnKeyType : convertRawProp(context, rawProps, + returnKeyType(convertRawProp(context, rawProps, "returnKeyType", sourceProps.returnKeyType, {})), - secureTextEntry(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.secureTextEntry : convertRawProp(context, rawProps, + secureTextEntry(convertRawProp(context, rawProps, "secureTextEntry", sourceProps.secureTextEntry, {false})), - value(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.value : convertRawProp(context, rawProps, "value", sourceProps.value, {})), - selectTextOnFocus(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.selectTextOnFocus : convertRawProp(context, rawProps, + value(convertRawProp(context, rawProps, "value", sourceProps.value, {})), + selectTextOnFocus(convertRawProp(context, rawProps, "selectTextOnFocus", sourceProps.selectTextOnFocus, {false})), - caretHidden(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.caretHidden : convertRawProp(context, rawProps, + caretHidden(convertRawProp(context, rawProps, "caretHidden", sourceProps.caretHidden, {false})), - contextMenuHidden(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.contextMenuHidden : convertRawProp(context, rawProps, + contextMenuHidden(convertRawProp(context, rawProps, "contextMenuHidden", sourceProps.contextMenuHidden, {false})), - textShadowColor(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.textShadowColor : convertRawProp(context, rawProps, + textShadowColor(convertRawProp(context, rawProps, "textShadowColor", sourceProps.textShadowColor, {})), - textShadowRadius(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.textShadowRadius : convertRawProp(context, rawProps, + textShadowRadius(convertRawProp(context, rawProps, "textShadowRadius", sourceProps.textShadowRadius, {0.0})), - textDecorationLine(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.textDecorationLine : convertRawProp(context, rawProps, + textDecorationLine(convertRawProp(context, rawProps, "textDecorationLine", sourceProps.textDecorationLine, {})), - fontStyle(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.fontStyle : - convertRawProp(context, rawProps, "fontStyle", sourceProps.fontStyle, {})), - textShadowOffset(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.textShadowOffset : convertRawProp(context, rawProps, + fontStyle(convertRawProp(context, rawProps, "fontStyle", sourceProps.fontStyle, {})), + textShadowOffset(convertRawProp(context, rawProps, "textShadowOffset", sourceProps.textShadowOffset, {})), - lineHeight(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.lineHeight : convertRawProp(context, rawProps, + lineHeight(convertRawProp(context, rawProps, "lineHeight", sourceProps.lineHeight, {0.0})), - textTransform(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.textTransform : convertRawProp(context, rawProps, + textTransform(convertRawProp(context, rawProps, "textTransform", sourceProps.textTransform, {})), color(0 /*convertRawProp(context, rawProps, "color", sourceProps.color, {0})*/), - letterSpacing(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.letterSpacing : convertRawProp(context, rawProps, + letterSpacing(convertRawProp(context, rawProps, "letterSpacing", sourceProps.letterSpacing, {0.0})), - fontSize(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.fontSize : - convertRawProp(context, rawProps, "fontSize", sourceProps.fontSize, {0.0})), - textAlign(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.textAlign : - convertRawProp(context, rawProps, "textAlign", sourceProps.textAlign, {})), - includeFontPadding(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.includeFontPadding : convertRawProp(context, rawProps, + fontSize(convertRawProp(context, rawProps, "fontSize", sourceProps.fontSize, {0.0})), + textAlign(convertRawProp(context, rawProps, "textAlign", sourceProps.textAlign, {})), + includeFontPadding(convertRawProp(context, rawProps, "includeFontPadding", sourceProps.includeFontPadding, {false})), - fontWeight(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.fontWeight : - convertRawProp(context, rawProps, "fontWeight", sourceProps.fontWeight, {})), - fontFamily(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.fontFamily : - convertRawProp(context, rawProps, "fontFamily", sourceProps.fontFamily, {})), + fontWeight(convertRawProp(context, rawProps, "fontWeight", sourceProps.fontWeight, {})), + fontFamily(convertRawProp(context, rawProps, "fontFamily", sourceProps.fontFamily, {})), // See AndroidTextInputComponentDescriptor for usage // TODO T63008435: can these, and this feature, be removed entirely? - hasPadding(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.hasPadding : hasValue(rawProps, sourceProps.hasPadding, "padding")), - hasPaddingHorizontal(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.hasPaddingHorizontal : hasValue( + hasPadding(hasValue(rawProps, sourceProps.hasPadding, "padding")), + hasPaddingHorizontal(hasValue( rawProps, sourceProps.hasPaddingHorizontal, "paddingHorizontal")), - hasPaddingVertical(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.hasPaddingVertical : hasValue( + hasPaddingVertical(hasValue( rawProps, sourceProps.hasPaddingVertical, "paddingVertical")), - hasPaddingLeft(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.hasPaddingLeft : hasValue( + hasPaddingLeft(hasValue( rawProps, sourceProps.hasPaddingLeft, "paddingLeft")), - hasPaddingTop(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.hasPaddingTop : - hasValue(rawProps, sourceProps.hasPaddingTop, "paddingTop")), - hasPaddingRight(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.hasPaddingRight : hasValue( + hasPaddingTop(hasValue(rawProps, sourceProps.hasPaddingTop, "paddingTop")), + hasPaddingRight(hasValue( rawProps, sourceProps.hasPaddingRight, "paddingRight")), - hasPaddingBottom(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.hasPaddingBottom : hasValue( + hasPaddingBottom(hasValue( rawProps, sourceProps.hasPaddingBottom, "paddingBottom")), - hasPaddingStart(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.hasPaddingStart : hasValue( + hasPaddingStart(hasValue( rawProps, sourceProps.hasPaddingStart, "paddingStart")), - hasPaddingEnd(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.hasPaddingEnd : - hasValue(rawProps, sourceProps.hasPaddingEnd, "paddingEnd")) { + hasPaddingEnd(hasValue(rawProps, sourceProps.hasPaddingEnd, "paddingEnd")) { } void AndroidTextInputProps::setProp( diff --git a/packages/react-native/ReactCommon/react/renderer/components/view/AccessibilityProps.cpp b/packages/react-native/ReactCommon/react/renderer/components/view/AccessibilityProps.cpp index c9356759d7a9..474c0ad8f2ae 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/view/AccessibilityProps.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/view/AccessibilityProps.cpp @@ -7,7 +7,6 @@ #include "AccessibilityProps.h" -#include #include #include #include @@ -19,204 +18,134 @@ AccessibilityProps::AccessibilityProps( const PropsParserContext& context, const AccessibilityProps& sourceProps, const RawProps& rawProps) - : accessible( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.accessible - : convertRawProp( - context, - rawProps, - "accessible", - sourceProps.accessible, - false)), - accessibilityState( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.accessibilityState - : convertRawProp( - context, - rawProps, - "accessibilityState", - sourceProps.accessibilityState, - {})), - accessibilityLabel( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.accessibilityLabel - : convertRawProp( - context, - rawProps, - "accessibilityLabel", - sourceProps.accessibilityLabel, - "")), - accessibilityOrder( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.accessibilityOrder - : convertRawProp( - context, - rawProps, - "experimental_accessibilityOrder", - sourceProps.accessibilityOrder, - {})), - accessibilityLabelledBy( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.accessibilityLabelledBy - : convertRawProp( - context, - rawProps, - "accessibilityLabelledBy", - sourceProps.accessibilityLabelledBy, - {})), - accessibilityLiveRegion( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.accessibilityLiveRegion - : convertRawProp( - context, - rawProps, - "accessibilityLiveRegion", - sourceProps.accessibilityLiveRegion, - AccessibilityLiveRegion::None)), - accessibilityHint( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.accessibilityHint - : convertRawProp( - context, - rawProps, - "accessibilityHint", - sourceProps.accessibilityHint, - "")), - accessibilityLanguage( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.accessibilityLanguage - : convertRawProp( - context, - rawProps, - "accessibilityLanguage", - sourceProps.accessibilityLanguage, - "")), - accessibilityLargeContentTitle( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.accessibilityLargeContentTitle - : convertRawProp( - context, - rawProps, - "accessibilityLargeContentTitle", - sourceProps.accessibilityLargeContentTitle, - "")), - accessibilityValue( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.accessibilityValue - : convertRawProp( - context, - rawProps, - "accessibilityValue", - sourceProps.accessibilityValue, - {})), - accessibilityActions( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.accessibilityActions - : convertRawProp( - context, - rawProps, - "accessibilityActions", - sourceProps.accessibilityActions, - {})), - accessibilityShowsLargeContentViewer( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.accessibilityShowsLargeContentViewer - : convertRawProp( - context, - rawProps, - "accessibilityShowsLargeContentViewer", - sourceProps.accessibilityShowsLargeContentViewer, - false)), - accessibilityViewIsModal( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.accessibilityViewIsModal - : convertRawProp( - context, - rawProps, - "accessibilityViewIsModal", - sourceProps.accessibilityViewIsModal, - false)), - accessibilityElementsHidden( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.accessibilityElementsHidden - : convertRawProp( - context, - rawProps, - "accessibilityElementsHidden", - sourceProps.accessibilityElementsHidden, - false)), - accessibilityIgnoresInvertColors( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.accessibilityIgnoresInvertColors - : convertRawProp( - context, - rawProps, - "accessibilityIgnoresInvertColors", - sourceProps.accessibilityIgnoresInvertColors, - false)), - accessibilityRespondsToUserInteraction( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.accessibilityRespondsToUserInteraction - : convertRawProp( - context, - rawProps, - "accessibilityRespondsToUserInteraction", - sourceProps.accessibilityRespondsToUserInteraction, - true)), - onAccessibilityTap( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.onAccessibilityTap - : convertRawProp( - context, - rawProps, - "onAccessibilityTap", - sourceProps.onAccessibilityTap, - {})), - onAccessibilityMagicTap( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.onAccessibilityMagicTap - : convertRawProp( - context, - rawProps, - "onAccessibilityMagicTap", - sourceProps.onAccessibilityMagicTap, - {})), - onAccessibilityEscape( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.onAccessibilityEscape - : convertRawProp( - context, - rawProps, - "onAccessibilityEscape", - sourceProps.onAccessibilityEscape, - {})), - onAccessibilityAction( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.onAccessibilityAction - : convertRawProp( - context, - rawProps, - "onAccessibilityAction", - sourceProps.onAccessibilityAction, - {})), - importantForAccessibility( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.importantForAccessibility - : convertRawProp( - context, - rawProps, - "importantForAccessibility", - sourceProps.importantForAccessibility, - ImportantForAccessibility::Auto)), + : accessible(convertRawProp( + context, + rawProps, + "accessible", + sourceProps.accessible, + false)), + accessibilityState(convertRawProp( + context, + rawProps, + "accessibilityState", + sourceProps.accessibilityState, + {})), + accessibilityLabel(convertRawProp( + context, + rawProps, + "accessibilityLabel", + sourceProps.accessibilityLabel, + "")), + accessibilityOrder(convertRawProp( + context, + rawProps, + "experimental_accessibilityOrder", + sourceProps.accessibilityOrder, + {})), + accessibilityLabelledBy(convertRawProp( + context, + rawProps, + "accessibilityLabelledBy", + sourceProps.accessibilityLabelledBy, + {})), + accessibilityLiveRegion(convertRawProp( + context, + rawProps, + "accessibilityLiveRegion", + sourceProps.accessibilityLiveRegion, + AccessibilityLiveRegion::None)), + accessibilityHint(convertRawProp( + context, + rawProps, + "accessibilityHint", + sourceProps.accessibilityHint, + "")), + accessibilityLanguage(convertRawProp( + context, + rawProps, + "accessibilityLanguage", + sourceProps.accessibilityLanguage, + "")), + accessibilityLargeContentTitle(convertRawProp( + context, + rawProps, + "accessibilityLargeContentTitle", + sourceProps.accessibilityLargeContentTitle, + "")), + accessibilityValue(convertRawProp( + context, + rawProps, + "accessibilityValue", + sourceProps.accessibilityValue, + {})), + accessibilityActions(convertRawProp( + context, + rawProps, + "accessibilityActions", + sourceProps.accessibilityActions, + {})), + accessibilityShowsLargeContentViewer(convertRawProp( + context, + rawProps, + "accessibilityShowsLargeContentViewer", + sourceProps.accessibilityShowsLargeContentViewer, + false)), + accessibilityViewIsModal(convertRawProp( + context, + rawProps, + "accessibilityViewIsModal", + sourceProps.accessibilityViewIsModal, + false)), + accessibilityElementsHidden(convertRawProp( + context, + rawProps, + "accessibilityElementsHidden", + sourceProps.accessibilityElementsHidden, + false)), + accessibilityIgnoresInvertColors(convertRawProp( + context, + rawProps, + "accessibilityIgnoresInvertColors", + sourceProps.accessibilityIgnoresInvertColors, + false)), + accessibilityRespondsToUserInteraction(convertRawProp( + context, + rawProps, + "accessibilityRespondsToUserInteraction", + sourceProps.accessibilityRespondsToUserInteraction, + true)), + onAccessibilityTap(convertRawProp( + context, + rawProps, + "onAccessibilityTap", + sourceProps.onAccessibilityTap, + {})), + onAccessibilityMagicTap(convertRawProp( + context, + rawProps, + "onAccessibilityMagicTap", + sourceProps.onAccessibilityMagicTap, + {})), + onAccessibilityEscape(convertRawProp( + context, + rawProps, + "onAccessibilityEscape", + sourceProps.onAccessibilityEscape, + {})), + onAccessibilityAction(convertRawProp( + context, + rawProps, + "onAccessibilityAction", + sourceProps.onAccessibilityAction, + {})), + importantForAccessibility(convertRawProp( + context, + rawProps, + "importantForAccessibility", + sourceProps.importantForAccessibility, + ImportantForAccessibility::Auto)), testId( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.testId - : convertRawProp( - context, - rawProps, - "testID", - sourceProps.testId, - "")) { + convertRawProp(context, rawProps, "testID", sourceProps.testId, "")) { // It is a (severe!) perf deoptimization to request props out-of-order. // Thus, since we need to request the same prop twice here // (accessibilityRole) we "must" do them subsequently here to prevent @@ -224,35 +153,29 @@ AccessibilityProps::AccessibilityProps( // it probably can, but this is a fairly rare edge-case that (1) is easy-ish // to work around here, and (2) would require very careful work to address // this case and not regress the more common cases. - if (ReactNativeFeatureFlags::enableCppPropsIteratorSetter()) { - accessibilityRole = sourceProps.accessibilityRole; - role = sourceProps.role; - accessibilityTraits = sourceProps.accessibilityTraits; - } else { - auto* accessibilityRoleValue = rawProps.at("accessibilityRole"); - auto* roleValue = rawProps.at("role"); + auto* accessibilityRoleValue = rawProps.at("accessibilityRole"); + auto* roleValue = rawProps.at("role"); - auto* precedentRoleValue = - roleValue != nullptr ? roleValue : accessibilityRoleValue; + auto* precedentRoleValue = + roleValue != nullptr ? roleValue : accessibilityRoleValue; - if (accessibilityRoleValue == nullptr || - !accessibilityRoleValue->hasValue()) { - accessibilityRole = sourceProps.accessibilityRole; - } else { - fromRawValue(context, *accessibilityRoleValue, accessibilityRole); - } + if (accessibilityRoleValue == nullptr || + !accessibilityRoleValue->hasValue()) { + accessibilityRole = sourceProps.accessibilityRole; + } else { + fromRawValue(context, *accessibilityRoleValue, accessibilityRole); + } - if (roleValue == nullptr || !roleValue->hasValue()) { - role = sourceProps.role; - } else { - fromRawValue(context, *roleValue, role); - } + if (roleValue == nullptr || !roleValue->hasValue()) { + role = sourceProps.role; + } else { + fromRawValue(context, *roleValue, role); + } - if (precedentRoleValue == nullptr || !precedentRoleValue->hasValue()) { - accessibilityTraits = sourceProps.accessibilityTraits; - } else { - fromRawValue(context, *precedentRoleValue, accessibilityTraits); - } + if (precedentRoleValue == nullptr || !precedentRoleValue->hasValue()) { + accessibilityTraits = sourceProps.accessibilityTraits; + } else { + fromRawValue(context, *precedentRoleValue, accessibilityTraits); } } diff --git a/packages/react-native/ReactCommon/react/renderer/components/view/BaseViewProps.cpp b/packages/react-native/ReactCommon/react/renderer/components/view/BaseViewProps.cpp index 50e57aeb70d9..4f8e4265d895 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/view/BaseViewProps.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/view/BaseViewProps.cpp @@ -9,7 +9,6 @@ #include -#include #include #include #include @@ -60,371 +59,254 @@ BaseViewProps::BaseViewProps( const std::function& filterObjectKeys) : YogaStylableProps(context, sourceProps, rawProps, filterObjectKeys), AccessibilityProps(context, sourceProps, rawProps), - opacity( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.opacity - : convertRawProp( - context, - rawProps, - "opacity", - sourceProps.opacity, - (Float)1.0)), - backgroundColor( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.backgroundColor - : convertRawProp( - context, - rawProps, - "backgroundColor", - sourceProps.backgroundColor, - {})), - borderRadii( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.borderRadii - : convertRawProp( - context, - rawProps, - CascadedRectangleCornersNames{ - .topLeft = "borderTopLeftRadius", - .topRight = "borderTopRightRadius", - .bottomLeft = "borderBottomLeftRadius", - .bottomRight = "borderBottomRightRadius", - .topStart = "borderTopStartRadius", - .topEnd = "borderTopEndRadius", - .bottomStart = "borderBottomStartRadius", - .bottomEnd = "borderBottomEndRadius", - .endEnd = "borderEndEndRadius", - .endStart = "borderEndStartRadius", - .startEnd = "borderStartEndRadius", - .startStart = "borderStartStartRadius", - .all = "borderRadius"}, - sourceProps.borderRadii, - {})), - borderColors( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.borderColors - : convertRawProp( - context, - rawProps, - CascadedRectangleEdgesNames{ - .left = "borderLeftColor", - .right = "borderRightColor", - .top = "borderTopColor", - .bottom = "borderBottomColor", - .start = "borderStartColor", - .end = "borderEndColor", - .horizontal = "borderHorizontalColor", - .vertical = "borderVerticalColor", - .block = "borderBlockColor", - .blockEnd = "borderBlockEndColor", - .blockStart = "borderBlockStartColor", - .all = "borderColor"}, - sourceProps.borderColors, - {})), - borderCurves( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.borderCurves - : convertRawProp( - context, - rawProps, - CascadedRectangleCornersNames{ - .topLeft = "borderTopLeftCurve", - .topRight = "borderTopRightCurve", - .bottomLeft = "borderBottomLeftCurve", - .bottomRight = "borderBottomRightCurve", - .topStart = "borderTopStartCurve", - .topEnd = "borderTopEndCurve", - .bottomStart = "borderBottomStartCurve", - .bottomEnd = "borderBottomEndCurve", - .endEnd = "borderEndEndCurve", - .endStart = "borderEndStartCurve", - .startEnd = "borderStartEndCurve", - .startStart = "borderStartStartCurve", - .all = "borderCurve"}, - sourceProps.borderCurves, - {})), - borderStyles( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.borderStyles - : convertRawProp( - context, - rawProps, - CascadedRectangleEdgesNames{ - .left = "borderLeftStyle", - .right = "borderRightStyle", - .top = "borderTopStyle", - .bottom = "borderBottomStyle", - .start = "borderStartStyle", - .end = "borderEndStyle", - .horizontal = "borderHorizontalStyle", - .vertical = "borderVerticalStyle", - .block = "borderBlockStyle", - .blockEnd = "borderBlockEndStyle", - .blockStart = "borderBlockStartStyle", - .all = "borderStyle"}, - sourceProps.borderStyles, - {})), - outlineColor( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.outlineColor - : convertRawProp( - context, - rawProps, - "outlineColor", - sourceProps.outlineColor, - {})), - outlineOffset( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.outlineOffset - : convertRawProp( - context, - rawProps, - "outlineOffset", - sourceProps.outlineOffset, - {})), - outlineStyle( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.outlineStyle - : convertRawProp( - context, - rawProps, - "outlineStyle", - sourceProps.outlineStyle, - {})), - outlineWidth( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.outlineWidth - : convertRawProp( - context, - rawProps, - "outlineWidth", - sourceProps.outlineWidth, - {})), - shadowColor( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.shadowColor - : convertRawProp( - context, - rawProps, - "shadowColor", - sourceProps.shadowColor, - {})), - shadowOffset( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.shadowOffset - : convertRawProp( - context, - rawProps, - "shadowOffset", - sourceProps.shadowOffset, - {})), - shadowOpacity( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.shadowOpacity - : convertRawProp( - context, - rawProps, - "shadowOpacity", - sourceProps.shadowOpacity, - {})), - shadowRadius( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.shadowRadius - : convertRawProp( - context, - rawProps, - "shadowRadius", - sourceProps.shadowRadius, - {})), + opacity(convertRawProp( + context, + rawProps, + "opacity", + sourceProps.opacity, + (Float)1.0)), + backgroundColor(convertRawProp( + context, + rawProps, + "backgroundColor", + sourceProps.backgroundColor, + {})), + borderRadii(convertRawProp( + context, + rawProps, + CascadedRectangleCornersNames{ + .topLeft = "borderTopLeftRadius", + .topRight = "borderTopRightRadius", + .bottomLeft = "borderBottomLeftRadius", + .bottomRight = "borderBottomRightRadius", + .topStart = "borderTopStartRadius", + .topEnd = "borderTopEndRadius", + .bottomStart = "borderBottomStartRadius", + .bottomEnd = "borderBottomEndRadius", + .endEnd = "borderEndEndRadius", + .endStart = "borderEndStartRadius", + .startEnd = "borderStartEndRadius", + .startStart = "borderStartStartRadius", + .all = "borderRadius"}, + sourceProps.borderRadii, + {})), + borderColors(convertRawProp( + context, + rawProps, + CascadedRectangleEdgesNames{ + .left = "borderLeftColor", + .right = "borderRightColor", + .top = "borderTopColor", + .bottom = "borderBottomColor", + .start = "borderStartColor", + .end = "borderEndColor", + .horizontal = "borderHorizontalColor", + .vertical = "borderVerticalColor", + .block = "borderBlockColor", + .blockEnd = "borderBlockEndColor", + .blockStart = "borderBlockStartColor", + .all = "borderColor"}, + sourceProps.borderColors, + {})), + borderCurves(convertRawProp( + context, + rawProps, + CascadedRectangleCornersNames{ + .topLeft = "borderTopLeftCurve", + .topRight = "borderTopRightCurve", + .bottomLeft = "borderBottomLeftCurve", + .bottomRight = "borderBottomRightCurve", + .topStart = "borderTopStartCurve", + .topEnd = "borderTopEndCurve", + .bottomStart = "borderBottomStartCurve", + .bottomEnd = "borderBottomEndCurve", + .endEnd = "borderEndEndCurve", + .endStart = "borderEndStartCurve", + .startEnd = "borderStartEndCurve", + .startStart = "borderStartStartCurve", + .all = "borderCurve"}, + sourceProps.borderCurves, + {})), + borderStyles(convertRawProp( + context, + rawProps, + CascadedRectangleEdgesNames{ + .left = "borderLeftStyle", + .right = "borderRightStyle", + .top = "borderTopStyle", + .bottom = "borderBottomStyle", + .start = "borderStartStyle", + .end = "borderEndStyle", + .horizontal = "borderHorizontalStyle", + .vertical = "borderVerticalStyle", + .block = "borderBlockStyle", + .blockEnd = "borderBlockEndStyle", + .blockStart = "borderBlockStartStyle", + .all = "borderStyle"}, + sourceProps.borderStyles, + {})), + outlineColor(convertRawProp( + context, + rawProps, + "outlineColor", + sourceProps.outlineColor, + {})), + outlineOffset(convertRawProp( + context, + rawProps, + "outlineOffset", + sourceProps.outlineOffset, + {})), + outlineStyle(convertRawProp( + context, + rawProps, + "outlineStyle", + sourceProps.outlineStyle, + {})), + outlineWidth(convertRawProp( + context, + rawProps, + "outlineWidth", + sourceProps.outlineWidth, + {})), + shadowColor(convertRawProp( + context, + rawProps, + "shadowColor", + sourceProps.shadowColor, + {})), + shadowOffset(convertRawProp( + context, + rawProps, + "shadowOffset", + sourceProps.shadowOffset, + {})), + shadowOpacity(convertRawProp( + context, + rawProps, + "shadowOpacity", + sourceProps.shadowOpacity, + {})), + shadowRadius(convertRawProp( + context, + rawProps, + "shadowRadius", + sourceProps.shadowRadius, + {})), cursor( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.cursor - : convertRawProp( - context, - rawProps, - "cursor", - sourceProps.cursor, - {})), - boxShadow( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.boxShadow - : convertRawProp( - context, - rawProps, - "boxShadow", - sourceProps.boxShadow, - {})), + convertRawProp(context, rawProps, "cursor", sourceProps.cursor, {})), + boxShadow(convertRawProp( + context, + rawProps, + "boxShadow", + sourceProps.boxShadow, + {})), filter( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.filter - : convertRawProp( - context, - rawProps, - "filter", - sourceProps.filter, - {})), - backgroundImage( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.backgroundImage - : convertRawProp( - context, - rawProps, - "backgroundImage", - convertRawProp( - context, - rawProps, - "experimental_backgroundImage", - sourceProps.backgroundImage, - {}), - {})), - backgroundSize( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.backgroundSize - : convertRawProp( - context, - rawProps, - "experimental_backgroundSize", - sourceProps.backgroundSize, - {})), - backgroundPosition( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.backgroundPosition - : convertRawProp( - context, - rawProps, - "experimental_backgroundPosition", - sourceProps.backgroundPosition, - {})), - backgroundRepeat( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.backgroundRepeat - : convertRawProp( - context, - rawProps, - "experimental_backgroundRepeat", - sourceProps.backgroundRepeat, - {})), - mixBlendMode( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.mixBlendMode - : convertRawProp( - context, - rawProps, - "mixBlendMode", - sourceProps.mixBlendMode, - {})), - isolation( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.isolation - : convertRawProp( - context, - rawProps, - "isolation", - sourceProps.isolation, - {})), - transform( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.transform - : convertRawProp( - context, - rawProps, - "transform", - sourceProps.transform, - {})), - transformOrigin( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.transformOrigin - : convertRawProp( - context, - rawProps, - "transformOrigin", - sourceProps.transformOrigin, - {})), - backfaceVisibility( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.backfaceVisibility - : convertRawProp( - context, - rawProps, - "backfaceVisibility", - sourceProps.backfaceVisibility, - {})), - shouldRasterize( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.shouldRasterize - : convertRawProp( - context, - rawProps, - "shouldRasterizeIOS", - sourceProps.shouldRasterize, - {})), + convertRawProp(context, rawProps, "filter", sourceProps.filter, {})), + backgroundImage(convertRawProp( + context, + rawProps, + "backgroundImage", + convertRawProp( + context, + rawProps, + "experimental_backgroundImage", + sourceProps.backgroundImage, + {}), + {})), + backgroundSize(convertRawProp( + context, + rawProps, + "experimental_backgroundSize", + sourceProps.backgroundSize, + {})), + backgroundPosition(convertRawProp( + context, + rawProps, + "experimental_backgroundPosition", + sourceProps.backgroundPosition, + {})), + backgroundRepeat(convertRawProp( + context, + rawProps, + "experimental_backgroundRepeat", + sourceProps.backgroundRepeat, + {})), + mixBlendMode(convertRawProp( + context, + rawProps, + "mixBlendMode", + sourceProps.mixBlendMode, + {})), + isolation(convertRawProp( + context, + rawProps, + "isolation", + sourceProps.isolation, + {})), + transform(convertRawProp( + context, + rawProps, + "transform", + sourceProps.transform, + {})), + transformOrigin(convertRawProp( + context, + rawProps, + "transformOrigin", + sourceProps.transformOrigin, + {})), + backfaceVisibility(convertRawProp( + context, + rawProps, + "backfaceVisibility", + sourceProps.backfaceVisibility, + {})), + shouldRasterize(convertRawProp( + context, + rawProps, + "shouldRasterizeIOS", + sourceProps.shouldRasterize, + {})), zIndex( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.zIndex - : convertRawProp( - context, - rawProps, - "zIndex", - sourceProps.zIndex, - {})), - pointerEvents( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.pointerEvents - : convertRawProp( - context, - rawProps, - "pointerEvents", - sourceProps.pointerEvents, - {})), - hitSlop( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.hitSlop - : convertRawProp( - context, - rawProps, - "hitSlop", - sourceProps.hitSlop, - {})), - onLayout( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.onLayout - : convertRawProp( - context, - rawProps, - "onLayout", - sourceProps.onLayout, - {})), - events( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.events - : convertRawProp(context, rawProps, sourceProps.events, {})), - collapsable( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.collapsable - : convertRawProp( - context, - rawProps, - "collapsable", - sourceProps.collapsable, - true)), - collapsableChildren( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.collapsableChildren - : convertRawProp( - context, - rawProps, - "collapsableChildren", - sourceProps.collapsableChildren, - true)), - removeClippedSubviews( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.removeClippedSubviews - : convertRawProp( - context, - rawProps, - "removeClippedSubviews", - sourceProps.removeClippedSubviews, - false)) {} + convertRawProp(context, rawProps, "zIndex", sourceProps.zIndex, {})), + pointerEvents(convertRawProp( + context, + rawProps, + "pointerEvents", + sourceProps.pointerEvents, + {})), + hitSlop(convertRawProp( + context, + rawProps, + "hitSlop", + sourceProps.hitSlop, + {})), + onLayout(convertRawProp( + context, + rawProps, + "onLayout", + sourceProps.onLayout, + {})), + events(convertRawProp(context, rawProps, sourceProps.events, {})), + collapsable(convertRawProp( + context, + rawProps, + "collapsable", + sourceProps.collapsable, + true)), + collapsableChildren(convertRawProp( + context, + rawProps, + "collapsableChildren", + sourceProps.collapsableChildren, + true)), + removeClippedSubviews(convertRawProp( + context, + rawProps, + "removeClippedSubviews", + sourceProps.removeClippedSubviews, + false)) {} #define VIEW_EVENT_CASE(eventType) \ case CONSTEXPR_RAW_PROPS_KEY_HASH("on" #eventType): { \ diff --git a/packages/react-native/ReactCommon/react/renderer/components/view/YogaStylableProps.cpp b/packages/react-native/ReactCommon/react/renderer/components/view/YogaStylableProps.cpp index d740d4a153bd..73a20cedd883 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/view/YogaStylableProps.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/view/YogaStylableProps.cpp @@ -7,7 +7,6 @@ #include "YogaStylableProps.h" -#include #include #include #include @@ -25,13 +24,8 @@ YogaStylableProps::YogaStylableProps( const RawProps& rawProps, const std::function& filterObjectKeys) : Props(context, sourceProps, rawProps, filterObjectKeys), - yogaStyle( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.yogaStyle - : convertRawProp(context, rawProps, sourceProps.yogaStyle)) { - if (!ReactNativeFeatureFlags::enableCppPropsIteratorSetter()) { - convertRawPropAliases(context, sourceProps, rawProps); - } + yogaStyle(convertRawProp(context, rawProps, sourceProps.yogaStyle)) { + convertRawPropAliases(context, sourceProps, rawProps); }; template diff --git a/packages/react-native/ReactCommon/react/renderer/components/view/platform/android/react/renderer/components/view/HostPlatformViewProps.cpp b/packages/react-native/ReactCommon/react/renderer/components/view/platform/android/react/renderer/components/view/HostPlatformViewProps.cpp index 4a9bf3c78b39..19cde3251e84 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/view/platform/android/react/renderer/components/view/HostPlatformViewProps.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/view/platform/android/react/renderer/components/view/HostPlatformViewProps.cpp @@ -9,7 +9,6 @@ #include -#include #include #include #include @@ -25,123 +24,84 @@ HostPlatformViewProps::HostPlatformViewProps( const RawProps& rawProps, const std::function& filterObjectKeys) : BaseViewProps(context, sourceProps, rawProps, filterObjectKeys), - elevation( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.elevation - : convertRawProp( - context, - rawProps, - "elevation", - sourceProps.elevation, - {})), - nativeBackground( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.nativeBackground - : convertRawProp( - context, - rawProps, - "nativeBackgroundAndroid", - sourceProps.nativeBackground, - {})), - nativeForeground( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.nativeForeground - : convertRawProp( - context, - rawProps, - "nativeForegroundAndroid", - sourceProps.nativeForeground, - {})), - focusable( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.focusable - : convertRawProp( - context, - rawProps, - "focusable", - sourceProps.focusable, - {})), - hasTVPreferredFocus( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.hasTVPreferredFocus - : convertRawProp( - context, - rawProps, - "hasTVPreferredFocus", - sourceProps.hasTVPreferredFocus, - {})), - needsOffscreenAlphaCompositing( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.needsOffscreenAlphaCompositing - : convertRawProp( - context, - rawProps, - "needsOffscreenAlphaCompositing", - sourceProps.needsOffscreenAlphaCompositing, - {})), - renderToHardwareTextureAndroid( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.renderToHardwareTextureAndroid - : convertRawProp( - context, - rawProps, - "renderToHardwareTextureAndroid", - sourceProps.renderToHardwareTextureAndroid, - {})), - screenReaderFocusable( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.screenReaderFocusable - : convertRawProp( - context, - rawProps, - "screenReaderFocusable", - sourceProps.screenReaderFocusable, - {})), - nextFocusDown( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.nextFocusDown - : convertRawProp( - context, - rawProps, - "nextFocusDown", - sourceProps.nextFocusDown, - {})), - nextFocusForward( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.nextFocusForward - : convertRawProp( - context, - rawProps, - "nextFocusForward", - sourceProps.nextFocusForward, - {})), - nextFocusLeft( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.nextFocusLeft - : convertRawProp( - context, - rawProps, - "nextFocusLeft", - sourceProps.nextFocusLeft, - {})), - nextFocusRight( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.nextFocusRight - : convertRawProp( - context, - rawProps, - "nextFocusRight", - sourceProps.nextFocusRight, - {})), - nextFocusUp( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.nextFocusUp - : convertRawProp( - context, - rawProps, - "nextFocusUp", - sourceProps.nextFocusUp, - {})) {} + elevation(convertRawProp( + context, + rawProps, + "elevation", + sourceProps.elevation, + {})), + nativeBackground(convertRawProp( + context, + rawProps, + "nativeBackgroundAndroid", + sourceProps.nativeBackground, + {})), + nativeForeground(convertRawProp( + context, + rawProps, + "nativeForegroundAndroid", + sourceProps.nativeForeground, + {})), + focusable(convertRawProp( + context, + rawProps, + "focusable", + sourceProps.focusable, + {})), + hasTVPreferredFocus(convertRawProp( + context, + rawProps, + "hasTVPreferredFocus", + sourceProps.hasTVPreferredFocus, + {})), + needsOffscreenAlphaCompositing(convertRawProp( + context, + rawProps, + "needsOffscreenAlphaCompositing", + sourceProps.needsOffscreenAlphaCompositing, + {})), + renderToHardwareTextureAndroid(convertRawProp( + context, + rawProps, + "renderToHardwareTextureAndroid", + sourceProps.renderToHardwareTextureAndroid, + {})), + screenReaderFocusable(convertRawProp( + context, + rawProps, + "screenReaderFocusable", + sourceProps.screenReaderFocusable, + {})), + nextFocusDown(convertRawProp( + context, + rawProps, + "nextFocusDown", + sourceProps.nextFocusDown, + {})), + nextFocusForward(convertRawProp( + context, + rawProps, + "nextFocusForward", + sourceProps.nextFocusForward, + {})), + nextFocusLeft(convertRawProp( + context, + rawProps, + "nextFocusLeft", + sourceProps.nextFocusLeft, + {})), + nextFocusRight(convertRawProp( + context, + rawProps, + "nextFocusRight", + sourceProps.nextFocusRight, + {})), + nextFocusUp(convertRawProp( + context, + rawProps, + "nextFocusUp", + sourceProps.nextFocusUp, + {})) {} void HostPlatformViewProps::setProp( const PropsParserContext& context, diff --git a/packages/react-native/ReactCommon/react/renderer/core/ConcreteComponentDescriptor.h b/packages/react-native/ReactCommon/react/renderer/core/ConcreteComponentDescriptor.h index 495702a08b8d..5c5773028d31 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/ConcreteComponentDescriptor.h +++ b/packages/react-native/ReactCommon/react/renderer/core/ConcreteComponentDescriptor.h @@ -48,7 +48,18 @@ class ConcreteComponentDescriptor : public ComponentDescriptor { RawPropsParser &&rawPropsParser = {}) : ComponentDescriptor(parameters, std::move(rawPropsParser)) { - rawPropsParser_.prepare(); + // The parser's `keys_` / `nameToIndex_` are only consumed by + // `RawProps::at()`, which is reached exclusively through the classic + // per-field `convertRawProp` path. When `ConcreteProps` opts into the + // iterator-setter path and the runtime flag is on, `parse()` is never + // called, so the O(n²) preparation here is wasted. Skip it. + if constexpr (HasIteratorSetterCtor) { + if (!ReactNativeFeatureFlags::enableCppPropsIteratorSetter()) { + rawPropsParser_.prepare(); + } + } else { + rawPropsParser_.prepare(); + } } ComponentHandle getComponentHandle() const override @@ -112,9 +123,30 @@ class ConcreteComponentDescriptor : public ComponentDescriptor { ShadowNodeT::filterRawProps(rawProps); } - rawProps.parse(rawPropsParser_); + // Two construction paths: + // - Iterator-setter (only available when `ConcreteProps` satisfies + // `HasIteratorSetterCtor` AND the runtime flag is on): copy-construct + // from sourceProps, then walk rawProps in-place via `forEachItem` and + // route each entry through `setProp`. Skips both + // `RawProps::parse(parser)` and the `folly::dynamic` materialization + // that the legacy path needed. + // - Classic (the fallback for any `ConcreteProps` that doesn't opt in, + // and the only path when the flag is off): parse + per-field + // `convertRawProp` via the 3-arg ctor. + constexpr bool kSupportsIteratorSetter = HasIteratorSetterCtor; + const bool useIteratorSetter = kSupportsIteratorSetter && ReactNativeFeatureFlags::enableCppPropsIteratorSetter(); + + std::shared_ptr shadowNodeProps; + if constexpr (kSupportsIteratorSetter) { + if (useIteratorSetter) { + shadowNodeProps = ShadowNodeT::Props(props); + } + } + if (!useIteratorSetter) { + rawProps.parse(rawPropsParser_); + shadowNodeProps = ShadowNodeT::Props(context, rawProps, props); + } - auto shadowNodeProps = ShadowNodeT::Props(context, rawProps, props); #ifdef RN_SERIALIZABLE_STATE bool fallbackToDynamicRawPropsAccumulation = true; if (ReactNativeFeatureFlags::enableExclusivePropsUpdateAndroid() && @@ -134,19 +166,12 @@ class ConcreteComponentDescriptor : public ComponentDescriptor { ShadowNodeT::initializeDynamicProps(shadowNodeProps, rawProps, props); } #endif - // Use the new-style iterator - // 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 - const auto &dynamic = - fallbackToDynamicRawPropsAccumulation ? shadowNodeProps->rawProps : static_cast(rawProps); -#else - const auto &dynamic = static_cast(rawProps); -#endif - for (const auto &pair : dynamic.items()) { - const auto &name = pair.first.getString(); - shadowNodeProps->setProp(context, RAW_PROPS_KEY_HASH(name), name.c_str(), RawValue(pair.second)); + + if constexpr (kSupportsIteratorSetter) { + if (useIteratorSetter) { + rawProps.forEachItem([&](std::string_view name, const RawValue &value) { + shadowNodeProps->setProp(context, RAW_PROPS_KEY_HASH(name), name.data(), value); + }); } } return shadowNodeProps; diff --git a/packages/react-native/ReactCommon/react/renderer/core/ConcreteShadowNode.h b/packages/react-native/ReactCommon/react/renderer/core/ConcreteShadowNode.h index cbddd0d8b446..ac069108548c 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/ConcreteShadowNode.h +++ b/packages/react-native/ReactCommon/react/renderer/core/ConcreteShadowNode.h @@ -71,6 +71,13 @@ class ConcreteShadowNode : public BaseShadowNodeT { return BaseShadowNodeT::BaseTraits(); } + /* + * Classic / parse path: construct `PropsT` by parsing `rawProps` field-by- + * field via the 3-arg `(context, sourceProps, rawProps)` constructor. + * `ConcreteComponentDescriptor::cloneProps` calls this when the + * iterator-setter path is disabled (per-class via the + * `HasIteratorSetterCtor` concept, or globally via the runtime flag). + */ static UnsharedConcreteProps Props(const PropsParserContext &context, const RawProps &rawProps, const Props::Shared &baseProps = nullptr) { @@ -78,6 +85,18 @@ class ConcreteShadowNode : public BaseShadowNodeT { context, baseProps ? static_cast(*baseProps) : *defaultSharedProps(), rawProps); } + /* + * Iterator-setter path: copy-construct `PropsT` from `baseProps` only. + * `ConcreteComponentDescriptor::cloneProps` then walks `rawProps` via + * `RawProps::forEachItem` and overwrites individual fields through + * `PropsT::setProp`. Available when `PropsT` satisfies + * `HasIteratorSetterCtor`. + */ + static UnsharedConcreteProps Props(const Props::Shared &baseProps) + { + return std::make_shared(baseProps ? static_cast(*baseProps) : *defaultSharedProps()); + } + #ifdef RN_SERIALIZABLE_STATE static void initializeDynamicProps( UnsharedConcreteProps props, diff --git a/packages/react-native/ReactCommon/react/renderer/core/Props.cpp b/packages/react-native/ReactCommon/react/renderer/core/Props.cpp index aca087d296e4..3e8845e9c31d 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/Props.cpp +++ b/packages/react-native/ReactCommon/react/renderer/core/Props.cpp @@ -10,8 +10,8 @@ #include #include +#include #include -#include "DynamicPropsUtilities.h" namespace facebook::react { @@ -21,21 +21,12 @@ Props::Props( const RawProps& rawProps, [[maybe_unused]] const std::function& filterObjectKeys) - : nativeId( - ReactNativeFeatureFlags::enableCppPropsIteratorSetter() - ? sourceProps.nativeId - : convertRawProp( - context, - rawProps, - "nativeID", - sourceProps.nativeId, - {})) { -#ifdef RN_SERIALIZABLE_STATE - if (!ReactNativeFeatureFlags::enableExclusivePropsUpdateAndroid()) { - initializeDynamicProps(sourceProps, rawProps, filterObjectKeys); - } -#endif -} + : nativeId(convertRawProp( + context, + rawProps, + "nativeID", + sourceProps.nativeId, + {})) {} void Props::setProp( const PropsParserContext& context, diff --git a/packages/react-native/ReactCommon/react/renderer/core/Props.h b/packages/react-native/ReactCommon/react/renderer/core/Props.h index ad3e264d31e2..a197824f1bff 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/Props.h +++ b/packages/react-native/ReactCommon/react/renderer/core/Props.h @@ -41,7 +41,7 @@ class Props : public virtual Sealable, public virtual DebugStringConvertible { virtual ~Props() = default; #endif - Props(const Props &other) = delete; + Props(const Props &other) = default; Props &operator=(const Props &other) = delete; /** @@ -84,4 +84,66 @@ class Props : public virtual Sealable, public virtual DebugStringConvertible { #endif }; +namespace detail { + +/* + * Extracts the class type from a pointer-to-member-function expression. + * Used in unevaluated context only. + */ +template +auto memberFunctionClass(T C::*) -> C; + +} // namespace detail + +/* + * Internal: `T` declares its OWN `setProp` (not just inherits one from a + * base class). `&T::setProp` resolves to a pointer-to-member-function whose + * class part is the level where `setProp` was actually declared — if `T` + * inherits without overriding, that class is some base, not `T`. + * + * Distinguishing own-declaration from inherited-declaration matters because + * `setProp` is non-virtual. A subclass that adds fields but forgets to + * override `setProp` would silently inherit its parent's switch — and the new + * fields would never be reached by the iterator-setter dispatch. + */ +template +concept DeclaresOwnSetProp = std::is_same_v; + +/* + * Internal: `T` exposes a `setProp(ctx, hash, name, value) -> void` callable + * with the canonical Props signature, declared on `T` itself. + */ +template +concept HasSetProp = DeclaresOwnSetProp && + requires(T &t, const PropsParserContext &ctx, RawPropsPropNameHash hash, const char *name, const RawValue &value) { + { t.setProp(ctx, hash, name, value) } -> std::same_as; + }; + +/* + * Marks a Props type as supporting the iterator-setter construction path used + * by `ConcreteComponentDescriptor::cloneProps` when + * `enableCppPropsIteratorSetter` is on. The contract is: + * + * 1. The type is copy-constructible from a source Props (so `cloneProps` + * can build the new Props by copy and then overwrite individual fields). + * 2. The type descends from `Props`, anchoring the `setProp` chain in the + * `Props::setProp` base case. + * 3. The type declares its OWN `setProp` with the canonical signature — + * not inherited — so the iterator dispatch reaches every field that the + * type adds beyond its base. + * + * `setProp` is non-virtual; subclasses chain explicitly via + * `Parent::setProp(...)`. The chain integrity beyond `T` is enforced by the + * compiler at each level's `setProp` body — if a subclass calls + * `Parent::setProp(...)` and `Parent` does not define one, the build fails + * at that call site. This concept guards the entry point (`T` itself) and + * relies on those per-level calls to keep the chain whole. + * + * When the concept is NOT satisfied for some `ConcreteProps`, + * `cloneProps` falls through to the classic per-field `convertRawProp` path + * for that component regardless of the runtime flag. + */ +template +concept HasIteratorSetterCtor = std::copy_constructible && std::derived_from && HasSetProp; + } // namespace facebook::react diff --git a/packages/react-native/ReactCommon/react/renderer/core/RawProps.h b/packages/react-native/ReactCommon/react/renderer/core/RawProps.h index 0abfce1c8256..e6f5c07def98 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/RawProps.h +++ b/packages/react-native/ReactCommon/react/renderer/core/RawProps.h @@ -97,6 +97,45 @@ class RawProps final { // compatibility with callers that pass prefix/suffix separately. const RawValue *at(const char *name, const char *prefix, const char *suffix) const noexcept; + /* + * Iterates the underlying source object and invokes `fn(name, value)` for + * each entry, in source order. Skips parsing — does NOT require a prior + * `parse(parser)` call. For `Mode::JSI` this walks the JSI object in-place + * (no `folly::dynamic` materialization). For `Mode::Dynamic` it walks + * `dynamic_.items()`. For `Mode::Empty` it is a no-op. + * + * The callback signature is `void(std::string_view name, const RawValue &value)`. + * The view points into storage owned by `forEachItem` for the duration of + * the call and is null-terminated (i.e. `name.data()` is a valid C string). + */ + template + void forEachItem(Fn fn) const + { + switch (mode_) { + case Mode::Empty: + return; + case Mode::JSI: { + auto object = value_.asObject(*runtime_); + auto names = object.getPropertyNames(*runtime_); + auto count = names.size(*runtime_); + for (size_t i = 0; i < count; ++i) { + auto name = names.getValueAtIndex(*runtime_, i).getString(*runtime_); + auto propValue = object.getProperty(*runtime_, name); + auto nameUtf8 = name.utf8(*runtime_); + fn(std::string_view{nameUtf8}, RawValue{*runtime_, std::move(propValue)}); + } + return; + } + case Mode::Dynamic: + for (const auto &pair : dynamic_.items()) { + fn(std::string_view{pair.first.getString()}, RawValue{pair.second}); + } + return; + default: + return; + } + } + private: friend class RawPropsParser; diff --git a/packages/react-native/ReactCommon/react/renderer/core/tests/ComponentDescriptorTest.cpp b/packages/react-native/ReactCommon/react/renderer/core/tests/ComponentDescriptorTest.cpp index 4b3538da3479..1a79845be624 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/tests/ComponentDescriptorTest.cpp +++ b/packages/react-native/ReactCommon/react/renderer/core/tests/ComponentDescriptorTest.cpp @@ -7,12 +7,20 @@ #include +#include #include #include "TestComponent.h" using namespace facebook::react; +static_assert( + HasIteratorSetterCtor, + "base `Props` must itself satisfy `HasIteratorSetterCtor` — it is copy-constructible, " + "derived from itself, and declares its own `setProp`. If this fails, " + "`ConcreteComponentDescriptor::cloneProps` will silently fall back to the classic " + "path for any concrete props whose nearest setProp-declaring ancestor is `Props` itself."); + TEST(ComponentDescriptorTest, createShadowNode) { auto eventDispatcher = std::shared_ptr(); SharedComponentDescriptor descriptor = diff --git a/packages/react-native/ReactCommon/react/renderer/core/tests/PropsConceptsTest.cpp b/packages/react-native/ReactCommon/react/renderer/core/tests/PropsConceptsTest.cpp new file mode 100644 index 000000000000..656bd0612448 --- /dev/null +++ b/packages/react-native/ReactCommon/react/renderer/core/tests/PropsConceptsTest.cpp @@ -0,0 +1,135 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#include +#include +#include +#include +#include + +using namespace facebook::react; + +namespace { + +// Mimics the shape the React Native codegen emits for +// `codegenNativeComponent(...)` (see +// `react-native-codegen/src/generators/components/GeneratePropsH.js` +// `ClassTemplate`): default ctor, the 3-arg classic ctor with +// `convertRawProp` in its initializer list, public prop fields, and +// NO `setProp` override. +class CodegenStyleProps : public Props { + public: + CodegenStyleProps() = default; + CodegenStyleProps( + const PropsParserContext& context, + const CodegenStyleProps& sourceProps, + const RawProps& rawProps) + : Props(context, sourceProps, rawProps), + customField(convertRawProp( + context, + rawProps, + "customField", + sourceProps.customField, + 0)) {} + + int customField{0}; +}; + +// Mimics a hand-written Props subclass that opts in to the +// iterator-setter path by declaring its own `setProp`. +class HandWrittenSetPropProps : public Props { + public: + HandWrittenSetPropProps() = default; + HandWrittenSetPropProps( + const PropsParserContext& context, + const HandWrittenSetPropProps& sourceProps, + const RawProps& rawProps) + : Props(context, sourceProps, rawProps), + customField(sourceProps.customField) {} + + void setProp( + const PropsParserContext& context, + RawPropsPropNameHash hash, + const char* propName, + const RawValue& value) { + Props::setProp(context, hash, propName, value); + switch (hash) { + case CONSTEXPR_RAW_PROPS_KEY_HASH("customField"): + fromRawValue(context, value, customField, 0); + return; + } + } + + int customField{0}; +}; + +// A subclass of a hand-written setProp class that does NOT redeclare +// `setProp`. Acts like a downstream specialization (e.g. how +// `ViewShadowNodeProps` extends `ViewProps`). The concept must reject +// this — otherwise the iterator-setter dispatch would silently miss +// `extraField`. +class InheritedSetPropProps : public HandWrittenSetPropProps { + public: + InheritedSetPropProps() = default; + InheritedSetPropProps( + const PropsParserContext& context, + const InheritedSetPropProps& sourceProps, + const RawProps& rawProps) + : HandWrittenSetPropProps(context, sourceProps, rawProps), + extraField(sourceProps.extraField) {} + + int extraField{0}; +}; + +// `using Base::setProp;` is sugar — it doesn't constitute "own" +// declaration. Concept must still reject. +class UsingDeclSetPropProps : public HandWrittenSetPropProps { + public: + using HandWrittenSetPropProps::setProp; +}; + +// Concept axioms — fail the build if the iterator-setter dispatch ever +// regresses to silently accepting classes that inherit `setProp`. +static_assert( + !DeclaresOwnSetProp, + "Codegen'd Props classes don't declare setProp — concept must reject them."); +static_assert( + !HasSetProp, + "HasSetProp requires DeclaresOwnSetProp."); +static_assert( + !HasIteratorSetterCtor, + "Codegen'd Props must fall through to the classic cloneProps path. " + "If this fires, the iterator-setter would skip every field the codegen'd " + "ctor populates via convertRawProp, leaving the component unrendered."); + +static_assert(DeclaresOwnSetProp); +static_assert(HasSetProp); +static_assert(HasIteratorSetterCtor); + +static_assert( + !DeclaresOwnSetProp, + "A subclass that inherits setProp without redeclaring it must not " + "satisfy the concept — its new fields would be skipped."); +static_assert(!HasIteratorSetterCtor); + +static_assert( + !DeclaresOwnSetProp, + "`using Base::setProp;` is not an own declaration."); +static_assert(!HasIteratorSetterCtor); + +// Baselines: `Props` itself owns `setProp`, so it satisfies the concept. +static_assert(DeclaresOwnSetProp); +static_assert(HasIteratorSetterCtor); + +} // namespace + +// gtest entry so the file participates in the test binary (the +// static_asserts above are the real check — this just keeps gtest's +// test discovery happy). +TEST(PropsConceptsTest, ConceptAxiomsCompile) { + SUCCEED(); +} diff --git a/packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.cpp b/packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.cpp index 16aa4ac40d13..c89e439b9e3b 100644 --- a/packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.cpp +++ b/packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.cpp @@ -76,20 +76,23 @@ std::shared_ptr UIManager::createNode( {.tag = tag, .surfaceId = surfaceId, .instanceHandle = std::move(instanceHandle)}); - const auto props = componentDescriptor.cloneProps( + auto props = componentDescriptor.cloneProps( propsParserContext, nullptr, std::move(rawProps)); - const auto state = componentDescriptor.createInitialState(props, family); + auto state = componentDescriptor.createInitialState(props, family); + + // Add a "name" prop if this is the fallback component + if (fallbackDescriptor != nullptr && + fallbackDescriptor->getComponentHandle() == + componentDescriptor.getComponentHandle()) { + props = componentDescriptor.cloneProps( + propsParserContext, + props, + RawProps(folly::dynamic::object("name", name))); + } auto shadowNode = componentDescriptor.createShadowNode( ShadowNodeFragment{ - .props = fallbackDescriptor != nullptr && - fallbackDescriptor->getComponentHandle() == - componentDescriptor.getComponentHandle() - ? componentDescriptor.cloneProps( - propsParserContext, - props, - RawProps(folly::dynamic::object("name", name))) - : props, + .props = props, .children = ShadowNodeFragment::childrenPlaceholder(), .state = state, }, diff --git a/scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api b/scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api index d484218abb9d..ff57a45216a0 100644 --- a/scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api @@ -796,6 +796,15 @@ concept facebook::react::CSSSyntaxVisitorReturn = std::is_default_constructible_ template concept facebook::react::CSSValidCompoundDataType = facebook::react::detail::is_variant_of_data_types::value; template +concept facebook::react::DeclaresOwnSetProp = std::is_same_v; +template +concept facebook::react::HasIteratorSetterCtor = std::copy_constructible && std::derived_from && HasSetProp; +template +concept facebook::react::HasSetProp = DeclaresOwnSetProp && +requires(T& t, const facebook::react::PropsParserContext& ctx, facebook::react::RawPropsPropNameHash hash, const char* name, const facebook::react::RawValue& value) { + { t.setProp(ctx, hash, name, value) } -> std::same_as; +}; +template concept facebook::react::Hashable = !std::is_same_v&& (requires(T a) { { std::hash{}(a) } -> std::convertible_to; }); @@ -4121,7 +4130,7 @@ class facebook::react::PreparedTextCacheKey { class facebook::react::Props : public virtual facebook::react::Sealable, public virtual facebook::react::DebugStringConvertible { public Props() = default; - public Props(const facebook::react::Props& other) = delete; + public Props(const facebook::react::Props& other) = default; public Props(const facebook::react::PropsParserContext& context, const facebook::react::Props& sourceProps, const facebook::react::RawProps& rawProps, const std::function& filterObjectKeys = nullptr); public facebook::react::Props& operator=(const facebook::react::Props& other) = delete; public folly::dynamic rawProps; @@ -4192,6 +4201,8 @@ class facebook::react::RawProps { public folly::dynamic toDynamic(const std::function& filterObjectKeys = nullptr) const; public operator folly::dynamic() const; public void parse(const facebook::react::RawPropsParser& parser) noexcept; + template + public void forEachItem(Fn fn) const; } enum facebook::react::RawProps::Mode { @@ -8259,6 +8270,7 @@ class facebook::react::ConcreteShadowNode : public BaseShadowNodeT { public static facebook::react::ComponentHandle Handle(); public static facebook::react::ComponentName Name(); public static facebook::react::ConcreteShadowNode::ConcreteStateData initialStateData(const facebook::react::Props::Shared&, const facebook::react::ShadowNodeFamily::Shared&, const facebook::react::ComponentDescriptor&); + public static facebook::react::ConcreteShadowNode::UnsharedConcreteProps Props(const facebook::react::Props::Shared& baseProps); public static facebook::react::ConcreteShadowNode::UnsharedConcreteProps Props(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const facebook::react::Props::Shared& baseProps = nullptr); public static facebook::react::ShadowNodeTraits BaseTraits(); public static void initializeDynamicProps(facebook::react::ConcreteShadowNode::UnsharedConcreteProps props, const facebook::react::RawProps& rawProps, const facebook::react::Props::Shared& baseProps = nullptr); @@ -9943,6 +9955,8 @@ template std::optional facebook::react::detail::parseLegacyHslFunction(facebook::react::CSSValueParser& parser); template std::optional facebook::react::detail::parseModernHslFunction(facebook::react::CSSValueParser& parser); +template +C facebook::react::detail::memberFunctionClass(T C::*); template constexpr std::optional facebook::react::detail::normalizeComponent(const std::variant& component, float baseValue); diff --git a/scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api b/scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api index ce3256b5f8be..2e51db8ac4a8 100644 --- a/scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api @@ -795,6 +795,15 @@ concept facebook::react::CSSSyntaxVisitorReturn = std::is_default_constructible_ template concept facebook::react::CSSValidCompoundDataType = facebook::react::detail::is_variant_of_data_types::value; template +concept facebook::react::DeclaresOwnSetProp = std::is_same_v; +template +concept facebook::react::HasIteratorSetterCtor = std::copy_constructible && std::derived_from && HasSetProp; +template +concept facebook::react::HasSetProp = DeclaresOwnSetProp && +requires(T& t, const facebook::react::PropsParserContext& ctx, facebook::react::RawPropsPropNameHash hash, const char* name, const facebook::react::RawValue& value) { + { t.setProp(ctx, hash, name, value) } -> std::same_as; +}; +template concept facebook::react::Hashable = !std::is_same_v&& (requires(T a) { { std::hash{}(a) } -> std::convertible_to; }); @@ -3975,7 +3984,7 @@ class facebook::react::PreparedTextCacheKey { class facebook::react::Props : public virtual facebook::react::Sealable, public virtual facebook::react::DebugStringConvertible { public Props() = default; - public Props(const facebook::react::Props& other) = delete; + public Props(const facebook::react::Props& other) = default; public Props(const facebook::react::PropsParserContext& context, const facebook::react::Props& sourceProps, const facebook::react::RawProps& rawProps, const std::function& filterObjectKeys = nullptr); public facebook::react::Props& operator=(const facebook::react::Props& other) = delete; public folly::dynamic rawProps; @@ -4036,6 +4045,8 @@ class facebook::react::RawProps { public folly::dynamic toDynamic(const std::function& filterObjectKeys = nullptr) const; public operator folly::dynamic() const; public void parse(const facebook::react::RawPropsParser& parser) noexcept; + template + public void forEachItem(Fn fn) const; } enum facebook::react::RawProps::Mode { @@ -8020,6 +8031,7 @@ class facebook::react::ConcreteShadowNode : public BaseShadowNodeT { public static facebook::react::ComponentHandle Handle(); public static facebook::react::ComponentName Name(); public static facebook::react::ConcreteShadowNode::ConcreteStateData initialStateData(const facebook::react::Props::Shared&, const facebook::react::ShadowNodeFamily::Shared&, const facebook::react::ComponentDescriptor&); + public static facebook::react::ConcreteShadowNode::UnsharedConcreteProps Props(const facebook::react::Props::Shared& baseProps); public static facebook::react::ConcreteShadowNode::UnsharedConcreteProps Props(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const facebook::react::Props::Shared& baseProps = nullptr); public static facebook::react::ShadowNodeTraits BaseTraits(); public static void initializeDynamicProps(facebook::react::ConcreteShadowNode::UnsharedConcreteProps props, const facebook::react::RawProps& rawProps, const facebook::react::Props::Shared& baseProps = nullptr); @@ -9566,6 +9578,8 @@ template std::optional facebook::react::detail::parseLegacyHslFunction(facebook::react::CSSValueParser& parser); template std::optional facebook::react::detail::parseModernHslFunction(facebook::react::CSSValueParser& parser); +template +C facebook::react::detail::memberFunctionClass(T C::*); template constexpr std::optional facebook::react::detail::normalizeComponent(const std::variant& component, float baseValue); diff --git a/scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api b/scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api index 04c7b0691b18..575bda3b8739 100644 --- a/scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api @@ -796,6 +796,15 @@ concept facebook::react::CSSSyntaxVisitorReturn = std::is_default_constructible_ template concept facebook::react::CSSValidCompoundDataType = facebook::react::detail::is_variant_of_data_types::value; template +concept facebook::react::DeclaresOwnSetProp = std::is_same_v; +template +concept facebook::react::HasIteratorSetterCtor = std::copy_constructible && std::derived_from && HasSetProp; +template +concept facebook::react::HasSetProp = DeclaresOwnSetProp && +requires(T& t, const facebook::react::PropsParserContext& ctx, facebook::react::RawPropsPropNameHash hash, const char* name, const facebook::react::RawValue& value) { + { t.setProp(ctx, hash, name, value) } -> std::same_as; +}; +template concept facebook::react::Hashable = !std::is_same_v&& (requires(T a) { { std::hash{}(a) } -> std::convertible_to; }); @@ -4118,7 +4127,7 @@ class facebook::react::PreparedTextCacheKey { class facebook::react::Props : public virtual facebook::react::Sealable, public virtual facebook::react::DebugStringConvertible { public Props() = default; - public Props(const facebook::react::Props& other) = delete; + public Props(const facebook::react::Props& other) = default; public Props(const facebook::react::PropsParserContext& context, const facebook::react::Props& sourceProps, const facebook::react::RawProps& rawProps, const std::function& filterObjectKeys = nullptr); public facebook::react::Props& operator=(const facebook::react::Props& other) = delete; public folly::dynamic rawProps; @@ -4189,6 +4198,8 @@ class facebook::react::RawProps { public folly::dynamic toDynamic(const std::function& filterObjectKeys = nullptr) const; public operator folly::dynamic() const; public void parse(const facebook::react::RawPropsParser& parser) noexcept; + template + public void forEachItem(Fn fn) const; } enum facebook::react::RawProps::Mode { @@ -8250,6 +8261,7 @@ class facebook::react::ConcreteShadowNode : public BaseShadowNodeT { public static facebook::react::ComponentHandle Handle(); public static facebook::react::ComponentName Name(); public static facebook::react::ConcreteShadowNode::ConcreteStateData initialStateData(const facebook::react::Props::Shared&, const facebook::react::ShadowNodeFamily::Shared&, const facebook::react::ComponentDescriptor&); + public static facebook::react::ConcreteShadowNode::UnsharedConcreteProps Props(const facebook::react::Props::Shared& baseProps); public static facebook::react::ConcreteShadowNode::UnsharedConcreteProps Props(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const facebook::react::Props::Shared& baseProps = nullptr); public static facebook::react::ShadowNodeTraits BaseTraits(); public static void initializeDynamicProps(facebook::react::ConcreteShadowNode::UnsharedConcreteProps props, const facebook::react::RawProps& rawProps, const facebook::react::Props::Shared& baseProps = nullptr); @@ -9796,6 +9808,8 @@ template std::optional facebook::react::detail::parseLegacyHslFunction(facebook::react::CSSValueParser& parser); template std::optional facebook::react::detail::parseModernHslFunction(facebook::react::CSSValueParser& parser); +template +C facebook::react::detail::memberFunctionClass(T C::*); template constexpr std::optional facebook::react::detail::normalizeComponent(const std::variant& component, float baseValue); diff --git a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api index 6e8bf9f249d1..54ddf2960fb5 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api @@ -3651,6 +3651,15 @@ concept facebook::react::CSSSyntaxVisitorReturn = std::is_default_constructible_ template concept facebook::react::CSSValidCompoundDataType = facebook::react::detail::is_variant_of_data_types::value; template +concept facebook::react::DeclaresOwnSetProp = std::is_same_v; +template +concept facebook::react::HasIteratorSetterCtor = std::copy_constructible && std::derived_from && HasSetProp; +template +concept facebook::react::HasSetProp = DeclaresOwnSetProp && +requires(T& t, const facebook::react::PropsParserContext& ctx, facebook::react::RawPropsPropNameHash hash, const char* name, const facebook::react::RawValue& value) { + { t.setProp(ctx, hash, name, value) } -> std::same_as; +}; +template concept facebook::react::Hashable = !std::is_same_v&& (requires(T a) { { std::hash{}(a) } -> std::convertible_to; }); @@ -6313,7 +6322,7 @@ class facebook::react::PreparedTextCacheKey { class facebook::react::Props : public virtual facebook::react::Sealable, public virtual facebook::react::DebugStringConvertible { public Props() = default; - public Props(const facebook::react::Props& other) = delete; + public Props(const facebook::react::Props& other) = default; public Props(const facebook::react::PropsParserContext& context, const facebook::react::Props& sourceProps, const facebook::react::RawProps& rawProps, const std::function& filterObjectKeys = nullptr); public facebook::react::Props& operator=(const facebook::react::Props& other) = delete; public std::string nativeId; @@ -6414,6 +6423,8 @@ class facebook::react::RawProps { public folly::dynamic toDynamic(const std::function& filterObjectKeys = nullptr) const; public operator folly::dynamic() const; public void parse(const facebook::react::RawPropsParser& parser) noexcept; + template + public void forEachItem(Fn fn) const; } enum facebook::react::RawProps::Mode { @@ -10245,6 +10256,7 @@ class facebook::react::ConcreteShadowNode : public BaseShadowNodeT { public static facebook::react::ComponentHandle Handle(); public static facebook::react::ComponentName Name(); public static facebook::react::ConcreteShadowNode::ConcreteStateData initialStateData(const facebook::react::Props::Shared&, const facebook::react::ShadowNodeFamily::Shared&, const facebook::react::ComponentDescriptor&); + public static facebook::react::ConcreteShadowNode::UnsharedConcreteProps Props(const facebook::react::Props::Shared& baseProps); public static facebook::react::ConcreteShadowNode::UnsharedConcreteProps Props(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const facebook::react::Props::Shared& baseProps = nullptr); public static facebook::react::ShadowNodeTraits BaseTraits(); public using ConcreteEventEmitter = EventEmitterT; @@ -11846,6 +11858,8 @@ template std::optional facebook::react::detail::parseLegacyHslFunction(facebook::react::CSSValueParser& parser); template std::optional facebook::react::detail::parseModernHslFunction(facebook::react::CSSValueParser& parser); +template +C facebook::react::detail::memberFunctionClass(T C::*); template constexpr std::optional facebook::react::detail::normalizeComponent(const std::variant& component, float baseValue); diff --git a/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api index 8c903a172ef6..f3c000a4e908 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api @@ -3638,6 +3638,15 @@ concept facebook::react::CSSSyntaxVisitorReturn = std::is_default_constructible_ template concept facebook::react::CSSValidCompoundDataType = facebook::react::detail::is_variant_of_data_types::value; template +concept facebook::react::DeclaresOwnSetProp = std::is_same_v; +template +concept facebook::react::HasIteratorSetterCtor = std::copy_constructible && std::derived_from && HasSetProp; +template +concept facebook::react::HasSetProp = DeclaresOwnSetProp && +requires(T& t, const facebook::react::PropsParserContext& ctx, facebook::react::RawPropsPropNameHash hash, const char* name, const facebook::react::RawValue& value) { + { t.setProp(ctx, hash, name, value) } -> std::same_as; +}; +template concept facebook::react::Hashable = !std::is_same_v&& (requires(T a) { { std::hash{}(a) } -> std::convertible_to; }); @@ -6195,7 +6204,7 @@ class facebook::react::PreparedTextCacheKey { class facebook::react::Props : public virtual facebook::react::Sealable, public virtual facebook::react::DebugStringConvertible { public Props() = default; - public Props(const facebook::react::Props& other) = delete; + public Props(const facebook::react::Props& other) = default; public Props(const facebook::react::PropsParserContext& context, const facebook::react::Props& sourceProps, const facebook::react::RawProps& rawProps, const std::function& filterObjectKeys = nullptr); public facebook::react::Props& operator=(const facebook::react::Props& other) = delete; public std::string nativeId; @@ -6286,6 +6295,8 @@ class facebook::react::RawProps { public folly::dynamic toDynamic(const std::function& filterObjectKeys = nullptr) const; public operator folly::dynamic() const; public void parse(const facebook::react::RawPropsParser& parser) noexcept; + template + public void forEachItem(Fn fn) const; } enum facebook::react::RawProps::Mode { @@ -10058,6 +10069,7 @@ class facebook::react::ConcreteShadowNode : public BaseShadowNodeT { public static facebook::react::ComponentHandle Handle(); public static facebook::react::ComponentName Name(); public static facebook::react::ConcreteShadowNode::ConcreteStateData initialStateData(const facebook::react::Props::Shared&, const facebook::react::ShadowNodeFamily::Shared&, const facebook::react::ComponentDescriptor&); + public static facebook::react::ConcreteShadowNode::UnsharedConcreteProps Props(const facebook::react::Props::Shared& baseProps); public static facebook::react::ConcreteShadowNode::UnsharedConcreteProps Props(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const facebook::react::Props::Shared& baseProps = nullptr); public static facebook::react::ShadowNodeTraits BaseTraits(); public using ConcreteEventEmitter = EventEmitterT; @@ -11531,6 +11543,8 @@ template std::optional facebook::react::detail::parseLegacyHslFunction(facebook::react::CSSValueParser& parser); template std::optional facebook::react::detail::parseModernHslFunction(facebook::react::CSSValueParser& parser); +template +C facebook::react::detail::memberFunctionClass(T C::*); template constexpr std::optional facebook::react::detail::normalizeComponent(const std::variant& component, float baseValue); diff --git a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api index 6f48057c356d..b8e5cb75e059 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api @@ -3651,6 +3651,15 @@ concept facebook::react::CSSSyntaxVisitorReturn = std::is_default_constructible_ template concept facebook::react::CSSValidCompoundDataType = facebook::react::detail::is_variant_of_data_types::value; template +concept facebook::react::DeclaresOwnSetProp = std::is_same_v; +template +concept facebook::react::HasIteratorSetterCtor = std::copy_constructible && std::derived_from && HasSetProp; +template +concept facebook::react::HasSetProp = DeclaresOwnSetProp && +requires(T& t, const facebook::react::PropsParserContext& ctx, facebook::react::RawPropsPropNameHash hash, const char* name, const facebook::react::RawValue& value) { + { t.setProp(ctx, hash, name, value) } -> std::same_as; +}; +template concept facebook::react::Hashable = !std::is_same_v&& (requires(T a) { { std::hash{}(a) } -> std::convertible_to; }); @@ -6310,7 +6319,7 @@ class facebook::react::PreparedTextCacheKey { class facebook::react::Props : public virtual facebook::react::Sealable, public virtual facebook::react::DebugStringConvertible { public Props() = default; - public Props(const facebook::react::Props& other) = delete; + public Props(const facebook::react::Props& other) = default; public Props(const facebook::react::PropsParserContext& context, const facebook::react::Props& sourceProps, const facebook::react::RawProps& rawProps, const std::function& filterObjectKeys = nullptr); public facebook::react::Props& operator=(const facebook::react::Props& other) = delete; public std::string nativeId; @@ -6411,6 +6420,8 @@ class facebook::react::RawProps { public folly::dynamic toDynamic(const std::function& filterObjectKeys = nullptr) const; public operator folly::dynamic() const; public void parse(const facebook::react::RawPropsParser& parser) noexcept; + template + public void forEachItem(Fn fn) const; } enum facebook::react::RawProps::Mode { @@ -10236,6 +10247,7 @@ class facebook::react::ConcreteShadowNode : public BaseShadowNodeT { public static facebook::react::ComponentHandle Handle(); public static facebook::react::ComponentName Name(); public static facebook::react::ConcreteShadowNode::ConcreteStateData initialStateData(const facebook::react::Props::Shared&, const facebook::react::ShadowNodeFamily::Shared&, const facebook::react::ComponentDescriptor&); + public static facebook::react::ConcreteShadowNode::UnsharedConcreteProps Props(const facebook::react::Props::Shared& baseProps); public static facebook::react::ConcreteShadowNode::UnsharedConcreteProps Props(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const facebook::react::Props::Shared& baseProps = nullptr); public static facebook::react::ShadowNodeTraits BaseTraits(); public using ConcreteEventEmitter = EventEmitterT; @@ -11709,6 +11721,8 @@ template std::optional facebook::react::detail::parseLegacyHslFunction(facebook::react::CSSValueParser& parser); template std::optional facebook::react::detail::parseModernHslFunction(facebook::react::CSSValueParser& parser); +template +C facebook::react::detail::memberFunctionClass(T C::*); template constexpr std::optional facebook::react::detail::normalizeComponent(const std::variant& component, float baseValue); diff --git a/scripts/cxx-api/api-snapshots/ReactCommonDebugCxx.api b/scripts/cxx-api/api-snapshots/ReactCommonDebugCxx.api index 66d75beaa700..d1e474bf6361 100644 --- a/scripts/cxx-api/api-snapshots/ReactCommonDebugCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactCommonDebugCxx.api @@ -405,6 +405,15 @@ concept facebook::react::CSSSyntaxVisitorReturn = std::is_default_constructible_ template concept facebook::react::CSSValidCompoundDataType = facebook::react::detail::is_variant_of_data_types::value; template +concept facebook::react::DeclaresOwnSetProp = std::is_same_v; +template +concept facebook::react::HasIteratorSetterCtor = std::copy_constructible && std::derived_from && HasSetProp; +template +concept facebook::react::HasSetProp = DeclaresOwnSetProp && +requires(T& t, const facebook::react::PropsParserContext& ctx, facebook::react::RawPropsPropNameHash hash, const char* name, const facebook::react::RawValue& value) { + { t.setProp(ctx, hash, name, value) } -> std::same_as; +}; +template concept facebook::react::Hashable = !std::is_same_v&& (requires(T a) { { std::hash{}(a) } -> std::convertible_to; }); @@ -2733,7 +2742,7 @@ class facebook::react::PreparedTextCacheKey { class facebook::react::Props : public virtual facebook::react::Sealable, public virtual facebook::react::DebugStringConvertible { public Props() = default; - public Props(const facebook::react::Props& other) = delete; + public Props(const facebook::react::Props& other) = default; public Props(const facebook::react::PropsParserContext& context, const facebook::react::Props& sourceProps, const facebook::react::RawProps& rawProps, const std::function& filterObjectKeys = nullptr); public facebook::react::Props& operator=(const facebook::react::Props& other) = delete; public std::string nativeId; @@ -2781,6 +2790,8 @@ class facebook::react::RawProps { public folly::dynamic toDynamic(const std::function& filterObjectKeys = nullptr) const; public operator folly::dynamic() const; public void parse(const facebook::react::RawPropsParser& parser) noexcept; + template + public void forEachItem(Fn fn) const; } enum facebook::react::RawProps::Mode { @@ -6356,6 +6367,7 @@ class facebook::react::ConcreteShadowNode : public BaseShadowNodeT { public static facebook::react::ComponentHandle Handle(); public static facebook::react::ComponentName Name(); public static facebook::react::ConcreteShadowNode::ConcreteStateData initialStateData(const facebook::react::Props::Shared&, const facebook::react::ShadowNodeFamily::Shared&, const facebook::react::ComponentDescriptor&); + public static facebook::react::ConcreteShadowNode::UnsharedConcreteProps Props(const facebook::react::Props::Shared& baseProps); public static facebook::react::ConcreteShadowNode::UnsharedConcreteProps Props(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const facebook::react::Props::Shared& baseProps = nullptr); public static facebook::react::ShadowNodeTraits BaseTraits(); public using ConcreteEventEmitter = EventEmitterT; @@ -7010,6 +7022,8 @@ template std::optional facebook::react::detail::parseLegacyHslFunction(facebook::react::CSSValueParser& parser); template std::optional facebook::react::detail::parseModernHslFunction(facebook::react::CSSValueParser& parser); +template +C facebook::react::detail::memberFunctionClass(T C::*); template constexpr std::optional facebook::react::detail::normalizeComponent(const std::variant& component, float baseValue); diff --git a/scripts/cxx-api/api-snapshots/ReactCommonNewarchCxx.api b/scripts/cxx-api/api-snapshots/ReactCommonNewarchCxx.api index cd680589a109..7875fed9493e 100644 --- a/scripts/cxx-api/api-snapshots/ReactCommonNewarchCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactCommonNewarchCxx.api @@ -404,6 +404,15 @@ concept facebook::react::CSSSyntaxVisitorReturn = std::is_default_constructible_ template concept facebook::react::CSSValidCompoundDataType = facebook::react::detail::is_variant_of_data_types::value; template +concept facebook::react::DeclaresOwnSetProp = std::is_same_v; +template +concept facebook::react::HasIteratorSetterCtor = std::copy_constructible && std::derived_from && HasSetProp; +template +concept facebook::react::HasSetProp = DeclaresOwnSetProp && +requires(T& t, const facebook::react::PropsParserContext& ctx, facebook::react::RawPropsPropNameHash hash, const char* name, const facebook::react::RawValue& value) { + { t.setProp(ctx, hash, name, value) } -> std::same_as; +}; +template concept facebook::react::Hashable = !std::is_same_v&& (requires(T a) { { std::hash{}(a) } -> std::convertible_to; }); @@ -2627,7 +2636,7 @@ class facebook::react::PreparedTextCacheKey { class facebook::react::Props : public virtual facebook::react::Sealable, public virtual facebook::react::DebugStringConvertible { public Props() = default; - public Props(const facebook::react::Props& other) = delete; + public Props(const facebook::react::Props& other) = default; public Props(const facebook::react::PropsParserContext& context, const facebook::react::Props& sourceProps, const facebook::react::RawProps& rawProps, const std::function& filterObjectKeys = nullptr); public facebook::react::Props& operator=(const facebook::react::Props& other) = delete; public std::string nativeId; @@ -2665,6 +2674,8 @@ class facebook::react::RawProps { public folly::dynamic toDynamic(const std::function& filterObjectKeys = nullptr) const; public operator folly::dynamic() const; public void parse(const facebook::react::RawPropsParser& parser) noexcept; + template + public void forEachItem(Fn fn) const; } enum facebook::react::RawProps::Mode { @@ -6181,6 +6192,7 @@ class facebook::react::ConcreteShadowNode : public BaseShadowNodeT { public static facebook::react::ComponentHandle Handle(); public static facebook::react::ComponentName Name(); public static facebook::react::ConcreteShadowNode::ConcreteStateData initialStateData(const facebook::react::Props::Shared&, const facebook::react::ShadowNodeFamily::Shared&, const facebook::react::ComponentDescriptor&); + public static facebook::react::ConcreteShadowNode::UnsharedConcreteProps Props(const facebook::react::Props::Shared& baseProps); public static facebook::react::ConcreteShadowNode::UnsharedConcreteProps Props(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const facebook::react::Props::Shared& baseProps = nullptr); public static facebook::react::ShadowNodeTraits BaseTraits(); public using ConcreteEventEmitter = EventEmitterT; @@ -6835,6 +6847,8 @@ template std::optional facebook::react::detail::parseLegacyHslFunction(facebook::react::CSSValueParser& parser); template std::optional facebook::react::detail::parseModernHslFunction(facebook::react::CSSValueParser& parser); +template +C facebook::react::detail::memberFunctionClass(T C::*); template constexpr std::optional facebook::react::detail::normalizeComponent(const std::variant& component, float baseValue); diff --git a/scripts/cxx-api/api-snapshots/ReactCommonReleaseCxx.api b/scripts/cxx-api/api-snapshots/ReactCommonReleaseCxx.api index b6573d00004b..4c41971bd4f5 100644 --- a/scripts/cxx-api/api-snapshots/ReactCommonReleaseCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactCommonReleaseCxx.api @@ -405,6 +405,15 @@ concept facebook::react::CSSSyntaxVisitorReturn = std::is_default_constructible_ template concept facebook::react::CSSValidCompoundDataType = facebook::react::detail::is_variant_of_data_types::value; template +concept facebook::react::DeclaresOwnSetProp = std::is_same_v; +template +concept facebook::react::HasIteratorSetterCtor = std::copy_constructible && std::derived_from && HasSetProp; +template +concept facebook::react::HasSetProp = DeclaresOwnSetProp && +requires(T& t, const facebook::react::PropsParserContext& ctx, facebook::react::RawPropsPropNameHash hash, const char* name, const facebook::react::RawValue& value) { + { t.setProp(ctx, hash, name, value) } -> std::same_as; +}; +template concept facebook::react::Hashable = !std::is_same_v&& (requires(T a) { { std::hash{}(a) } -> std::convertible_to; }); @@ -2730,7 +2739,7 @@ class facebook::react::PreparedTextCacheKey { class facebook::react::Props : public virtual facebook::react::Sealable, public virtual facebook::react::DebugStringConvertible { public Props() = default; - public Props(const facebook::react::Props& other) = delete; + public Props(const facebook::react::Props& other) = default; public Props(const facebook::react::PropsParserContext& context, const facebook::react::Props& sourceProps, const facebook::react::RawProps& rawProps, const std::function& filterObjectKeys = nullptr); public facebook::react::Props& operator=(const facebook::react::Props& other) = delete; public std::string nativeId; @@ -2778,6 +2787,8 @@ class facebook::react::RawProps { public folly::dynamic toDynamic(const std::function& filterObjectKeys = nullptr) const; public operator folly::dynamic() const; public void parse(const facebook::react::RawPropsParser& parser) noexcept; + template + public void forEachItem(Fn fn) const; } enum facebook::react::RawProps::Mode { @@ -6347,6 +6358,7 @@ class facebook::react::ConcreteShadowNode : public BaseShadowNodeT { public static facebook::react::ComponentHandle Handle(); public static facebook::react::ComponentName Name(); public static facebook::react::ConcreteShadowNode::ConcreteStateData initialStateData(const facebook::react::Props::Shared&, const facebook::react::ShadowNodeFamily::Shared&, const facebook::react::ComponentDescriptor&); + public static facebook::react::ConcreteShadowNode::UnsharedConcreteProps Props(const facebook::react::Props::Shared& baseProps); public static facebook::react::ConcreteShadowNode::UnsharedConcreteProps Props(const facebook::react::PropsParserContext& context, const facebook::react::RawProps& rawProps, const facebook::react::Props::Shared& baseProps = nullptr); public static facebook::react::ShadowNodeTraits BaseTraits(); public using ConcreteEventEmitter = EventEmitterT; @@ -7001,6 +7013,8 @@ template std::optional facebook::react::detail::parseLegacyHslFunction(facebook::react::CSSValueParser& parser); template std::optional facebook::react::detail::parseModernHslFunction(facebook::react::CSSValueParser& parser); +template +C facebook::react::detail::memberFunctionClass(T C::*); template constexpr std::optional facebook::react::detail::normalizeComponent(const std::variant& component, float baseValue);