mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Temporary hotfix for broken view flattening on Android (#38968)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/38968 A previous change introduced a bug where elevation was no longer being parsed on Android, which caused views that were previously flattened to no longer get flattened. This is a hotfix that could be pushed to affected builds without native code changes, but will not restore the shadow UX. ## Changelog: [General] [Internal] - Internal Reviewed By: bvanderhoof Differential Revision: D48271545 fbshipit-source-id: ebbecd8073a074525ff7b95a6298612d0bb304c6
This commit is contained in:
committed by
Facebook GitHub Bot
parent
3ef5e7a9a6
commit
9f7dfcc35f
@@ -10,6 +10,7 @@
|
||||
|
||||
import type {ViewProps} from './ViewPropTypes';
|
||||
|
||||
import ReactNativeFeatureFlags from '../../ReactNative/ReactNativeFeatureFlags';
|
||||
import flattenStyle from '../../StyleSheet/flattenStyle';
|
||||
import TextAncestor from '../../Text/TextAncestor';
|
||||
import ViewNativeComponent from './ViewNativeComponent';
|
||||
@@ -100,10 +101,20 @@ const View: React.AbstractComponent<
|
||||
let style = flattenStyle(otherProps.style);
|
||||
|
||||
const newPointerEvents = style?.pointerEvents || pointerEvents;
|
||||
const collapsableOverride =
|
||||
ReactNativeFeatureFlags.shouldForceUnflattenForElevation()
|
||||
? {
|
||||
collapsable:
|
||||
style != null && style.elevation != null && style.elevation !== 0
|
||||
? false
|
||||
: otherProps.collapsable,
|
||||
}
|
||||
: {};
|
||||
|
||||
const actualView = (
|
||||
<ViewNativeComponent
|
||||
{...otherProps}
|
||||
{...collapsableOverride}
|
||||
accessibilityLiveRegion={
|
||||
ariaLive === 'off' ? 'none' : ariaLive ?? accessibilityLiveRegion
|
||||
}
|
||||
|
||||
@@ -57,6 +57,10 @@ export type FeatureFlags = {|
|
||||
* Enables native view configs in brdgeless mode.
|
||||
*/
|
||||
enableNativeViewConfigsInBridgelessMode: () => boolean,
|
||||
/**
|
||||
* Enables a hotfix for forcing materialization of views with elevation set.
|
||||
*/
|
||||
shouldForceUnflattenForElevation: () => boolean,
|
||||
|};
|
||||
|
||||
const ReactNativeFeatureFlags: FeatureFlags = {
|
||||
@@ -70,6 +74,7 @@ const ReactNativeFeatureFlags: FeatureFlags = {
|
||||
shouldUseAnimatedObjectForTransform: () => false,
|
||||
shouldUseSetNativePropsInFabric: () => false,
|
||||
enableNativeViewConfigsInBridgelessMode: () => false,
|
||||
shouldForceUnflattenForElevation: () => false,
|
||||
};
|
||||
|
||||
module.exports = ReactNativeFeatureFlags;
|
||||
|
||||
Reference in New Issue
Block a user