Skip to content

Commit 86692e0

Browse files
sammy-SCfacebook-github-bot
authored andcommitted
Remove native View prop transformation flag (#56699)
Summary: 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
1 parent c0bf154 commit 86692e0

26 files changed

Lines changed: 169 additions & 858 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<<d4e81be344e15b275d015651b4fa824d>>
7+
* @generated SignedSource<<a5b7039a2eb762fec245435bcd4dcf99>>
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<<189cc2dd3b42cd736191f13b442e7317>>
7+
* @generated SignedSource<<e523734a0730fec62e5f9b99c39d3df0>>
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
@@ -473,15 +472,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
473472
return cached
474473
}
475474

476-
override fun enableNativeViewPropTransformations(): Boolean {
477-
var cached = enableNativeViewPropTransformationsCache
478-
if (cached == null) {
479-
cached = ReactNativeFeatureFlagsCxxInterop.enableNativeViewPropTransformations()
480-
enableNativeViewPropTransformationsCache = cached
481-
}
482-
return cached
483-
}
484-
485475
override fun enableNetworkEventReporting(): Boolean {
486476
var cached = enableNetworkEventReportingCache
487477
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<<81c6672ae539af203fae7e0f9cf541a6>>
7+
* @generated SignedSource<<7fd4577284b16f297e38621fb9d39ebb>>
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<<053d67947ccd1a3556c8f6e1b6af5a14>>
7+
* @generated SignedSource<<54ccbf2564bbb9d7914d03064abf32ea>>
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<<24972f077ba738a8191a2956be61b491>>
7+
* @generated SignedSource<<001f34c1006ce191e0a7548dd17a4d55>>
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
@@ -517,16 +516,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
517516
return cached
518517
}
519518

520-
override fun enableNativeViewPropTransformations(): Boolean {
521-
var cached = enableNativeViewPropTransformationsCache
522-
if (cached == null) {
523-
cached = currentProvider.enableNativeViewPropTransformations()
524-
accessedFeatureFlags.add("enableNativeViewPropTransformations")
525-
enableNativeViewPropTransformationsCache = cached
526-
}
527-
return cached
528-
}
529-
530519
override fun enableNetworkEventReporting(): Boolean {
531520
var cached = enableNetworkEventReportingCache
532521
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<<a7c69ce7e10faeb5328412c5e29552cf>>
7+
* @generated SignedSource<<e1b4eea9565cf49f970d83a6009c238a>>
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<<74f0602ce337a86730efe638ab8e966d>>
7+
* @generated SignedSource<<1050695e0c46255c6a8585a87cc4164a>>
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");
@@ -795,11 +789,6 @@ bool JReactNativeFeatureFlagsCxxInterop::enableNativeCSSParsing(
795789
return ReactNativeFeatureFlags::enableNativeCSSParsing();
796790
}
797791

798-
bool JReactNativeFeatureFlagsCxxInterop::enableNativeViewPropTransformations(
799-
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
800-
return ReactNativeFeatureFlags::enableNativeViewPropTransformations();
801-
}
802-
803792
bool JReactNativeFeatureFlagsCxxInterop::enableNetworkEventReporting(
804793
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
805794
return ReactNativeFeatureFlags::enableNetworkEventReporting();
@@ -1206,9 +1195,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
12061195
makeNativeMethod(
12071196
"enableNativeCSSParsing",
12081197
JReactNativeFeatureFlagsCxxInterop::enableNativeCSSParsing),
1209-
makeNativeMethod(
1210-
"enableNativeViewPropTransformations",
1211-
JReactNativeFeatureFlagsCxxInterop::enableNativeViewPropTransformations),
12121198
makeNativeMethod(
12131199
"enableNetworkEventReporting",
12141200
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<<2e867941f693c14c0c52475d790cfed4>>
7+
* @generated SignedSource<<9680cd1e139dcabb898befbacae9bfeb>>
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)