Skip to content

Commit 2c2cd9e

Browse files
sammy-SCmeta-codesync[bot]
authored andcommitted
Remove native View prop transformation flag (#56699)
Summary: Pull Request resolved: #56699 Remove the `enableNativeViewPropTransformations` React Native feature flag and the native prop parsing code paths it controlled. Keep `View.js` performing the existing JS-side `aria-*`, `id`, and `tabIndex` prop transformations unconditionally. Changelog: [General][Removed] - Remove the experimental native View prop transformation feature flag. Reviewed By: javache Differential Revision: D104024823 fbshipit-source-id: 78b4d2d19fe3661a1b68c2456c7bc8605289ef04
1 parent 44bb83b commit 2c2cd9e

26 files changed

Lines changed: 170 additions & 859 deletions

packages/react-native/Libraries/Components/View/View.js

Lines changed: 74 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
import type {ViewProps} from './ViewPropTypes';
1212

13-
import * as ReactNativeFeatureFlags from '../../../src/private/featureflags/ReactNativeFeatureFlags';
1413
import TextAncestorContext from '../../Text/TextAncestorContext';
1514
import ViewNativeComponent from './ViewNativeComponent';
1615
import * as React from 'react';
@@ -29,93 +28,88 @@ component View(
2928
) {
3029
const hasTextAncestor = use(TextAncestorContext);
3130

32-
let resolvedProps = props;
33-
if (!ReactNativeFeatureFlags.enableNativeViewPropTransformations()) {
34-
const {
35-
accessibilityState,
36-
accessibilityValue,
37-
'aria-busy': ariaBusy,
38-
'aria-checked': ariaChecked,
39-
'aria-disabled': ariaDisabled,
40-
'aria-expanded': ariaExpanded,
41-
'aria-hidden': ariaHidden,
42-
'aria-label': ariaLabel,
43-
'aria-labelledby': ariaLabelledBy,
44-
'aria-live': ariaLive,
45-
'aria-selected': ariaSelected,
46-
'aria-valuemax': ariaValueMax,
47-
'aria-valuemin': ariaValueMin,
48-
'aria-valuenow': ariaValueNow,
49-
'aria-valuetext': ariaValueText,
50-
id,
51-
tabIndex,
52-
...otherProps
53-
} = props;
54-
55-
const processedProps = otherProps as {...ViewProps};
56-
57-
const parsedAriaLabelledBy = ariaLabelledBy?.split(/\s*,\s*/g);
58-
if (parsedAriaLabelledBy !== undefined) {
59-
processedProps.accessibilityLabelledBy = parsedAriaLabelledBy;
60-
}
61-
62-
if (ariaLabel !== undefined) {
63-
processedProps.accessibilityLabel = ariaLabel;
64-
}
31+
const {
32+
accessibilityState,
33+
accessibilityValue,
34+
'aria-busy': ariaBusy,
35+
'aria-checked': ariaChecked,
36+
'aria-disabled': ariaDisabled,
37+
'aria-expanded': ariaExpanded,
38+
'aria-hidden': ariaHidden,
39+
'aria-label': ariaLabel,
40+
'aria-labelledby': ariaLabelledBy,
41+
'aria-live': ariaLive,
42+
'aria-selected': ariaSelected,
43+
'aria-valuemax': ariaValueMax,
44+
'aria-valuemin': ariaValueMin,
45+
'aria-valuenow': ariaValueNow,
46+
'aria-valuetext': ariaValueText,
47+
id,
48+
tabIndex,
49+
...otherProps
50+
} = props;
51+
52+
const resolvedProps = otherProps as {...ViewProps};
53+
54+
const parsedAriaLabelledBy = ariaLabelledBy?.split(/\s*,\s*/g);
55+
if (parsedAriaLabelledBy !== undefined) {
56+
resolvedProps.accessibilityLabelledBy = parsedAriaLabelledBy;
57+
}
6558

66-
if (ariaLive !== undefined) {
67-
processedProps.accessibilityLiveRegion =
68-
ariaLive === 'off' ? 'none' : ariaLive;
69-
}
59+
if (ariaLabel !== undefined) {
60+
resolvedProps.accessibilityLabel = ariaLabel;
61+
}
7062

71-
if (ariaHidden !== undefined) {
72-
processedProps.accessibilityElementsHidden = ariaHidden;
73-
if (ariaHidden === true) {
74-
processedProps.importantForAccessibility = 'no-hide-descendants';
75-
}
76-
}
63+
if (ariaLive !== undefined) {
64+
resolvedProps.accessibilityLiveRegion =
65+
ariaLive === 'off' ? 'none' : ariaLive;
66+
}
7767

78-
if (id !== undefined) {
79-
processedProps.nativeID = id;
68+
if (ariaHidden !== undefined) {
69+
resolvedProps.accessibilityElementsHidden = ariaHidden;
70+
if (ariaHidden === true) {
71+
resolvedProps.importantForAccessibility = 'no-hide-descendants';
8072
}
73+
}
8174

82-
if (tabIndex !== undefined) {
83-
processedProps.focusable = !tabIndex;
84-
}
75+
if (id !== undefined) {
76+
resolvedProps.nativeID = id;
77+
}
8578

86-
if (
87-
accessibilityState != null ||
88-
ariaBusy != null ||
89-
ariaChecked != null ||
90-
ariaDisabled != null ||
91-
ariaExpanded != null ||
92-
ariaSelected != null
93-
) {
94-
processedProps.accessibilityState = {
95-
busy: ariaBusy ?? accessibilityState?.busy,
96-
checked: ariaChecked ?? accessibilityState?.checked,
97-
disabled: ariaDisabled ?? accessibilityState?.disabled,
98-
expanded: ariaExpanded ?? accessibilityState?.expanded,
99-
selected: ariaSelected ?? accessibilityState?.selected,
100-
};
101-
}
79+
if (tabIndex !== undefined) {
80+
resolvedProps.focusable = !tabIndex;
81+
}
10282

103-
if (
104-
accessibilityValue != null ||
105-
ariaValueMax != null ||
106-
ariaValueMin != null ||
107-
ariaValueNow != null ||
108-
ariaValueText != null
109-
) {
110-
processedProps.accessibilityValue = {
111-
max: ariaValueMax ?? accessibilityValue?.max,
112-
min: ariaValueMin ?? accessibilityValue?.min,
113-
now: ariaValueNow ?? accessibilityValue?.now,
114-
text: ariaValueText ?? accessibilityValue?.text,
115-
};
116-
}
83+
if (
84+
accessibilityState != null ||
85+
ariaBusy != null ||
86+
ariaChecked != null ||
87+
ariaDisabled != null ||
88+
ariaExpanded != null ||
89+
ariaSelected != null
90+
) {
91+
resolvedProps.accessibilityState = {
92+
busy: ariaBusy ?? accessibilityState?.busy,
93+
checked: ariaChecked ?? accessibilityState?.checked,
94+
disabled: ariaDisabled ?? accessibilityState?.disabled,
95+
expanded: ariaExpanded ?? accessibilityState?.expanded,
96+
selected: ariaSelected ?? accessibilityState?.selected,
97+
};
98+
}
11799

118-
resolvedProps = processedProps;
100+
if (
101+
accessibilityValue != null ||
102+
ariaValueMax != null ||
103+
ariaValueMin != null ||
104+
ariaValueNow != null ||
105+
ariaValueText != null
106+
) {
107+
resolvedProps.accessibilityValue = {
108+
max: ariaValueMax ?? accessibilityValue?.max,
109+
min: ariaValueMin ?? accessibilityValue?.min,
110+
now: ariaValueNow ?? accessibilityValue?.now,
111+
text: ariaValueText ?? accessibilityValue?.text,
112+
};
119113
}
120114

121115
const actualView =

packages/react-native/Libraries/Components/View/__tests__/View-itest.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*
77
* @flow strict-local
8-
* @fantom_flags enableNativeCSSParsing:* enableNativeViewPropTransformations:*
8+
* @fantom_flags enableNativeCSSParsing:*
99
* @format
1010
*/
1111

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<9fa8df8bd4c6ef4efeddff62e8518472>>
7+
* @generated SignedSource<<4342ccb696b4123b9d463a31c024b9bc>>
88
*/
99

1010
/**
@@ -270,12 +270,6 @@ public object ReactNativeFeatureFlags {
270270
@JvmStatic
271271
public fun enableNativeCSSParsing(): Boolean = accessor.enableNativeCSSParsing()
272272

273-
/**
274-
* When enabled, View.js passes aria-*, id, and tabIndex props directly to native, relying on C++ prop parsing instead of JS-side transformations.
275-
*/
276-
@JvmStatic
277-
public fun enableNativeViewPropTransformations(): Boolean = accessor.enableNativeViewPropTransformations()
278-
279273
/**
280274
* Enable network event reporting hooks in each native platform through `NetworkReporter` (Web Perf APIs + CDP). This flag should be combined with `fuseboxNetworkInspectionEnabled` to enable Network CDP debugging.
281275
*/

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<ef125427b8daa352919a846435008cad>>
7+
* @generated SignedSource<<ec375fbc64b2b2b8995c1640a0369923>>
88
*/
99

1010
/**
@@ -60,7 +60,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
6060
private var enableModuleArgumentNSNullConversionIOSCache: Boolean? = null
6161
private var enableMutationObserverByDefaultCache: Boolean? = null
6262
private var enableNativeCSSParsingCache: Boolean? = null
63-
private var enableNativeViewPropTransformationsCache: Boolean? = null
6463
private var enableNetworkEventReportingCache: Boolean? = null
6564
private var enablePreparedTextLayoutCache: Boolean? = null
6665
private var enablePropsUpdateReconciliationAndroidCache: Boolean? = null
@@ -474,15 +473,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
474473
return cached
475474
}
476475

477-
override fun enableNativeViewPropTransformations(): Boolean {
478-
var cached = enableNativeViewPropTransformationsCache
479-
if (cached == null) {
480-
cached = ReactNativeFeatureFlagsCxxInterop.enableNativeViewPropTransformations()
481-
enableNativeViewPropTransformationsCache = cached
482-
}
483-
return cached
484-
}
485-
486476
override fun enableNetworkEventReporting(): Boolean {
487477
var cached = enableNetworkEventReportingCache
488478
if (cached == null) {

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<ebe28a896847fe54affddc0007733ee9>>
7+
* @generated SignedSource<<81989dbed82df7bd963d8023c595ff44>>
88
*/
99

1010
/**
@@ -108,8 +108,6 @@ public object ReactNativeFeatureFlagsCxxInterop {
108108

109109
@DoNotStrip @JvmStatic public external fun enableNativeCSSParsing(): Boolean
110110

111-
@DoNotStrip @JvmStatic public external fun enableNativeViewPropTransformations(): Boolean
112-
113111
@DoNotStrip @JvmStatic public external fun enableNetworkEventReporting(): Boolean
114112

115113
@DoNotStrip @JvmStatic public external fun enablePreparedTextLayout(): Boolean

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<008cbcccd695935f1d4ca17e69bce718>>
7+
* @generated SignedSource<<93e83fb3dc9577acd9678803321e0fe1>>
88
*/
99

1010
/**
@@ -103,8 +103,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
103103

104104
override fun enableNativeCSSParsing(): Boolean = false
105105

106-
override fun enableNativeViewPropTransformations(): Boolean = false
107-
108106
override fun enableNetworkEventReporting(): Boolean = true
109107

110108
override fun enablePreparedTextLayout(): Boolean = false

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<0d50d159540c35fa0ae015093a483442>>
7+
* @generated SignedSource<<9d07e8adeee69583b788069649306d8e>>
88
*/
99

1010
/**
@@ -64,7 +64,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
6464
private var enableModuleArgumentNSNullConversionIOSCache: Boolean? = null
6565
private var enableMutationObserverByDefaultCache: Boolean? = null
6666
private var enableNativeCSSParsingCache: Boolean? = null
67-
private var enableNativeViewPropTransformationsCache: Boolean? = null
6867
private var enableNetworkEventReportingCache: Boolean? = null
6968
private var enablePreparedTextLayoutCache: Boolean? = null
7069
private var enablePropsUpdateReconciliationAndroidCache: Boolean? = null
@@ -518,16 +517,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
518517
return cached
519518
}
520519

521-
override fun enableNativeViewPropTransformations(): Boolean {
522-
var cached = enableNativeViewPropTransformationsCache
523-
if (cached == null) {
524-
cached = currentProvider.enableNativeViewPropTransformations()
525-
accessedFeatureFlags.add("enableNativeViewPropTransformations")
526-
enableNativeViewPropTransformationsCache = cached
527-
}
528-
return cached
529-
}
530-
531520
override fun enableNetworkEventReporting(): Boolean {
532521
var cached = enableNetworkEventReportingCache
533522
if (cached == null) {

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<0c9e61dd9a6102da81fa394d8a6401e2>>
7+
* @generated SignedSource<<bcc599e04e3672d4bff293e267b3efa2>>
88
*/
99

1010
/**
@@ -103,8 +103,6 @@ public interface ReactNativeFeatureFlagsProvider {
103103

104104
@DoNotStrip public fun enableNativeCSSParsing(): Boolean
105105

106-
@DoNotStrip public fun enableNativeViewPropTransformations(): Boolean
107-
108106
@DoNotStrip public fun enableNetworkEventReporting(): Boolean
109107

110108
@DoNotStrip public fun enablePreparedTextLayout(): Boolean

packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<1f63c355480af133d9245dad20da704c>>
7+
* @generated SignedSource<<32c8c18771d6690f50d60dbc8e3d07e2>>
88
*/
99

1010
/**
@@ -279,12 +279,6 @@ class ReactNativeFeatureFlagsJavaProvider
279279
return method(javaProvider_);
280280
}
281281

282-
bool enableNativeViewPropTransformations() override {
283-
static const auto method =
284-
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableNativeViewPropTransformations");
285-
return method(javaProvider_);
286-
}
287-
288282
bool enableNetworkEventReporting() override {
289283
static const auto method =
290284
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableNetworkEventReporting");
@@ -801,11 +795,6 @@ bool JReactNativeFeatureFlagsCxxInterop::enableNativeCSSParsing(
801795
return ReactNativeFeatureFlags::enableNativeCSSParsing();
802796
}
803797

804-
bool JReactNativeFeatureFlagsCxxInterop::enableNativeViewPropTransformations(
805-
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
806-
return ReactNativeFeatureFlags::enableNativeViewPropTransformations();
807-
}
808-
809798
bool JReactNativeFeatureFlagsCxxInterop::enableNetworkEventReporting(
810799
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
811800
return ReactNativeFeatureFlags::enableNetworkEventReporting();
@@ -1217,9 +1206,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
12171206
makeNativeMethod(
12181207
"enableNativeCSSParsing",
12191208
JReactNativeFeatureFlagsCxxInterop::enableNativeCSSParsing),
1220-
makeNativeMethod(
1221-
"enableNativeViewPropTransformations",
1222-
JReactNativeFeatureFlagsCxxInterop::enableNativeViewPropTransformations),
12231209
makeNativeMethod(
12241210
"enableNetworkEventReporting",
12251211
JReactNativeFeatureFlagsCxxInterop::enableNetworkEventReporting),

packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<fbc1ffa6b9806e600b1e956f949eec3d>>
7+
* @generated SignedSource<<aacbc520b40625dbdba328590cc78112>>
88
*/
99

1010
/**
@@ -150,9 +150,6 @@ class JReactNativeFeatureFlagsCxxInterop
150150
static bool enableNativeCSSParsing(
151151
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
152152

153-
static bool enableNativeViewPropTransformations(
154-
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
155-
156153
static bool enableNetworkEventReporting(
157154
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
158155

0 commit comments

Comments
 (0)