Skip to content

Commit

Permalink
[0.72] Fix a bunch of properties on Text (#11601)
Browse files Browse the repository at this point in the history
* Fix a bunch of properties not working on Text

* Change files

* fix style prop

* accessible default

---------

Co-authored-by: Jon Thysell <jthysell@microsoft.com>
  • Loading branch information
acoates-ms and jonthysell committed May 22, 2023
1 parent 587083b commit 5d17894
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Fix a bunch of properties not working on Text",
"packageName": "react-native-windows",
"email": "30809111+acoates-ms@users.noreply.github.com",
"dependentChangeType": "patch"
}
35 changes: 31 additions & 4 deletions vnext/src/Libraries/Text/Text.windows.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ const Text: React.AbstractComponent<

const _accessible = Platform.select({
ios: accessible !== false,
windows: accessible !== false,
default: accessible,
});

Expand Down Expand Up @@ -307,13 +308,26 @@ const Text: React.AbstractComponent<
<NativeText
{...textPropsLessStyle}
{...eventHandlersForText}
accessible={accessible !== false}
accessibilityLabel={ariaLabel ?? accessibilityLabel}
accessibilityRole={
role ? getAccessibilityRoleFromRole(role) : accessibilityRole
}
accessibilityState={nativeTextAccessibilityState}
accessible={
accessible == null && Platform.OS === 'android'
? _hasOnPressOrOnLongPress
: _accessible
}
allowFontScaling={allowFontScaling !== false}
disabled={_disabled}
ellipsizeMode={ellipsizeMode ?? 'tail'}
isHighlighted={isHighlighted}
nativeID={id ?? nativeID}
numberOfLines={numberOfLines}
ref={forwardedRef}
selectable={_selectable}
selectionColor={selectionColor}
style={((rest: any): TextStyleProp)}
ref={forwardedRef}
/>
</TextAncestor.Provider>
</View>
Expand All @@ -324,13 +338,26 @@ const Text: React.AbstractComponent<
<NativeText
{...restProps}
{...eventHandlersForText}
accessible={accessible !== false}
accessibilityLabel={ariaLabel ?? accessibilityLabel}
accessibilityRole={
role ? getAccessibilityRoleFromRole(role) : accessibilityRole
}
accessibilityState={nativeTextAccessibilityState}
accessible={
accessible == null && Platform.OS === 'android'
? _hasOnPressOrOnLongPress
: _accessible
}
allowFontScaling={allowFontScaling !== false}
disabled={_disabled}
ellipsizeMode={ellipsizeMode ?? 'tail'}
isHighlighted={isHighlighted}
nativeID={id ?? nativeID}
numberOfLines={numberOfLines}
ref={forwardedRef}
selectable={_selectable}
selectionColor={selectionColor}
style={style}
ref={forwardedRef}
/>
</TextAncestor.Provider>
);
Expand Down

0 comments on commit 5d17894

Please sign in to comment.