diff --git a/packages/react-native/ReactCommon/react/renderer/components/view/BaseViewProps.h b/packages/react-native/ReactCommon/react/renderer/components/view/BaseViewProps.h index 9d2530e7061505..e5dd072407815a 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/view/BaseViewProps.h +++ b/packages/react-native/ReactCommon/react/renderer/components/view/BaseViewProps.h @@ -72,8 +72,6 @@ class BaseViewProps : public YogaStylableProps, public AccessibilityProps { LayoutConformance experimental_layoutConformance{}; - Float elevation{}; /* Android-only */ - #pragma mark - Convenience Methods BorderMetrics resolveBorderMetrics(LayoutMetrics const &layoutMetrics) const; 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 85f74f20a2c45b..9559d3dcb69512 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 @@ -23,6 +23,14 @@ HostPlatformViewProps::HostPlatformViewProps( RawProps const &rawProps, bool shouldSetRawProps) : BaseViewProps(context, sourceProps, rawProps, shouldSetRawProps), + elevation( + CoreFeatures::enablePropIteratorSetter ? sourceProps.elevation + : convertRawProp( + context, + rawProps, + "elevation", + sourceProps.elevation, + {})), nativeBackground( CoreFeatures::enablePropIteratorSetter ? sourceProps.nativeBackground diff --git a/packages/react-native/ReactCommon/react/renderer/components/view/platform/android/react/renderer/components/view/HostPlatformViewProps.h b/packages/react-native/ReactCommon/react/renderer/components/view/platform/android/react/renderer/components/view/HostPlatformViewProps.h index dd08ff16edf84a..c8a4bef1153971 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/view/platform/android/react/renderer/components/view/HostPlatformViewProps.h +++ b/packages/react-native/ReactCommon/react/renderer/components/view/platform/android/react/renderer/components/view/HostPlatformViewProps.h @@ -40,6 +40,8 @@ class HostPlatformViewProps : public BaseViewProps { #pragma mark - Props + Float elevation{}; + std::optional nativeBackground{}; std::optional nativeForeground{}; diff --git a/packages/react-native/ReactCommon/react/test_utils/shadowTreeGeneration.h b/packages/react-native/ReactCommon/react/test_utils/shadowTreeGeneration.h index da8aa09e1682bc..eeb959a3186a89 100644 --- a/packages/react-native/ReactCommon/react/test_utils/shadowTreeGeneration.h +++ b/packages/react-native/ReactCommon/react/test_utils/shadowTreeGeneration.h @@ -164,9 +164,11 @@ static inline ShadowNode::Unshared messWithLayoutableOnlyFlag( : Transform::Perspective(42); } +#ifdef ANDROID if (entropy.random(0.1)) { viewProps.elevation = entropy.random() ? 1 : 0; } +#endif return shadowNode.clone({newProps}); } @@ -195,7 +197,9 @@ static inline ShadowNode::Unshared messWithNodeFlattenednessFlags( viewProps.zIndex = {}; viewProps.pointerEvents = PointerEventsMode::Auto; viewProps.transform = Transform::Identity(); +#ifdef ANDROID viewProps.elevation = 0; +#endif } else { viewProps.nativeId = "42"; viewProps.backgroundColor = whiteColor(); @@ -204,7 +208,9 @@ static inline ShadowNode::Unshared messWithNodeFlattenednessFlags( viewProps.zIndex = {entropy.random()}; viewProps.pointerEvents = PointerEventsMode::None; viewProps.transform = Transform::Perspective(entropy.random()); +#ifdef ANDROID viewProps.elevation = entropy.random(); +#endif } return shadowNode.clone({newProps});