Skip to content

Commit 9af122d

Browse files
committed
feat: ✏️ use Font Family helper function to set font as Inter for android
1 parent c88dcbf commit 9af122d

File tree

13 files changed

+102
-59
lines changed

13 files changed

+102
-59
lines changed

src/components/avatar/Avatar.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { ImageProps, ImageSourcePropType } from "react-native";
33

44
import { DefaultUser } from "../../icons";
55
import { Box, BoxProps, Text } from "../../primitives";
6-
import { useTailwind, useTheme } from "../../theme";
6+
import { getTextFontFamily, useTailwind, useTheme } from "../../theme";
77
import { createComponent, cx, isUndefined, styleAdapter } from "../../utils";
88
import { useAvatarGroup } from "../avatar-group";
99
import { Icon } from "../icon";
@@ -128,6 +128,7 @@ const RNAvatar: React.FC<Partial<AvatarProps>> = forwardRef<
128128
<Text
129129
style={ts(
130130
cx(avatarTheme.initials.base, avatarTheme.initials.size[size]),
131+
getTextFontFamily(avatarTheme.initials.base),
131132
)}
132133
adjustsFontSizeToFit
133134
allowFontScaling={false}

src/components/badge/Badge.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { forwardRef } from "react";
22

33
import { Box, BoxProps, Text, TextProps } from "../../primitives";
4-
import { useTheme } from "../../theme";
4+
import { getTextFontFamily, useTheme } from "../../theme";
55
import { createComponent, cx, RenderPropType, styleAdapter } from "../../utils";
66
import { createIcon } from "../create-icon";
77
import { Icon } from "../icon";
@@ -105,6 +105,7 @@ const RNBadge: React.FC<Partial<BadgeProps>> = forwardRef<
105105
badgeStyles.themeColor[themeColor]?.[variant]?.text,
106106
),
107107
),
108+
getTextFontFamily(badgeStyles.size[size]?.text),
108109
styleAdapter(textStyle),
109110
]}
110111
{...otherTextProps}

src/components/button/Button.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88

99
import { RenderPropType } from "../../index";
1010
import { Box, Text, Touchable } from "../../primitives";
11-
import { useTheme } from "../../theme";
11+
import { getTextFontFamily, useTheme } from "../../theme";
1212
import {
1313
createComponent,
1414
cx,
@@ -227,6 +227,7 @@ const RNButton: React.FC<Partial<ButtonProps>> = forwardRef<
227227
: "",
228228
),
229229
),
230+
getTextFontFamily(buttonTheme.size[size]?.text),
230231
styleAdapter(textStyle),
231232
]}
232233
>

src/components/checkbox/Checkbox.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { useToggleState } from "@react-stately/toggle";
1010

1111
import { Check, Dash } from "../../icons";
1212
import { Box, Text, Touchable, TouchableProps } from "../../primitives";
13-
import { useTheme } from "../../theme";
13+
import { getTextFontFamily, useTheme } from "../../theme";
1414
import {
1515
createComponent,
1616
cx,
@@ -303,6 +303,7 @@ const RNCheckbox: React.FC<Partial<CheckboxProps>> = forwardRef<
303303
description && checkboxTheme?.description?.labelText,
304304
),
305305
),
306+
getTextFontFamily(checkboxTheme.label?.text?.common),
306307
description
307308
? { lineHeight: checkboxTheme?.size[size]?.text?.lineHeight }
308309
: {},
@@ -320,6 +321,7 @@ const RNCheckbox: React.FC<Partial<CheckboxProps>> = forwardRef<
320321
checkboxTheme?.size[size]?.description?.default,
321322
),
322323
),
324+
getTextFontFamily(checkboxTheme?.description?.common),
323325
]}
324326
>
325327
{description}

src/components/circular-progress/CircularProgress.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import Animated, {
1515
import Svg, { Circle, G } from "react-native-svg";
1616

1717
import { AnimatedBox, Box, BoxProps, Text } from "../../primitives";
18-
import { useTheme } from "../../theme";
18+
import { getTextFontFamily, useTheme } from "../../theme";
1919
import { createComponent, cx, styleAdapter } from "../../utils";
2020

2121
Animated.addWhitelistedNativeProps({ text: true });
@@ -289,6 +289,7 @@ const RNCircularProgress: React.FC<Partial<CircularProgressProps>> = forwardRef<
289289
circularProgressTheme.size[size]?.text,
290290
),
291291
),
292+
getTextFontFamily(circularProgressTheme.text),
292293
]}
293294
>
294295
{hint}

src/components/meter/Meter.tsx

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { forwardRef, useState } from "react";
22
import { LayoutChangeEvent } from "react-native";
33

44
import { Box, Text } from "../../primitives";
5-
import { useTheme } from "../../theme";
5+
import { getTextFontFamily, useTheme } from "../../theme";
66
import { createComponent } from "../../utils";
77

88
import { MeterBar } from "./MeterBar";
@@ -108,21 +108,27 @@ const RNMeter: React.FC<Partial<MeterProps>> = forwardRef<
108108
<Box style={tailwind.style("flex-row")}>
109109
{label && (
110110
<Text
111-
style={tailwind.style([
112-
meterTheme.label.common,
113-
meterTheme.size[size]?.label,
114-
hint ? meterTheme.label.hasHint : "",
115-
])}
111+
style={[
112+
tailwind.style([
113+
meterTheme.label.common,
114+
meterTheme.size[size]?.label,
115+
hint ? meterTheme.label.hasHint : "",
116+
]),
117+
getTextFontFamily(meterTheme.label.common),
118+
]}
116119
>
117120
{label}
118121
</Text>
119122
)}
120123
{label && hint && (
121124
<Text
122-
style={tailwind.style([
123-
meterTheme.hint.common,
124-
meterTheme.size[size]?.hint,
125-
])}
125+
style={[
126+
tailwind.style([
127+
meterTheme.hint.common,
128+
meterTheme.size[size]?.hint,
129+
]),
130+
getTextFontFamily(meterTheme.hint.common),
131+
]}
126132
>
127133
{hint}
128134
</Text>

src/components/progress/ProgressBar.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
} from "react-native-reanimated";
1313

1414
import { AnimatedBox, Box, BoxProps, Text } from "../../primitives";
15-
import { useTheme } from "../../theme/context";
15+
import { getTextFontFamily, useTheme } from "../../theme";
1616
import { createComponent, cx, styleAdapter } from "../../utils";
1717

1818
export type ProgressBarSizes = "sm" | "md" | "lg" | "xl";
@@ -134,16 +134,20 @@ export const RNProgressBar: React.FC<Partial<ProgressProps>> = forwardRef<
134134
progressTheme.size[size]?.label,
135135
hint ? progressTheme.label.hasHint : "",
136136
),
137+
getTextFontFamily(progressTheme.label.common),
137138
)}
138139
>
139140
{label}
140141
</Text>
141142
)}
142143
{label && hint && (
143144
<Text
144-
style={tailwind.style(
145-
cx(progressTheme.hint.common, progressTheme.size[size]?.hint),
146-
)}
145+
style={[
146+
tailwind.style(
147+
cx(progressTheme.hint.common, progressTheme.size[size]?.hint),
148+
),
149+
getTextFontFamily(progressTheme.hint.common),
150+
]}
147151
>
148152
{hint}
149153
</Text>

src/components/radio/Radio.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { forwardRef, useCallback, useEffect, useRef } from "react";
22
import { Platform, PressableStateCallbackType } from "react-native";
33

44
import { Box, Text, Touchable, TouchableProps } from "../../primitives";
5-
import { useTheme } from "../../theme";
5+
import { getTextFontFamily, useTheme } from "../../theme";
66
import {
77
createComponent,
88
cx,
@@ -220,6 +220,7 @@ const RNRadio: React.FC<Partial<RadioProps>> = forwardRef<
220220
description
221221
? { lineHeight: radioTheme.size[size]?.text?.lineHeight }
222222
: {},
223+
getTextFontFamily(radioTheme.label?.text?.common),
223224
]}
224225
>
225226
{label}
@@ -234,6 +235,7 @@ const RNRadio: React.FC<Partial<RadioProps>> = forwardRef<
234235
radioTheme.size[size]?.description?.default,
235236
),
236237
),
238+
getTextFontFamily(radioTheme.description.common),
237239
]}
238240
>
239241
{description}

src/components/select/Select.tsx

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ import { BottomSheetFlatList, BottomSheetModal } from "@gorhom/bottom-sheet";
99
import { isUndefined } from "lodash";
1010

1111
import { Text, Touchable } from "../../primitives";
12-
import { useTheme } from "../../theme";
12+
import { getTextFontFamily, useTheme } from "../../theme";
1313
import {
1414
createComponent,
1515
createContext,
16+
cx,
1617
RenderPropType,
1718
styleAdapter,
1819
useOnHover,
@@ -174,15 +175,17 @@ const RNSelect: React.FC<Partial<SelectProps>> = forwardRef<
174175
onPress={handlePresentModalPress}
175176
style={(touchState: PressableStateCallbackType) => [
176177
tailwind.style([
177-
selectStyle.base.common,
178-
selectStyle.base.size[size].common,
179-
!prefix ? selectStyle.base.size[size].withoutAddon : "",
180-
selectStyle.base.variant[variant].default,
181-
invalid ? selectStyle.base.variant[variant].invalid : "",
182-
disabled ? selectStyle.base.variant[variant].disabled : "",
183-
touchState.pressed || hovered.value
184-
? selectStyle.base.variant[variant].pressedOrHovered
185-
: "",
178+
cx(
179+
selectStyle.base.common,
180+
selectStyle.base.size[size].common,
181+
!prefix ? selectStyle.base.size[size].withoutAddon : "",
182+
selectStyle.base.variant[variant].default,
183+
invalid ? selectStyle.base.variant[variant].invalid : "",
184+
disabled ? selectStyle.base.variant[variant].disabled : "",
185+
touchState.pressed || hovered.value
186+
? selectStyle.base.variant[variant].pressedOrHovered
187+
: "",
188+
),
186189
]),
187190
styleAdapter(style, touchState),
188191
]}
@@ -206,18 +209,24 @@ const RNSelect: React.FC<Partial<SelectProps>> = forwardRef<
206209
isDefaultState={isUndefined(selectState)}
207210
/>
208211
<Text
209-
style={tailwind.style([
210-
selectStyle.base.text.size[size],
211-
touchState.pressed || hovered.value
212-
? selectStyle.base.text.variant[variant].pressedOrHovered
213-
: disabled
214-
? selectStyle.base.text.variant[variant].disabled
215-
: isUndefined(selectState)
216-
? selectStyle.base.text.variant[variant].default
217-
: selectStyle.base.text.variant[variant].filled,
218-
prefix ? `pl-[${prefixWidth}px]` : "",
219-
`pr-[${suffixWidth}px]`,
220-
])}
212+
style={[
213+
tailwind.style([
214+
cx(
215+
selectStyle.base.text.size[size],
216+
touchState.pressed || hovered.value
217+
? selectStyle.base.text.variant[variant]
218+
.pressedOrHovered
219+
: disabled
220+
? selectStyle.base.text.variant[variant].disabled
221+
: isUndefined(selectState)
222+
? selectStyle.base.text.variant[variant].default
223+
: selectStyle.base.text.variant[variant].filled,
224+
prefix ? `pl-[${prefixWidth}px]` : "",
225+
`pr-[${suffixWidth}px]`,
226+
),
227+
]),
228+
getTextFontFamily(selectStyle.base.text.size[size]),
229+
]}
221230
>
222231
{isUndefined(selectState)
223232
? placeholder

src/components/select/SelectOption.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { forwardRef } from "react";
22
import { Platform, PressableStateCallbackType } from "react-native";
33

44
import { Box, Text, Touchable } from "../../primitives";
5-
import { useTheme } from "../../theme";
5+
import { getTextFontFamily, useTheme } from "../../theme";
66
import {
77
createComponent,
88
cx,
@@ -73,6 +73,7 @@ const RNSelectOption: React.FC<SelectOptionProps> = forwardRef<
7373
selectOptionStyle.size[size]?.text?.lineHeight,
7474
}
7575
: {},
76+
getTextFontFamily(selectOptionStyle.label?.text?.common),
7677
]}
7778
>
7879
{label}

0 commit comments

Comments
 (0)