diff --git a/React/Fabric/RCTSurfacePresenter.mm b/React/Fabric/RCTSurfacePresenter.mm index e32e535b5eda21..8246a177b9b5dc 100644 --- a/React/Fabric/RCTSurfacePresenter.mm +++ b/React/Fabric/RCTSurfacePresenter.mm @@ -28,6 +28,7 @@ #import #import #import +#import #import #import #import @@ -271,7 +272,7 @@ - (RCTScheduler *)_createScheduler } if (reactNativeConfig && reactNativeConfig->getBool("react_fabric:enable_cpp_props_iterator_setter_ios")) { - Props::enablePropIteratorSetter = true; + CoreFeatures::enablePropIteratorSetter = true; AccessibilityProps::enablePropIteratorSetter = true; BaseTextProps::enablePropIteratorSetter = true; } diff --git a/ReactAndroid/src/main/jni/react/fabric/Binding.cpp b/ReactAndroid/src/main/jni/react/fabric/Binding.cpp index a0b1118c0327c4..f33b244cf9bb34 100644 --- a/ReactAndroid/src/main/jni/react/fabric/Binding.cpp +++ b/ReactAndroid/src/main/jni/react/fabric/Binding.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -455,11 +456,12 @@ void Binding::installFabricUIManager( getFeatureFlagValue("enableLargeTextMeasureCache")); // Props setter pattern feature - Props::enablePropIteratorSetter = + CoreFeatures::enablePropIteratorSetter = getFeatureFlagValue("enableCppPropsIteratorSetter"); AccessibilityProps::enablePropIteratorSetter = - Props::enablePropIteratorSetter; - BaseTextProps::enablePropIteratorSetter = Props::enablePropIteratorSetter; + CoreFeatures::enablePropIteratorSetter; + BaseTextProps::enablePropIteratorSetter = + CoreFeatures::enablePropIteratorSetter; // RemoveDelete mega-op ShadowViewMutation::PlatformSupportsRemoveDeleteTreeInstruction = diff --git a/ReactAndroid/src/main/jni/react/fabric/FabricMountingManager.cpp b/ReactAndroid/src/main/jni/react/fabric/FabricMountingManager.cpp index a26aeeb4895355..08a47316351984 100644 --- a/ReactAndroid/src/main/jni/react/fabric/FabricMountingManager.cpp +++ b/ReactAndroid/src/main/jni/react/fabric/FabricMountingManager.cpp @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -51,7 +52,7 @@ FabricMountingManager::FabricMountingManager( useOverflowInset_(getFeatureFlagValue("useOverflowInset")), shouldRememberAllocatedViews_( getFeatureFlagValue("shouldRememberAllocatedViews")) { - Props::enableMapBuffer = getFeatureFlagValue("useMapBufferProps"); + CoreFeatures::enableMapBuffer = getFeatureFlagValue("useMapBufferProps"); } void FabricMountingManager::onSurfaceStart(SurfaceId surfaceId) { @@ -257,7 +258,7 @@ static inline float scale(Float value, Float pointScaleFactor) { local_ref FabricMountingManager::getProps( ShadowView const &oldShadowView, ShadowView const &newShadowView) { - if (Props::enableMapBuffer && + if (CoreFeatures::enableMapBuffer && newShadowView.traits.check( ShadowNodeTraits::Trait::AndroidMapBufferPropsSupported)) { react_native_assert( diff --git a/ReactCommon/react/renderer/components/image/ImageProps.cpp b/ReactCommon/react/renderer/components/image/ImageProps.cpp index 9dca74cded2574..ac5b5245277697 100644 --- a/ReactCommon/react/renderer/components/image/ImageProps.cpp +++ b/ReactCommon/react/renderer/components/image/ImageProps.cpp @@ -7,6 +7,7 @@ #include #include +#include #include namespace facebook { @@ -18,55 +19,57 @@ ImageProps::ImageProps( const RawProps &rawProps) : ViewProps(context, sourceProps, rawProps), sources( - Props::enablePropIteratorSetter ? sourceProps.sources - : convertRawProp( - context, - rawProps, - "source", - sourceProps.sources, - {})), + CoreFeatures::enablePropIteratorSetter ? sourceProps.sources + : convertRawProp( + context, + rawProps, + "source", + sourceProps.sources, + {})), defaultSources( - Props::enablePropIteratorSetter ? sourceProps.defaultSources - : convertRawProp( - context, - rawProps, - "defaultSource", - sourceProps.defaultSources, - {})), + CoreFeatures::enablePropIteratorSetter + ? sourceProps.defaultSources + : convertRawProp( + context, + rawProps, + "defaultSource", + sourceProps.defaultSources, + {})), resizeMode( - Props::enablePropIteratorSetter ? sourceProps.resizeMode - : convertRawProp( - context, - rawProps, - "resizeMode", - sourceProps.resizeMode, - ImageResizeMode::Stretch)), + CoreFeatures::enablePropIteratorSetter + ? sourceProps.resizeMode + : convertRawProp( + context, + rawProps, + "resizeMode", + sourceProps.resizeMode, + ImageResizeMode::Stretch)), blurRadius( - Props::enablePropIteratorSetter ? sourceProps.blurRadius - : convertRawProp( - context, - rawProps, - "blurRadius", - sourceProps.blurRadius, - {})), + CoreFeatures::enablePropIteratorSetter ? sourceProps.blurRadius + : convertRawProp( + context, + rawProps, + "blurRadius", + sourceProps.blurRadius, + {})), capInsets( - Props::enablePropIteratorSetter ? sourceProps.capInsets - : convertRawProp( - context, - rawProps, - "capInsets", - sourceProps.capInsets, - {})), + CoreFeatures::enablePropIteratorSetter ? sourceProps.capInsets + : convertRawProp( + context, + rawProps, + "capInsets", + sourceProps.capInsets, + {})), tintColor( - Props::enablePropIteratorSetter ? sourceProps.tintColor - : convertRawProp( - context, - rawProps, - "tintColor", - sourceProps.tintColor, - {})), + CoreFeatures::enablePropIteratorSetter ? sourceProps.tintColor + : convertRawProp( + context, + rawProps, + "tintColor", + sourceProps.tintColor, + {})), internal_analyticTag( - Props::enablePropIteratorSetter + CoreFeatures::enablePropIteratorSetter ? sourceProps.internal_analyticTag : convertRawProp( context, diff --git a/ReactCommon/react/renderer/components/scrollview/ScrollViewProps.cpp b/ReactCommon/react/renderer/components/scrollview/ScrollViewProps.cpp index ee6791cd97857e..1628b80fc5ed17 100644 --- a/ReactCommon/react/renderer/components/scrollview/ScrollViewProps.cpp +++ b/ReactCommon/react/renderer/components/scrollview/ScrollViewProps.cpp @@ -8,6 +8,7 @@ #include "ScrollViewProps.h" #include +#include #include #include @@ -22,7 +23,7 @@ ScrollViewProps::ScrollViewProps( RawProps const &rawProps) : ViewProps(context, sourceProps, rawProps), alwaysBounceHorizontal( - Props::enablePropIteratorSetter + CoreFeatures::enablePropIteratorSetter ? sourceProps.alwaysBounceHorizontal : convertRawProp( context, @@ -31,7 +32,7 @@ ScrollViewProps::ScrollViewProps( sourceProps.alwaysBounceHorizontal, {})), alwaysBounceVertical( - Props::enablePropIteratorSetter + CoreFeatures::enablePropIteratorSetter ? sourceProps.alwaysBounceVertical : convertRawProp( context, @@ -40,23 +41,23 @@ ScrollViewProps::ScrollViewProps( sourceProps.alwaysBounceVertical, {})), bounces( - Props::enablePropIteratorSetter ? sourceProps.bounces - : convertRawProp( - context, - rawProps, - "bounces", - sourceProps.bounces, - true)), + CoreFeatures::enablePropIteratorSetter ? sourceProps.bounces + : convertRawProp( + context, + rawProps, + "bounces", + sourceProps.bounces, + true)), bouncesZoom( - Props::enablePropIteratorSetter ? sourceProps.bouncesZoom - : convertRawProp( - context, - rawProps, - "bouncesZoom", - sourceProps.bouncesZoom, - true)), + CoreFeatures::enablePropIteratorSetter ? sourceProps.bouncesZoom + : convertRawProp( + context, + rawProps, + "bouncesZoom", + sourceProps.bouncesZoom, + true)), canCancelContentTouches( - Props::enablePropIteratorSetter + CoreFeatures::enablePropIteratorSetter ? sourceProps.canCancelContentTouches : convertRawProp( context, @@ -65,15 +66,16 @@ ScrollViewProps::ScrollViewProps( sourceProps.canCancelContentTouches, true)), centerContent( - Props::enablePropIteratorSetter ? sourceProps.centerContent - : convertRawProp( - context, - rawProps, - "centerContent", - sourceProps.centerContent, - {})), + CoreFeatures::enablePropIteratorSetter + ? sourceProps.centerContent + : convertRawProp( + context, + rawProps, + "centerContent", + sourceProps.centerContent, + {})), automaticallyAdjustContentInsets( - Props::enablePropIteratorSetter + CoreFeatures::enablePropIteratorSetter ? sourceProps.automaticallyAdjustContentInsets : convertRawProp( context, @@ -82,7 +84,7 @@ ScrollViewProps::ScrollViewProps( sourceProps.automaticallyAdjustContentInsets, {})), automaticallyAdjustsScrollIndicatorInsets( - Props::enablePropIteratorSetter + CoreFeatures::enablePropIteratorSetter ? sourceProps.automaticallyAdjustsScrollIndicatorInsets : convertRawProp( context, @@ -91,15 +93,16 @@ ScrollViewProps::ScrollViewProps( sourceProps.automaticallyAdjustsScrollIndicatorInsets, true)), decelerationRate( - Props::enablePropIteratorSetter ? sourceProps.decelerationRate - : convertRawProp( - context, - rawProps, - "decelerationRate", - sourceProps.decelerationRate, - (Float)0.998)), + CoreFeatures::enablePropIteratorSetter + ? sourceProps.decelerationRate + : convertRawProp( + context, + rawProps, + "decelerationRate", + sourceProps.decelerationRate, + (Float)0.998)), directionalLockEnabled( - Props::enablePropIteratorSetter + CoreFeatures::enablePropIteratorSetter ? sourceProps.directionalLockEnabled : convertRawProp( context, @@ -108,71 +111,78 @@ ScrollViewProps::ScrollViewProps( sourceProps.directionalLockEnabled, {})), indicatorStyle( - Props::enablePropIteratorSetter ? sourceProps.indicatorStyle - : convertRawProp( - context, - rawProps, - "indicatorStyle", - sourceProps.indicatorStyle, - {})), + CoreFeatures::enablePropIteratorSetter + ? sourceProps.indicatorStyle + : convertRawProp( + context, + rawProps, + "indicatorStyle", + sourceProps.indicatorStyle, + {})), keyboardDismissMode( - Props::enablePropIteratorSetter ? sourceProps.keyboardDismissMode - : convertRawProp( - context, - rawProps, - "keyboardDismissMode", - sourceProps.keyboardDismissMode, - {})), + CoreFeatures::enablePropIteratorSetter + ? sourceProps.keyboardDismissMode + : convertRawProp( + context, + rawProps, + "keyboardDismissMode", + sourceProps.keyboardDismissMode, + {})), maximumZoomScale( - Props::enablePropIteratorSetter ? sourceProps.maximumZoomScale - : convertRawProp( - context, - rawProps, - "maximumZoomScale", - sourceProps.maximumZoomScale, - (Float)1.0)), + CoreFeatures::enablePropIteratorSetter + ? sourceProps.maximumZoomScale + : convertRawProp( + context, + rawProps, + "maximumZoomScale", + sourceProps.maximumZoomScale, + (Float)1.0)), minimumZoomScale( - Props::enablePropIteratorSetter ? sourceProps.minimumZoomScale - : convertRawProp( - context, - rawProps, - "minimumZoomScale", - sourceProps.minimumZoomScale, - (Float)1.0)), + CoreFeatures::enablePropIteratorSetter + ? sourceProps.minimumZoomScale + : convertRawProp( + context, + rawProps, + "minimumZoomScale", + sourceProps.minimumZoomScale, + (Float)1.0)), scrollEnabled( - Props::enablePropIteratorSetter ? sourceProps.scrollEnabled - : convertRawProp( - context, - rawProps, - "scrollEnabled", - sourceProps.scrollEnabled, - true)), + CoreFeatures::enablePropIteratorSetter + ? sourceProps.scrollEnabled + : convertRawProp( + context, + rawProps, + "scrollEnabled", + sourceProps.scrollEnabled, + true)), pagingEnabled( - Props::enablePropIteratorSetter ? sourceProps.pagingEnabled - : convertRawProp( - context, - rawProps, - "pagingEnabled", - sourceProps.pagingEnabled, - {})), + CoreFeatures::enablePropIteratorSetter + ? sourceProps.pagingEnabled + : convertRawProp( + context, + rawProps, + "pagingEnabled", + sourceProps.pagingEnabled, + {})), pinchGestureEnabled( - Props::enablePropIteratorSetter ? sourceProps.pinchGestureEnabled - : convertRawProp( - context, - rawProps, - "pinchGestureEnabled", - sourceProps.pinchGestureEnabled, - true)), + CoreFeatures::enablePropIteratorSetter + ? sourceProps.pinchGestureEnabled + : convertRawProp( + context, + rawProps, + "pinchGestureEnabled", + sourceProps.pinchGestureEnabled, + true)), scrollsToTop( - Props::enablePropIteratorSetter ? sourceProps.scrollsToTop - : convertRawProp( - context, - rawProps, - "scrollsToTop", - sourceProps.scrollsToTop, - true)), + CoreFeatures::enablePropIteratorSetter ? sourceProps.scrollsToTop + : convertRawProp( + context, + rawProps, + "scrollsToTop", + sourceProps.scrollsToTop, + true)), showsHorizontalScrollIndicator( - Props::enablePropIteratorSetter + CoreFeatures::enablePropIteratorSetter ? sourceProps.showsHorizontalScrollIndicator : convertRawProp( context, @@ -181,7 +191,7 @@ ScrollViewProps::ScrollViewProps( sourceProps.showsHorizontalScrollIndicator, true)), showsVerticalScrollIndicator( - Props::enablePropIteratorSetter + CoreFeatures::enablePropIteratorSetter ? sourceProps.showsVerticalScrollIndicator : convertRawProp( context, @@ -190,39 +200,41 @@ ScrollViewProps::ScrollViewProps( sourceProps.showsVerticalScrollIndicator, true)), scrollEventThrottle( - Props::enablePropIteratorSetter ? sourceProps.scrollEventThrottle - : convertRawProp( - context, - rawProps, - "scrollEventThrottle", - sourceProps.scrollEventThrottle, - {})), + CoreFeatures::enablePropIteratorSetter + ? sourceProps.scrollEventThrottle + : convertRawProp( + context, + rawProps, + "scrollEventThrottle", + sourceProps.scrollEventThrottle, + {})), zoomScale( - Props::enablePropIteratorSetter ? sourceProps.zoomScale - : convertRawProp( - context, - rawProps, - "zoomScale", - sourceProps.zoomScale, - (Float)1.0)), + CoreFeatures::enablePropIteratorSetter ? sourceProps.zoomScale + : convertRawProp( + context, + rawProps, + "zoomScale", + sourceProps.zoomScale, + (Float)1.0)), contentInset( - Props::enablePropIteratorSetter ? sourceProps.contentInset - : convertRawProp( - context, - rawProps, - "contentInset", - sourceProps.contentInset, - {})), + CoreFeatures::enablePropIteratorSetter ? sourceProps.contentInset + : convertRawProp( + context, + rawProps, + "contentInset", + sourceProps.contentInset, + {})), contentOffset( - Props::enablePropIteratorSetter ? sourceProps.contentOffset - : convertRawProp( - context, - rawProps, - "contentOffset", - sourceProps.contentOffset, - {})), + CoreFeatures::enablePropIteratorSetter + ? sourceProps.contentOffset + : convertRawProp( + context, + rawProps, + "contentOffset", + sourceProps.contentOffset, + {})), scrollIndicatorInsets( - Props::enablePropIteratorSetter + CoreFeatures::enablePropIteratorSetter ? sourceProps.scrollIndicatorInsets : convertRawProp( context, @@ -231,23 +243,25 @@ ScrollViewProps::ScrollViewProps( sourceProps.scrollIndicatorInsets, {})), snapToInterval( - Props::enablePropIteratorSetter ? sourceProps.snapToInterval - : convertRawProp( - context, - rawProps, - "snapToInterval", - sourceProps.snapToInterval, - {})), + CoreFeatures::enablePropIteratorSetter + ? sourceProps.snapToInterval + : convertRawProp( + context, + rawProps, + "snapToInterval", + sourceProps.snapToInterval, + {})), snapToAlignment( - Props::enablePropIteratorSetter ? sourceProps.snapToAlignment - : convertRawProp( - context, - rawProps, - "snapToAlignment", - sourceProps.snapToAlignment, - {})), + CoreFeatures::enablePropIteratorSetter + ? sourceProps.snapToAlignment + : convertRawProp( + context, + rawProps, + "snapToAlignment", + sourceProps.snapToAlignment, + {})), disableIntervalMomentum( - Props::enablePropIteratorSetter + CoreFeatures::enablePropIteratorSetter ? sourceProps.disableIntervalMomentum : convertRawProp( context, @@ -256,31 +270,32 @@ ScrollViewProps::ScrollViewProps( sourceProps.disableIntervalMomentum, {})), snapToOffsets( - Props::enablePropIteratorSetter ? sourceProps.snapToOffsets - : convertRawProp( - context, - rawProps, - "snapToOffsets", - sourceProps.snapToOffsets, - {})), + CoreFeatures::enablePropIteratorSetter + ? sourceProps.snapToOffsets + : convertRawProp( + context, + rawProps, + "snapToOffsets", + sourceProps.snapToOffsets, + {})), snapToStart( - Props::enablePropIteratorSetter ? sourceProps.snapToStart - : convertRawProp( - context, - rawProps, - "snapToStart", - sourceProps.snapToStart, - true)), + CoreFeatures::enablePropIteratorSetter ? sourceProps.snapToStart + : convertRawProp( + context, + rawProps, + "snapToStart", + sourceProps.snapToStart, + true)), snapToEnd( - Props::enablePropIteratorSetter ? sourceProps.snapToEnd - : convertRawProp( - context, - rawProps, - "snapToEnd", - sourceProps.snapToEnd, - true)), + CoreFeatures::enablePropIteratorSetter ? sourceProps.snapToEnd + : convertRawProp( + context, + rawProps, + "snapToEnd", + sourceProps.snapToEnd, + true)), contentInsetAdjustmentBehavior( - Props::enablePropIteratorSetter + CoreFeatures::enablePropIteratorSetter ? sourceProps.contentInsetAdjustmentBehavior : convertRawProp( context, @@ -289,7 +304,7 @@ ScrollViewProps::ScrollViewProps( sourceProps.contentInsetAdjustmentBehavior, {ContentInsetAdjustmentBehavior::Never})), scrollToOverflowEnabled( - Props::enablePropIteratorSetter + CoreFeatures::enablePropIteratorSetter ? sourceProps.scrollToOverflowEnabled : convertRawProp( context, diff --git a/ReactCommon/react/renderer/components/text/ParagraphProps.cpp b/ReactCommon/react/renderer/components/text/ParagraphProps.cpp index d67322b2a1909b..3b018e94fa30d7 100644 --- a/ReactCommon/react/renderer/components/text/ParagraphProps.cpp +++ b/ReactCommon/react/renderer/components/text/ParagraphProps.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -24,28 +25,29 @@ ParagraphProps::ParagraphProps( : ViewProps(context, sourceProps, rawProps), BaseTextProps(context, sourceProps, rawProps), paragraphAttributes( - Props::enablePropIteratorSetter ? sourceProps.paragraphAttributes - : convertRawProp( - context, - rawProps, - sourceProps.paragraphAttributes, - {})), + CoreFeatures::enablePropIteratorSetter + ? sourceProps.paragraphAttributes + : convertRawProp( + context, + rawProps, + sourceProps.paragraphAttributes, + {})), isSelectable( - Props::enablePropIteratorSetter ? sourceProps.isSelectable - : convertRawProp( - context, - rawProps, - "selectable", - sourceProps.isSelectable, - false)), + CoreFeatures::enablePropIteratorSetter ? sourceProps.isSelectable + : convertRawProp( + context, + rawProps, + "selectable", + sourceProps.isSelectable, + false)), onTextLayout( - Props::enablePropIteratorSetter ? sourceProps.onTextLayout - : convertRawProp( - context, - rawProps, - "onTextLayout", - sourceProps.onTextLayout, - {})) { + CoreFeatures::enablePropIteratorSetter ? sourceProps.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/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputProps.cpp b/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputProps.cpp index 34d46416a30181..c6be890f2619ec 100644 --- a/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputProps.cpp +++ b/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputProps.cpp @@ -7,6 +7,7 @@ #include "AndroidTextInputProps.h" #include +#include #include #include @@ -42,219 +43,219 @@ AndroidTextInputProps::AndroidTextInputProps( const RawProps &rawProps) : ViewProps(context, sourceProps, rawProps), BaseTextProps(context, sourceProps, rawProps), - autoComplete(Props::enablePropIteratorSetter ? sourceProps.autoComplete : convertRawProp( + autoComplete(CoreFeatures::enablePropIteratorSetter? sourceProps.autoComplete : convertRawProp( context, rawProps, "autoComplete", sourceProps.autoComplete, {})), - returnKeyLabel(Props::enablePropIteratorSetter ? sourceProps.autoComplete : convertRawProp(context, rawProps, + returnKeyLabel(CoreFeatures::enablePropIteratorSetter? sourceProps.autoComplete : convertRawProp(context, rawProps, "returnKeyLabel", sourceProps.returnKeyLabel, {})), - numberOfLines(Props::enablePropIteratorSetter ? sourceProps.numberOfLines : convertRawProp(context, rawProps, + numberOfLines(CoreFeatures::enablePropIteratorSetter? sourceProps.numberOfLines : convertRawProp(context, rawProps, "numberOfLines", sourceProps.numberOfLines, {0})), - disableFullscreenUI(Props::enablePropIteratorSetter ? sourceProps.disableFullscreenUI : convertRawProp(context, rawProps, + disableFullscreenUI(CoreFeatures::enablePropIteratorSetter? sourceProps.disableFullscreenUI : convertRawProp(context, rawProps, "disableFullscreenUI", sourceProps.disableFullscreenUI, {false})), - textBreakStrategy(Props::enablePropIteratorSetter ? sourceProps.textBreakStrategy : convertRawProp(context, rawProps, + textBreakStrategy(CoreFeatures::enablePropIteratorSetter? sourceProps.textBreakStrategy : convertRawProp(context, rawProps, "textBreakStrategy", sourceProps.textBreakStrategy, {})), - underlineColorAndroid(Props::enablePropIteratorSetter ? sourceProps.underlineColorAndroid : convertRawProp(context, rawProps, + underlineColorAndroid(CoreFeatures::enablePropIteratorSetter? sourceProps.underlineColorAndroid : convertRawProp(context, rawProps, "underlineColorAndroid", sourceProps.underlineColorAndroid, {})), - inlineImageLeft(Props::enablePropIteratorSetter ? sourceProps.inlineImageLeft : convertRawProp(context, rawProps, + inlineImageLeft(CoreFeatures::enablePropIteratorSetter? sourceProps.inlineImageLeft : convertRawProp(context, rawProps, "inlineImageLeft", sourceProps.inlineImageLeft, {})), - inlineImagePadding(Props::enablePropIteratorSetter ? sourceProps.inlineImagePadding : convertRawProp(context, rawProps, + inlineImagePadding(CoreFeatures::enablePropIteratorSetter? sourceProps.inlineImagePadding : convertRawProp(context, rawProps, "inlineImagePadding", sourceProps.inlineImagePadding, {0})), - importantForAutofill(Props::enablePropIteratorSetter ? sourceProps.importantForAutofill : convertRawProp(context, rawProps, + importantForAutofill(CoreFeatures::enablePropIteratorSetter? sourceProps.importantForAutofill : convertRawProp(context, rawProps, "importantForAutofill", sourceProps.importantForAutofill, {})), - showSoftInputOnFocus(Props::enablePropIteratorSetter ? sourceProps.showSoftInputOnFocus : convertRawProp(context, rawProps, + showSoftInputOnFocus(CoreFeatures::enablePropIteratorSetter? sourceProps.showSoftInputOnFocus : convertRawProp(context, rawProps, "showSoftInputOnFocus", sourceProps.showSoftInputOnFocus, {false})), - autoCapitalize(Props::enablePropIteratorSetter ? sourceProps.autoCapitalize : convertRawProp(context, rawProps, + autoCapitalize(CoreFeatures::enablePropIteratorSetter? sourceProps.autoCapitalize : convertRawProp(context, rawProps, "autoCapitalize", sourceProps.autoCapitalize, {})), - autoCorrect(Props::enablePropIteratorSetter ? sourceProps.autoCorrect : convertRawProp(context, rawProps, + autoCorrect(CoreFeatures::enablePropIteratorSetter? sourceProps.autoCorrect : convertRawProp(context, rawProps, "autoCorrect", sourceProps.autoCorrect, {false})), - autoFocus(Props::enablePropIteratorSetter ? sourceProps.autoFocus : convertRawProp(context, rawProps, + autoFocus(CoreFeatures::enablePropIteratorSetter? sourceProps.autoFocus : convertRawProp(context, rawProps, "autoFocus", sourceProps.autoFocus, {false})), - allowFontScaling(Props::enablePropIteratorSetter ? sourceProps.allowFontScaling : convertRawProp(context, rawProps, + allowFontScaling(CoreFeatures::enablePropIteratorSetter? sourceProps.allowFontScaling : convertRawProp(context, rawProps, "allowFontScaling", sourceProps.allowFontScaling, {false})), - maxFontSizeMultiplier(Props::enablePropIteratorSetter ? sourceProps.maxFontSizeMultiplier : convertRawProp(context, rawProps, + maxFontSizeMultiplier(CoreFeatures::enablePropIteratorSetter? sourceProps.maxFontSizeMultiplier : convertRawProp(context, rawProps, "maxFontSizeMultiplier", sourceProps.maxFontSizeMultiplier, {0.0})), - editable(Props::enablePropIteratorSetter ? sourceProps.editable : + editable(CoreFeatures::enablePropIteratorSetter? sourceProps.editable : convertRawProp(context, rawProps, "editable", sourceProps.editable, {false})), - keyboardType(Props::enablePropIteratorSetter ? sourceProps.keyboardType : convertRawProp(context, rawProps, + keyboardType(CoreFeatures::enablePropIteratorSetter? sourceProps.keyboardType : convertRawProp(context, rawProps, "keyboardType", sourceProps.keyboardType, {})), - returnKeyType(Props::enablePropIteratorSetter ? sourceProps.returnKeyType : convertRawProp(context, rawProps, + returnKeyType(CoreFeatures::enablePropIteratorSetter? sourceProps.returnKeyType : convertRawProp(context, rawProps, "returnKeyType", sourceProps.returnKeyType, {})), - maxLength(Props::enablePropIteratorSetter ? sourceProps.maxLength : + maxLength(CoreFeatures::enablePropIteratorSetter? sourceProps.maxLength : convertRawProp(context, rawProps, "maxLength", sourceProps.maxLength, {0})), - multiline(Props::enablePropIteratorSetter ? sourceProps.multiline : convertRawProp(context, rawProps, + multiline(CoreFeatures::enablePropIteratorSetter? sourceProps.multiline : convertRawProp(context, rawProps, "multiline", sourceProps.multiline, {false})), - placeholder(Props::enablePropIteratorSetter ? sourceProps.placeholder : + placeholder(CoreFeatures::enablePropIteratorSetter? sourceProps.placeholder : convertRawProp(context, rawProps, "placeholder", sourceProps.placeholder, {})), - placeholderTextColor(Props::enablePropIteratorSetter ? sourceProps.placeholderTextColor : convertRawProp(context, rawProps, + placeholderTextColor(CoreFeatures::enablePropIteratorSetter? sourceProps.placeholderTextColor : convertRawProp(context, rawProps, "placeholderTextColor", sourceProps.placeholderTextColor, {})), - secureTextEntry(Props::enablePropIteratorSetter ? sourceProps.secureTextEntry : convertRawProp(context, rawProps, + secureTextEntry(CoreFeatures::enablePropIteratorSetter? sourceProps.secureTextEntry : convertRawProp(context, rawProps, "secureTextEntry", sourceProps.secureTextEntry, {false})), - selectionColor(Props::enablePropIteratorSetter ? sourceProps.selectionColor : convertRawProp(context, rawProps, + selectionColor(CoreFeatures::enablePropIteratorSetter? sourceProps.selectionColor : convertRawProp(context, rawProps, "selectionColor", sourceProps.selectionColor, {})), - selection(Props::enablePropIteratorSetter ? sourceProps.selection : + selection(CoreFeatures::enablePropIteratorSetter? sourceProps.selection : convertRawProp(context, rawProps, "selection", sourceProps.selection, {})), - value(Props::enablePropIteratorSetter ? sourceProps.value : convertRawProp(context, rawProps, "value", sourceProps.value, {})), - defaultValue(Props::enablePropIteratorSetter ? sourceProps.defaultValue : convertRawProp(context, rawProps, + value(CoreFeatures::enablePropIteratorSetter? sourceProps.value : convertRawProp(context, rawProps, "value", sourceProps.value, {})), + defaultValue(CoreFeatures::enablePropIteratorSetter? sourceProps.defaultValue : convertRawProp(context, rawProps, "defaultValue", sourceProps.defaultValue, {})), - selectTextOnFocus(Props::enablePropIteratorSetter ? sourceProps.selectTextOnFocus : convertRawProp(context, rawProps, + selectTextOnFocus(CoreFeatures::enablePropIteratorSetter? sourceProps.selectTextOnFocus : convertRawProp(context, rawProps, "selectTextOnFocus", sourceProps.selectTextOnFocus, {false})), - submitBehavior(Props::enablePropIteratorSetter ? sourceProps.submitBehavior : convertRawProp(context, rawProps, + submitBehavior(CoreFeatures::enablePropIteratorSetter? sourceProps.submitBehavior : convertRawProp(context, rawProps, "submitBehavior", sourceProps.submitBehavior, {})), - caretHidden(Props::enablePropIteratorSetter ? sourceProps.caretHidden : convertRawProp(context, rawProps, + caretHidden(CoreFeatures::enablePropIteratorSetter? sourceProps.caretHidden : convertRawProp(context, rawProps, "caretHidden", sourceProps.caretHidden, {false})), - contextMenuHidden(Props::enablePropIteratorSetter ? sourceProps.contextMenuHidden : convertRawProp(context, rawProps, + contextMenuHidden(CoreFeatures::enablePropIteratorSetter? sourceProps.contextMenuHidden : convertRawProp(context, rawProps, "contextMenuHidden", sourceProps.contextMenuHidden, {false})), - textShadowColor(Props::enablePropIteratorSetter ? sourceProps.textShadowColor : convertRawProp(context, rawProps, + textShadowColor(CoreFeatures::enablePropIteratorSetter? sourceProps.textShadowColor : convertRawProp(context, rawProps, "textShadowColor", sourceProps.textShadowColor, {})), - textShadowRadius(Props::enablePropIteratorSetter ? sourceProps.textShadowRadius : convertRawProp(context, rawProps, + textShadowRadius(CoreFeatures::enablePropIteratorSetter? sourceProps.textShadowRadius : convertRawProp(context, rawProps, "textShadowRadius", sourceProps.textShadowRadius, {0.0})), - textDecorationLine(Props::enablePropIteratorSetter ? sourceProps.textDecorationLine : convertRawProp(context, rawProps, + textDecorationLine(CoreFeatures::enablePropIteratorSetter? sourceProps.textDecorationLine : convertRawProp(context, rawProps, "textDecorationLine", sourceProps.textDecorationLine, {})), - fontStyle(Props::enablePropIteratorSetter ? sourceProps.fontStyle : + fontStyle(CoreFeatures::enablePropIteratorSetter? sourceProps.fontStyle : convertRawProp(context, rawProps, "fontStyle", sourceProps.fontStyle, {})), - textShadowOffset(Props::enablePropIteratorSetter ? sourceProps.textShadowOffset : convertRawProp(context, rawProps, + textShadowOffset(CoreFeatures::enablePropIteratorSetter? sourceProps.textShadowOffset : convertRawProp(context, rawProps, "textShadowOffset", sourceProps.textShadowOffset, {})), - lineHeight(Props::enablePropIteratorSetter ? sourceProps.lineHeight : convertRawProp(context, rawProps, + lineHeight(CoreFeatures::enablePropIteratorSetter? sourceProps.lineHeight : convertRawProp(context, rawProps, "lineHeight", sourceProps.lineHeight, {0.0})), - textTransform(Props::enablePropIteratorSetter ? sourceProps.textTransform : convertRawProp(context, rawProps, + textTransform(CoreFeatures::enablePropIteratorSetter? sourceProps.textTransform : convertRawProp(context, rawProps, "textTransform", sourceProps.textTransform, {})), color(0 /*convertRawProp(context, rawProps, "color", sourceProps.color, {0})*/), - letterSpacing(Props::enablePropIteratorSetter ? sourceProps.letterSpacing : convertRawProp(context, rawProps, + letterSpacing(CoreFeatures::enablePropIteratorSetter? sourceProps.letterSpacing : convertRawProp(context, rawProps, "letterSpacing", sourceProps.letterSpacing, {0.0})), - fontSize(Props::enablePropIteratorSetter ? sourceProps.fontSize : + fontSize(CoreFeatures::enablePropIteratorSetter? sourceProps.fontSize : convertRawProp(context, rawProps, "fontSize", sourceProps.fontSize, {0.0})), - textAlign(Props::enablePropIteratorSetter ? sourceProps.textAlign : + textAlign(CoreFeatures::enablePropIteratorSetter? sourceProps.textAlign : convertRawProp(context, rawProps, "textAlign", sourceProps.textAlign, {})), - includeFontPadding(Props::enablePropIteratorSetter ? sourceProps.includeFontPadding : convertRawProp(context, rawProps, + includeFontPadding(CoreFeatures::enablePropIteratorSetter? sourceProps.includeFontPadding : convertRawProp(context, rawProps, "includeFontPadding", sourceProps.includeFontPadding, {false})), - fontWeight(Props::enablePropIteratorSetter ? sourceProps.fontWeight : + fontWeight(CoreFeatures::enablePropIteratorSetter? sourceProps.fontWeight : convertRawProp(context, rawProps, "fontWeight", sourceProps.fontWeight, {})), - fontFamily(Props::enablePropIteratorSetter ? sourceProps.fontFamily : + fontFamily(CoreFeatures::enablePropIteratorSetter? sourceProps.fontFamily : convertRawProp(context, rawProps, "fontFamily", sourceProps.fontFamily, {})), - textAlignVertical(Props::enablePropIteratorSetter ? sourceProps.textAlignVertical : convertRawProp(context, rawProps, + textAlignVertical(CoreFeatures::enablePropIteratorSetter? sourceProps.textAlignVertical : convertRawProp(context, rawProps, "textAlignVertical", sourceProps.textAlignVertical, {})), - cursorColor(Props::enablePropIteratorSetter ? sourceProps.cursorColor : + cursorColor(CoreFeatures::enablePropIteratorSetter? sourceProps.cursorColor : convertRawProp(context, rawProps, "cursorColor", sourceProps.cursorColor, {})), - mostRecentEventCount(Props::enablePropIteratorSetter ? sourceProps.mostRecentEventCount : convertRawProp(context, rawProps, + mostRecentEventCount(CoreFeatures::enablePropIteratorSetter? sourceProps.mostRecentEventCount : convertRawProp(context, rawProps, "mostRecentEventCount", sourceProps.mostRecentEventCount, {0})), - text(Props::enablePropIteratorSetter ? sourceProps.text : convertRawProp(context, rawProps, "text", sourceProps.text, {})), - paragraphAttributes(Props::enablePropIteratorSetter ? sourceProps.paragraphAttributes : + text(CoreFeatures::enablePropIteratorSetter? sourceProps.text : convertRawProp(context, rawProps, "text", sourceProps.text, {})), + paragraphAttributes(CoreFeatures::enablePropIteratorSetter? sourceProps.paragraphAttributes : convertRawProp(context, rawProps, sourceProps.paragraphAttributes, {})), // See AndroidTextInputComponentDescriptor for usage // TODO T63008435: can these, and this feature, be removed entirely? - hasPadding(Props::enablePropIteratorSetter ? sourceProps.hasPadding : hasValue(rawProps, sourceProps.hasPadding, "", "padding", "")), - hasPaddingHorizontal(Props::enablePropIteratorSetter ? sourceProps.hasPaddingHorizontal : hasValue( + hasPadding(CoreFeatures::enablePropIteratorSetter? sourceProps.hasPadding : hasValue(rawProps, sourceProps.hasPadding, "", "padding", "")), + hasPaddingHorizontal(CoreFeatures::enablePropIteratorSetter? sourceProps.hasPaddingHorizontal : hasValue( rawProps, sourceProps.hasPaddingHorizontal, "Horizontal", "padding", "")), - hasPaddingVertical(Props::enablePropIteratorSetter ? sourceProps.hasPaddingVertical : hasValue( + hasPaddingVertical(CoreFeatures::enablePropIteratorSetter? sourceProps.hasPaddingVertical : hasValue( rawProps, sourceProps.hasPaddingVertical, "Vertical", "padding", "")), - hasPaddingLeft(Props::enablePropIteratorSetter ? sourceProps.hasPaddingLeft : hasValue( + hasPaddingLeft(CoreFeatures::enablePropIteratorSetter? sourceProps.hasPaddingLeft : hasValue( rawProps, sourceProps.hasPaddingLeft, "Left", "padding", "")), - hasPaddingTop(Props::enablePropIteratorSetter ? sourceProps.hasPaddingTop : + hasPaddingTop(CoreFeatures::enablePropIteratorSetter? sourceProps.hasPaddingTop : hasValue(rawProps, sourceProps.hasPaddingTop, "Top", "padding", "")), - hasPaddingRight(Props::enablePropIteratorSetter ? sourceProps.hasPaddingRight : hasValue( + hasPaddingRight(CoreFeatures::enablePropIteratorSetter? sourceProps.hasPaddingRight : hasValue( rawProps, sourceProps.hasPaddingRight, "Right", "padding", "")), - hasPaddingBottom(Props::enablePropIteratorSetter ? sourceProps.hasPaddingBottom : hasValue( + hasPaddingBottom(CoreFeatures::enablePropIteratorSetter? sourceProps.hasPaddingBottom : hasValue( rawProps, sourceProps.hasPaddingBottom, "Bottom", "padding", "")), - hasPaddingStart(Props::enablePropIteratorSetter ? sourceProps.hasPaddingStart : hasValue( + hasPaddingStart(CoreFeatures::enablePropIteratorSetter? sourceProps.hasPaddingStart : hasValue( rawProps, sourceProps.hasPaddingStart, "Start", "padding", "")), - hasPaddingEnd(Props::enablePropIteratorSetter ? sourceProps.hasPaddingEnd : + hasPaddingEnd(CoreFeatures::enablePropIteratorSetter? sourceProps.hasPaddingEnd : hasValue(rawProps, sourceProps.hasPaddingEnd, "End", "padding", "")) { } diff --git a/ReactCommon/react/renderer/components/view/ViewProps.cpp b/ReactCommon/react/renderer/components/view/ViewProps.cpp index 3bdc56de17940f..bda1b2580b8f97 100644 --- a/ReactCommon/react/renderer/components/view/ViewProps.cpp +++ b/ReactCommon/react/renderer/components/view/ViewProps.cpp @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -26,167 +27,173 @@ ViewProps::ViewProps( : YogaStylableProps(context, sourceProps, rawProps, shouldSetRawProps), AccessibilityProps(context, sourceProps, rawProps), opacity( - Props::enablePropIteratorSetter ? sourceProps.opacity - : convertRawProp( - context, - rawProps, - "opacity", - sourceProps.opacity, - (Float)1.0)), + CoreFeatures::enablePropIteratorSetter ? sourceProps.opacity + : convertRawProp( + context, + rawProps, + "opacity", + sourceProps.opacity, + (Float)1.0)), foregroundColor( - Props::enablePropIteratorSetter ? sourceProps.foregroundColor - : convertRawProp( - context, - rawProps, - "foregroundColor", - sourceProps.foregroundColor, - {})), + CoreFeatures::enablePropIteratorSetter + ? sourceProps.foregroundColor + : convertRawProp( + context, + rawProps, + "foregroundColor", + sourceProps.foregroundColor, + {})), backgroundColor( - Props::enablePropIteratorSetter ? sourceProps.backgroundColor - : convertRawProp( - context, - rawProps, - "backgroundColor", - sourceProps.backgroundColor, - {})), + CoreFeatures::enablePropIteratorSetter + ? sourceProps.backgroundColor + : convertRawProp( + context, + rawProps, + "backgroundColor", + sourceProps.backgroundColor, + {})), borderRadii( - Props::enablePropIteratorSetter ? sourceProps.borderRadii - : convertRawProp( - context, - rawProps, - "border", - "Radius", - sourceProps.borderRadii, - {})), + CoreFeatures::enablePropIteratorSetter ? sourceProps.borderRadii + : convertRawProp( + context, + rawProps, + "border", + "Radius", + sourceProps.borderRadii, + {})), borderColors( - Props::enablePropIteratorSetter ? sourceProps.borderColors - : convertRawProp( - context, - rawProps, - "border", - "Color", - sourceProps.borderColors, - {})), + CoreFeatures::enablePropIteratorSetter ? sourceProps.borderColors + : convertRawProp( + context, + rawProps, + "border", + "Color", + sourceProps.borderColors, + {})), borderCurves( - Props::enablePropIteratorSetter ? sourceProps.borderCurves - : convertRawProp( - context, - rawProps, - "border", - "Curve", - sourceProps.borderCurves, - {})), + CoreFeatures::enablePropIteratorSetter ? sourceProps.borderCurves + : convertRawProp( + context, + rawProps, + "border", + "Curve", + sourceProps.borderCurves, + {})), borderStyles( - Props::enablePropIteratorSetter ? sourceProps.borderStyles - : convertRawProp( - context, - rawProps, - "border", - "Style", - sourceProps.borderStyles, - {})), + CoreFeatures::enablePropIteratorSetter ? sourceProps.borderStyles + : convertRawProp( + context, + rawProps, + "border", + "Style", + sourceProps.borderStyles, + {})), shadowColor( - Props::enablePropIteratorSetter ? sourceProps.shadowColor - : convertRawProp( - context, - rawProps, - "shadowColor", - sourceProps.shadowColor, - {})), + CoreFeatures::enablePropIteratorSetter ? sourceProps.shadowColor + : convertRawProp( + context, + rawProps, + "shadowColor", + sourceProps.shadowColor, + {})), shadowOffset( - Props::enablePropIteratorSetter ? sourceProps.shadowOffset - : convertRawProp( - context, - rawProps, - "shadowOffset", - sourceProps.shadowOffset, - {})), + CoreFeatures::enablePropIteratorSetter ? sourceProps.shadowOffset + : convertRawProp( + context, + rawProps, + "shadowOffset", + sourceProps.shadowOffset, + {})), shadowOpacity( - Props::enablePropIteratorSetter ? sourceProps.shadowOpacity - : convertRawProp( - context, - rawProps, - "shadowOpacity", - sourceProps.shadowOpacity, - {})), + CoreFeatures::enablePropIteratorSetter + ? sourceProps.shadowOpacity + : convertRawProp( + context, + rawProps, + "shadowOpacity", + sourceProps.shadowOpacity, + {})), shadowRadius( - Props::enablePropIteratorSetter ? sourceProps.shadowRadius - : convertRawProp( - context, - rawProps, - "shadowRadius", - sourceProps.shadowRadius, - {})), + CoreFeatures::enablePropIteratorSetter ? sourceProps.shadowRadius + : convertRawProp( + context, + rawProps, + "shadowRadius", + sourceProps.shadowRadius, + {})), transform( - Props::enablePropIteratorSetter ? sourceProps.transform - : convertRawProp( - context, - rawProps, - "transform", - sourceProps.transform, - {})), + CoreFeatures::enablePropIteratorSetter ? sourceProps.transform + : convertRawProp( + context, + rawProps, + "transform", + sourceProps.transform, + {})), backfaceVisibility( - Props::enablePropIteratorSetter ? sourceProps.backfaceVisibility - : convertRawProp( - context, - rawProps, - "backfaceVisibility", - sourceProps.backfaceVisibility, - {})), + CoreFeatures::enablePropIteratorSetter + ? sourceProps.backfaceVisibility + : convertRawProp( + context, + rawProps, + "backfaceVisibility", + sourceProps.backfaceVisibility, + {})), shouldRasterize( - Props::enablePropIteratorSetter ? sourceProps.shouldRasterize - : convertRawProp( - context, - rawProps, - "shouldRasterize", - sourceProps.shouldRasterize, - {})), + CoreFeatures::enablePropIteratorSetter + ? sourceProps.shouldRasterize + : convertRawProp( + context, + rawProps, + "shouldRasterize", + sourceProps.shouldRasterize, + {})), zIndex( - Props::enablePropIteratorSetter ? sourceProps.zIndex - : convertRawProp( - context, - rawProps, - "zIndex", - sourceProps.zIndex, - {})), + CoreFeatures::enablePropIteratorSetter ? sourceProps.zIndex + : convertRawProp( + context, + rawProps, + "zIndex", + sourceProps.zIndex, + {})), pointerEvents( - Props::enablePropIteratorSetter ? sourceProps.pointerEvents - : convertRawProp( - context, - rawProps, - "pointerEvents", - sourceProps.pointerEvents, - {})), + CoreFeatures::enablePropIteratorSetter + ? sourceProps.pointerEvents + : convertRawProp( + context, + rawProps, + "pointerEvents", + sourceProps.pointerEvents, + {})), hitSlop( - Props::enablePropIteratorSetter ? sourceProps.hitSlop - : convertRawProp( - context, - rawProps, - "hitSlop", - sourceProps.hitSlop, - {})), + CoreFeatures::enablePropIteratorSetter ? sourceProps.hitSlop + : convertRawProp( + context, + rawProps, + "hitSlop", + sourceProps.hitSlop, + {})), onLayout( - Props::enablePropIteratorSetter ? sourceProps.onLayout - : convertRawProp( - context, - rawProps, - "onLayout", - sourceProps.onLayout, - {})), + CoreFeatures::enablePropIteratorSetter ? sourceProps.onLayout + : convertRawProp( + context, + rawProps, + "onLayout", + sourceProps.onLayout, + {})), events( - Props::enablePropIteratorSetter + CoreFeatures::enablePropIteratorSetter ? sourceProps.events : convertRawProp(context, rawProps, sourceProps.events, {})), collapsable( - Props::enablePropIteratorSetter ? sourceProps.collapsable - : convertRawProp( - context, - rawProps, - "collapsable", - sourceProps.collapsable, - true)), + CoreFeatures::enablePropIteratorSetter ? sourceProps.collapsable + : convertRawProp( + context, + rawProps, + "collapsable", + sourceProps.collapsable, + true)), removeClippedSubviews( - Props::enablePropIteratorSetter + CoreFeatures::enablePropIteratorSetter ? sourceProps.removeClippedSubviews : convertRawProp( context, @@ -197,47 +204,50 @@ ViewProps::ViewProps( #ifdef ANDROID , elevation( - Props::enablePropIteratorSetter ? sourceProps.elevation - : convertRawProp( - context, - rawProps, - "elevation", - sourceProps.elevation, - {})), + CoreFeatures::enablePropIteratorSetter ? sourceProps.elevation + : convertRawProp( + context, + rawProps, + "elevation", + sourceProps.elevation, + {})), nativeBackground( - Props::enablePropIteratorSetter ? sourceProps.nativeBackground - : convertRawProp( - context, - rawProps, - "nativeBackgroundAndroid", - sourceProps.nativeBackground, - {})), + CoreFeatures::enablePropIteratorSetter + ? sourceProps.nativeBackground + : convertRawProp( + context, + rawProps, + "nativeBackgroundAndroid", + sourceProps.nativeBackground, + {})), nativeForeground( - Props::enablePropIteratorSetter ? sourceProps.nativeForeground - : convertRawProp( - context, - rawProps, - "nativeForegroundAndroid", - sourceProps.nativeForeground, - {})), + CoreFeatures::enablePropIteratorSetter + ? sourceProps.nativeForeground + : convertRawProp( + context, + rawProps, + "nativeForegroundAndroid", + sourceProps.nativeForeground, + {})), focusable( - Props::enablePropIteratorSetter ? sourceProps.focusable - : convertRawProp( - context, - rawProps, - "focusable", - sourceProps.focusable, - {})), + CoreFeatures::enablePropIteratorSetter ? sourceProps.focusable + : convertRawProp( + context, + rawProps, + "focusable", + sourceProps.focusable, + {})), hasTVPreferredFocus( - Props::enablePropIteratorSetter ? sourceProps.hasTVPreferredFocus - : convertRawProp( - context, - rawProps, - "hasTVPreferredFocus", - sourceProps.hasTVPreferredFocus, - {})), + CoreFeatures::enablePropIteratorSetter + ? sourceProps.hasTVPreferredFocus + : convertRawProp( + context, + rawProps, + "hasTVPreferredFocus", + sourceProps.hasTVPreferredFocus, + {})), needsOffscreenAlphaCompositing( - Props::enablePropIteratorSetter + CoreFeatures::enablePropIteratorSetter ? sourceProps.needsOffscreenAlphaCompositing : convertRawProp( context, @@ -246,7 +256,7 @@ ViewProps::ViewProps( sourceProps.needsOffscreenAlphaCompositing, {})), renderToHardwareTextureAndroid( - Props::enablePropIteratorSetter + CoreFeatures::enablePropIteratorSetter ? sourceProps.renderToHardwareTextureAndroid : convertRawProp( context, diff --git a/ReactCommon/react/renderer/components/view/ViewShadowNode.cpp b/ReactCommon/react/renderer/components/view/ViewShadowNode.cpp index b3cba2a0f2ce26..2e2a0da1b2b025 100644 --- a/ReactCommon/react/renderer/components/view/ViewShadowNode.cpp +++ b/ReactCommon/react/renderer/components/view/ViewShadowNode.cpp @@ -8,6 +8,7 @@ #include "ViewShadowNode.h" #include #include +#include namespace facebook { namespace react { @@ -18,7 +19,11 @@ ViewShadowNodeProps::ViewShadowNodeProps( PropsParserContext const &context, ViewShadowNodeProps const &sourceProps, RawProps const &rawProps) - : ViewProps(context, sourceProps, rawProps, !Props::enableMapBuffer){}; + : ViewProps( + context, + sourceProps, + rawProps, + !CoreFeatures::enableMapBuffer){}; ViewShadowNode::ViewShadowNode( ShadowNodeFragment const &fragment, diff --git a/ReactCommon/react/renderer/components/view/YogaStylableProps.cpp b/ReactCommon/react/renderer/components/view/YogaStylableProps.cpp index c9c7e0000b2719..5fa32c9edb9821 100644 --- a/ReactCommon/react/renderer/components/view/YogaStylableProps.cpp +++ b/ReactCommon/react/renderer/components/view/YogaStylableProps.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -26,7 +27,7 @@ YogaStylableProps::YogaStylableProps( bool shouldSetRawProps) : Props(context, sourceProps, rawProps, shouldSetRawProps), yogaStyle( - Props::enablePropIteratorSetter + CoreFeatures::enablePropIteratorSetter ? sourceProps.yogaStyle : convertRawProp(context, rawProps, sourceProps.yogaStyle)){}; diff --git a/ReactCommon/react/renderer/core/ConcreteComponentDescriptor.h b/ReactCommon/react/renderer/core/ConcreteComponentDescriptor.h index 77c60b0a1356dd..fb44c8dbb49a8c 100644 --- a/ReactCommon/react/renderer/core/ConcreteComponentDescriptor.h +++ b/ReactCommon/react/renderer/core/ConcreteComponentDescriptor.h @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -115,7 +116,7 @@ class ConcreteComponentDescriptor : public ComponentDescriptor { // 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 (Props::enablePropIteratorSetter) { + if (CoreFeatures::enablePropIteratorSetter) { rawProps.iterateOverValues([&](RawPropsPropNameHash hash, const char *propName, RawValue const &fn) { diff --git a/ReactCommon/react/renderer/core/CoreFeatures.cpp b/ReactCommon/react/renderer/core/CoreFeatures.cpp new file mode 100644 index 00000000000000..75153ff17e2753 --- /dev/null +++ b/ReactCommon/react/renderer/core/CoreFeatures.cpp @@ -0,0 +1,17 @@ +/* + * 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 "CoreFeatures.h" + +namespace facebook { +namespace react { + +bool CoreFeatures::enablePropIteratorSetter = false; +bool CoreFeatures::enableMapBuffer = false; + +} // namespace react +} // namespace facebook diff --git a/ReactCommon/react/renderer/core/CoreFeatures.h b/ReactCommon/react/renderer/core/CoreFeatures.h new file mode 100644 index 00000000000000..43330d47d92b58 --- /dev/null +++ b/ReactCommon/react/renderer/core/CoreFeatures.h @@ -0,0 +1,31 @@ +/* + * 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. + */ + +#pragma once + +namespace facebook { +namespace react { + +/* + * Contains the set of feature flags for the renderer core. + * Some of them are temporary and may be eventualy phased out + * as soon as the feature is fully implemented. + */ +class CoreFeatures { + public: + // Specifies whether the iterator-style prop parsing is enabled. + static bool enablePropIteratorSetter; + + // This is used as a feature flag for *all* PropsX structs. + // For MapBuffer to be used for a particular component instance, + // its ShadowNode traits must set the MapBuffer trait; and this + // must be set to "true" globally. + static bool enableMapBuffer; +}; + +} // namespace react +} // namespace facebook diff --git a/ReactCommon/react/renderer/core/Props.cpp b/ReactCommon/react/renderer/core/Props.cpp index e78db62c209067..2ead741b7350f9 100644 --- a/ReactCommon/react/renderer/core/Props.cpp +++ b/ReactCommon/react/renderer/core/Props.cpp @@ -9,27 +9,25 @@ #include "PropsMapBuffer.h" #include +#include #include namespace facebook { namespace react { -bool Props::enablePropIteratorSetter = false; -bool Props::enableMapBuffer = false; - Props::Props( const PropsParserContext &context, const Props &sourceProps, const RawProps &rawProps, const bool shouldSetRawProps) : nativeId( - enablePropIteratorSetter ? sourceProps.nativeId - : convertRawProp( - context, - rawProps, - "nativeID", - sourceProps.nativeId, - {})), + CoreFeatures::enablePropIteratorSetter ? sourceProps.nativeId + : convertRawProp( + context, + rawProps, + "nativeID", + sourceProps.nativeId, + {})), revision(sourceProps.revision + 1) #ifdef ANDROID , diff --git a/ReactCommon/react/renderer/core/Props.h b/ReactCommon/react/renderer/core/Props.h index 8daeb35dbe5eba..e63f274a3070ef 100644 --- a/ReactCommon/react/renderer/core/Props.h +++ b/ReactCommon/react/renderer/core/Props.h @@ -38,14 +38,6 @@ class Props : public virtual Sealable, public virtual DebugStringConvertible { bool shouldSetRawProps = true); virtual ~Props() = default; - static bool enablePropIteratorSetter; - - // This is used as a feature flag for *all* PropsX structs. - // For MapBuffer to be used for a particular component instance, - // its ShadowNode traits must set the MapBuffer trait; and this - // must be set to "true" globally. - static bool enableMapBuffer; - /** * Set a prop value via iteration (see enableIterator above). * If setProp is defined for a particular props struct, it /must/