mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-05-23 06:48:35 +00:00
[fix] Layout of nested Text elements
Remove the 'dir=auto' attribute from nested Text elements as this can cause browsers to produce broken text layouts. Fix #1714
This commit is contained in:
@@ -22,7 +22,6 @@ exports[`components/Text nested 1`] = `
|
||||
<span
|
||||
class="css-text-901oao css-textHasAncestor-16my406"
|
||||
data-testid="child"
|
||||
dir="auto"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
+5
-2
@@ -153,8 +153,11 @@ const Text = forwardRef<TextProps, *>((props, forwardedRef) => {
|
||||
const component = hasTextAncestor ? 'span' : 'div';
|
||||
const supportedProps = pickProps(props);
|
||||
supportedProps.classList = classList;
|
||||
// 'auto' by default allows browsers to infer writing direction
|
||||
supportedProps.dir = dir !== undefined ? dir : 'auto';
|
||||
supportedProps.dir = dir;
|
||||
// 'auto' by default allows browsers to infer writing direction (root elements only)
|
||||
if (!hasTextAncestor) {
|
||||
supportedProps.dir = dir != null ? dir : 'auto';
|
||||
}
|
||||
supportedProps.onClick = handleClick;
|
||||
supportedProps.ref = setRef;
|
||||
supportedProps.style = style;
|
||||
|
||||
Reference in New Issue
Block a user