Skip to content

Commit

Permalink
Remove default false/null props from Text (#46956)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
javache authored and facebook-github-bot committed Oct 10, 2024
1 parent 09682b5 commit e4bdde6
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
5 changes: 1 addition & 4 deletions packages/react-native/Libraries/Text/Text.js
Original file line number Diff line number Diff line change
Expand Up @@ -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__) {
Expand Down Expand Up @@ -208,8 +208,6 @@ const Text: component(
{...restProps}
accessibilityLabel={_accessibilityLabel}
accessibilityState={_accessibilityState}
isHighlighted={false}
isPressable={false}
nativeID={_nativeID}
numberOfLines={_numberOfLines}
ref={forwardedRef}
Expand Down Expand Up @@ -288,7 +286,6 @@ const Text: component(
allowFontScaling={allowFontScaling !== false}
disabled={_disabled}
ellipsizeMode={ellipsizeMode ?? 'tail'}
isHighlighted={false}
nativeID={_nativeID}
numberOfLines={_numberOfLines}
ref={forwardedRef}
Expand Down
8 changes: 0 additions & 8 deletions packages/react-native/Libraries/Text/__tests__/Text-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ describe('Text', () => {
accessible={true}
allowFontScaling={true}
ellipsizeMode="tail"
isHighlighted={false}
selectionColor={null}
/>
`);
});
Expand All @@ -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"
/>
Expand Down Expand Up @@ -178,9 +174,7 @@ describe('Text compat with web', () => {
aria-valuetext="3"
disabled={true}
ellipsizeMode="tail"
isHighlighted={false}
role="main"
selectionColor={null}
/>
`);
});
Expand All @@ -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",
Expand Down

0 comments on commit e4bdde6

Please sign in to comment.