Skip to content

Commit e4bdde6

Browse files
javachefacebook-github-bot
authored andcommitted
Remove default false/null props from Text (#46956)
Summary: Pull Request resolved: #46956 isHighlighted/isPressable/selection color are the same as the native default, there's no need to send these in our props payload needlessly. Changelog: [Internal] Reviewed By: rshest Differential Revision: D64179256 fbshipit-source-id: 22e62c8d440d3bd219a79f445e49739c24fa5d52
1 parent 09682b5 commit e4bdde6

File tree

2 files changed

+1
-12
lines changed

2 files changed

+1
-12
lines changed

packages/react-native/Libraries/Text/Text.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ const Text: component(
115115

116116
// TODO: Move this processing to the view configuration.
117117
const _selectionColor =
118-
selectionColor == null ? null : processColor(selectionColor);
118+
selectionColor != null ? processColor(selectionColor) : undefined;
119119

120120
let _style = style;
121121
if (__DEV__) {
@@ -208,8 +208,6 @@ const Text: component(
208208
{...restProps}
209209
accessibilityLabel={_accessibilityLabel}
210210
accessibilityState={_accessibilityState}
211-
isHighlighted={false}
212-
isPressable={false}
213211
nativeID={_nativeID}
214212
numberOfLines={_numberOfLines}
215213
ref={forwardedRef}
@@ -288,7 +286,6 @@ const Text: component(
288286
allowFontScaling={allowFontScaling !== false}
289287
disabled={_disabled}
290288
ellipsizeMode={ellipsizeMode ?? 'tail'}
291-
isHighlighted={false}
292289
nativeID={_nativeID}
293290
numberOfLines={_numberOfLines}
294291
ref={forwardedRef}

packages/react-native/Libraries/Text/__tests__/Text-test.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ describe('Text', () => {
3636
accessible={true}
3737
allowFontScaling={true}
3838
ellipsizeMode="tail"
39-
isHighlighted={false}
40-
selectionColor={null}
4139
/>
4240
`);
4341
});
@@ -62,9 +60,7 @@ describe('Text compat with web', () => {
6260
accessible={true}
6361
allowFontScaling={true}
6462
ellipsizeMode="tail"
65-
isHighlighted={false}
6663
nativeID="id"
67-
selectionColor={null}
6864
tabIndex={0}
6965
testID="testID"
7066
/>
@@ -178,9 +174,7 @@ describe('Text compat with web', () => {
178174
aria-valuetext="3"
179175
disabled={true}
180176
ellipsizeMode="tail"
181-
isHighlighted={false}
182177
role="main"
183-
selectionColor={null}
184178
/>
185179
`);
186180
});
@@ -202,9 +196,7 @@ describe('Text compat with web', () => {
202196
accessible={true}
203197
allowFontScaling={true}
204198
ellipsizeMode="tail"
205-
isHighlighted={false}
206199
selectable={false}
207-
selectionColor={null}
208200
style={
209201
Object {
210202
"backgroundColor": "white",

0 commit comments

Comments
 (0)