From e4bdde6562bc9a6ecb4833136200fcde54a27f09 Mon Sep 17 00:00:00 2001 From: Pieter De Baets Date: Thu, 10 Oct 2024 11:30:11 -0700 Subject: [PATCH] Remove default false/null props from Text (#46956) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/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 --- packages/react-native/Libraries/Text/Text.js | 5 +---- .../react-native/Libraries/Text/__tests__/Text-test.js | 8 -------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/packages/react-native/Libraries/Text/Text.js b/packages/react-native/Libraries/Text/Text.js index 98c0f0aacf9b51..e327b652a287a6 100644 --- a/packages/react-native/Libraries/Text/Text.js +++ b/packages/react-native/Libraries/Text/Text.js @@ -115,7 +115,7 @@ const Text: component( // TODO: Move this processing to the view configuration. const _selectionColor = - selectionColor == null ? null : processColor(selectionColor); + selectionColor != null ? processColor(selectionColor) : undefined; let _style = style; if (__DEV__) { @@ -208,8 +208,6 @@ const Text: component( {...restProps} accessibilityLabel={_accessibilityLabel} accessibilityState={_accessibilityState} - isHighlighted={false} - isPressable={false} nativeID={_nativeID} numberOfLines={_numberOfLines} ref={forwardedRef} @@ -288,7 +286,6 @@ const Text: component( allowFontScaling={allowFontScaling !== false} disabled={_disabled} ellipsizeMode={ellipsizeMode ?? 'tail'} - isHighlighted={false} nativeID={_nativeID} numberOfLines={_numberOfLines} ref={forwardedRef} diff --git a/packages/react-native/Libraries/Text/__tests__/Text-test.js b/packages/react-native/Libraries/Text/__tests__/Text-test.js index b2455ff54ad84c..fa6bd876a84c23 100644 --- a/packages/react-native/Libraries/Text/__tests__/Text-test.js +++ b/packages/react-native/Libraries/Text/__tests__/Text-test.js @@ -36,8 +36,6 @@ describe('Text', () => { accessible={true} allowFontScaling={true} ellipsizeMode="tail" - isHighlighted={false} - selectionColor={null} /> `); }); @@ -62,9 +60,7 @@ describe('Text compat with web', () => { accessible={true} allowFontScaling={true} ellipsizeMode="tail" - isHighlighted={false} nativeID="id" - selectionColor={null} tabIndex={0} testID="testID" /> @@ -178,9 +174,7 @@ describe('Text compat with web', () => { aria-valuetext="3" disabled={true} ellipsizeMode="tail" - isHighlighted={false} role="main" - selectionColor={null} /> `); }); @@ -202,9 +196,7 @@ describe('Text compat with web', () => { accessible={true} allowFontScaling={true} ellipsizeMode="tail" - isHighlighted={false} selectable={false} - selectionColor={null} style={ Object { "backgroundColor": "white",