@artsy/palette-mobile 22.2.0--canary.425.5159.0 → 22.2.0--canary.425.5168.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { Text as RNText } from "react-native";
|
|
3
|
+
import { Text as RNText, Platform, } from "react-native";
|
|
4
4
|
import styled from "styled-components/native";
|
|
5
5
|
import { color, space, typography, } from "styled-system";
|
|
6
6
|
import { useFontFamilyFor } from "./helpers";
|
|
@@ -13,9 +13,13 @@ export const Text = forwardRef(({ variant = "sm", italic = false, color = "onBac
|
|
|
13
13
|
...nativeTextStyle,
|
|
14
14
|
{ textAlignVertical: "center" }, // android renders text higher by default, so we bring it down to be consistent with ios
|
|
15
15
|
{ textDecorationLine: !!underline ? "underline" : "none" },
|
|
16
|
+
{ fontStyle: italic ? "italic" : undefined },
|
|
16
17
|
!!maxWidth ? { width: "100%", maxWidth: 600, alignSelf: "center" } : {},
|
|
18
|
+
// Overriding the font family for the regular font to avoid breaking the layout (mainly on android)
|
|
19
|
+
// See: https://github.com/facebook/react-native/issues/53286
|
|
20
|
+
Platform.OS === "android" ? {} : { fontFamily },
|
|
17
21
|
style, // keep last so we can override
|
|
18
|
-
],
|
|
22
|
+
], ...fixTextTreatmentForStyledComponent(theme.textTreatments[variant]), children: children, color: color, ...restProps }));
|
|
19
23
|
});
|
|
20
24
|
const fixTextTreatmentForStyledComponent = (treatment) => {
|
|
21
25
|
const treatmentWithUnits = { ...treatment };
|