Skip to content

Commit b094aa2

Browse files
author
Hristo Totov
committed
Merge branch 'v6' of https://github.com/callstack/react-native-paper into @hristototov/feat/improve_RTL_handling
2 parents 3cb9b1c + b88ec19 commit b094aa2

40 files changed

Lines changed: 300 additions & 245 deletions

example/src/Examples/TextInputExample.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ const TextInputExample = () => {
672672
<TextInput
673673
mode="outlined"
674674
theme={{
675-
roundness: 25,
675+
shapes: { corner: { extraSmall: 25 } },
676676
}}
677677
label="Outlined text input with custom roundness"
678678
/>
@@ -681,7 +681,7 @@ const TextInputExample = () => {
681681
<TextInput
682682
mode="outlined"
683683
label="Outlined text input without roundness"
684-
theme={{ roundness: 0 }}
684+
theme={{ shapes: { corner: { extraSmall: 0 } } }}
685685
/>
686686
</View>
687687
<View style={styles.inputContainerStyle}>

src/components/Button/Button.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ const Button = (
210210
},
211211
[mode]
212212
);
213-
const { roundness, animation } = theme;
213+
const { animation } = theme;
214214
const uppercase = uppercaseProp ?? false;
215215
const isWeb = Platform.OS === 'web';
216216

@@ -271,7 +271,7 @@ const Button = (
271271
(style) => style.startsWith('border') && style.endsWith('Radius')
272272
);
273273

274-
const borderRadius = 5 * roundness;
274+
const borderRadius = theme.shapes.corner.largeIncreased;
275275
const iconSize = 18;
276276

277277
const {

src/components/Card/Card.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ const Card = (
181181
const { current: elevationDarkAdaptive } = React.useRef<Animated.Value>(
182182
new Animated.Value(cardElevation)
183183
);
184-
const { animation, dark, mode, roundness } = theme;
184+
const { animation, dark, mode } = theme;
185185

186186
const prevDarkRef = React.useRef<boolean>(dark);
187187
React.useEffect(() => {
@@ -267,7 +267,7 @@ const Card = (
267267
);
268268

269269
const borderRadiusCombinedStyles = {
270-
borderRadius: 3 * roundness,
270+
borderRadius: theme.shapes.corner.medium,
271271
...borderRadiusStyles,
272272
};
273273

src/components/Card/CardTitle.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export type Props = React.ComponentPropsWithRef<typeof View> & {
4040
*
4141
* Body: `bodyLarge`, `bodyMedium`, `bodySmall`
4242
*/
43-
titleVariant?: keyof typeof TypescaleKey;
43+
titleVariant?: TypescaleKey;
4444
/**
4545
* Text for the subtitle. Note that this will only accept a string or `<Text>`-based node.
4646
*/
@@ -69,7 +69,7 @@ export type Props = React.ComponentPropsWithRef<typeof View> & {
6969
*
7070
* Body: `bodyLarge`, `bodyMedium`, `bodySmall`
7171
*/
72-
subtitleVariant?: keyof typeof TypescaleKey;
72+
subtitleVariant?: TypescaleKey;
7373
/**
7474
* Callback which returns a React element to display on the left side.
7575
*/

src/components/Card/utils.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,15 @@ export const getCardCoverStyle = ({
2626
index?: number;
2727
total?: number;
2828
}) => {
29-
const { roundness } = theme;
30-
3129
if (Object.keys(borderRadiusStyles).length > 0) {
3230
return {
33-
borderRadius: 3 * roundness,
31+
borderRadius: theme.shapes.corner.medium,
3432
...borderRadiusStyles,
3533
};
3634
}
3735

3836
return {
39-
borderRadius: 3 * roundness,
37+
borderRadius: theme.shapes.corner.medium,
4038
};
4139
};
4240

src/components/Checkbox/CheckboxItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export type Props = {
8686
*
8787
* Body: `bodyLarge`, `bodyMedium`, `bodySmall`
8888
*/
89-
labelVariant?: keyof typeof TypescaleKey;
89+
labelVariant?: TypescaleKey;
9090
/**
9191
* @optional
9292
*/

src/components/Chip/Chip.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ const Chip = ({
205205
...rest
206206
}: Props) => {
207207
const theme = useInternalTheme(themeOverrides);
208-
const { roundness } = theme;
209208
const isWeb = Platform.OS === 'web';
210209

211210
const { current: elevation } = React.useRef<Animated.Value>(
@@ -244,7 +243,7 @@ const Chip = ({
244243
});
245244

246245
const opacity = 0.38;
247-
const defaultBorderRadius = roundness * 2;
246+
const defaultBorderRadius = theme.shapes.corner.small;
248247
const iconSize = 18;
249248

250249
const {

src/components/Dialog/Dialog.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@ const Dialog = ({
105105
}: Props) => {
106106
const { right, left } = useSafeAreaInsets();
107107
const theme = useInternalTheme(themeOverrides);
108-
const { roundness } = theme as Theme;
109-
const borderRadius = 7 * roundness;
108+
const borderRadius = (theme as Theme).shapes.corner.extraLarge;
110109

111110
const backgroundColor = theme.colors.surfaceContainerHigh;
112111

src/components/Drawer/DrawerItem.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,14 @@ const DrawerItem = ({
100100
...rest
101101
}: Props) => {
102102
const theme = useInternalTheme(themeOverrides);
103-
const { roundness } = theme;
104103

105104
const backgroundColor = active ? theme.colors.secondaryContainer : undefined;
106105
const contentColor = active
107106
? theme.colors.onSecondaryContainer
108107
: theme.colors.onSurfaceVariant;
109108

110109
const labelMargin = icon ? 12 : 0;
111-
const borderRadius = 7 * roundness;
110+
const borderRadius = theme.shapes.corner.extraLarge;
112111
const font = theme.fonts.labelLarge;
113112

114113
return (

src/components/FAB/utils.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -278,10 +278,10 @@ const v3LargeSize = {
278278
width: 96,
279279
};
280280

281-
const getCustomFabSize = (customSize: number, roundness: number) => ({
281+
const getCustomFabSize = (customSize: number) => ({
282282
height: customSize,
283283
width: customSize,
284-
borderRadius: roundness === 0 ? 0 : customSize / roundness,
284+
borderRadius: customSize / 4,
285285
});
286286

287287
export const getFabStyle = ({
@@ -293,17 +293,15 @@ export const getFabStyle = ({
293293
size: 'small' | 'medium' | 'large';
294294
theme: InternalTheme;
295295
}) => {
296-
const { roundness } = theme;
297-
298-
if (customSize) return getCustomFabSize(customSize, roundness);
296+
if (customSize) return getCustomFabSize(customSize);
299297

300298
switch (size) {
301299
case 'small':
302-
return { ...v3SmallSize, borderRadius: 3 * roundness };
300+
return { ...v3SmallSize, borderRadius: theme.shapes.corner.medium };
303301
case 'medium':
304-
return { ...v3MediumSize, borderRadius: 4 * roundness };
302+
return { ...v3MediumSize, borderRadius: theme.shapes.corner.large };
305303
case 'large':
306-
return { ...v3LargeSize, borderRadius: 7 * roundness };
304+
return { ...v3LargeSize, borderRadius: theme.shapes.corner.extraLarge };
307305
}
308306
};
309307

0 commit comments

Comments
 (0)