Skip to content

Commit 5bf1f14

Browse files
committed
refactor: remove MD3 prefix and use deprecated aliases
1 parent ad9f3f0 commit 5bf1f14

84 files changed

Lines changed: 402 additions & 398 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/babel/__fixtures__/rewrite-imports/output.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import BottomNavigation from "react-native-paper/lib/module/components/BottomNav
44
import Button from "react-native-paper/lib/module/components/Button/Button";
55
import FAB from "react-native-paper/lib/module/components/FAB";
66
import Appbar from "react-native-paper/lib/module/components/Appbar";
7-
import { MD3Colors } from "react-native-paper/lib/module/styles/themes/v3/tokens";
7+
import { MD3Colors } from "react-native-paper/lib/module/deprecated";
88
import { NonExistent, NonExistentSecond as Stuff } from "react-native-paper/lib/module/index.js";
99
import { ThemeProvider } from "react-native-paper/lib/module/core/theming";
1010
import { withTheme } from "react-native-paper/lib/module/core/theming";

src/components/ActivityIndicator.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ const DURATION = 2400;
4545
* ## Usage
4646
* ```js
4747
* import * as React from 'react';
48-
* import { ActivityIndicator, MD3Colors } from 'react-native-paper';
48+
* import { ActivityIndicator, Palette } from 'react-native-paper';
4949
*
5050
* const MyComponent = () => (
51-
* <ActivityIndicator animating={true} color={MD3Colors.error50} />
51+
* <ActivityIndicator animating={true} color={Palette.error50} />
5252
* );
5353
*
5454
* export default MyComponent;

src/components/Appbar/Appbar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
AppbarChildProps,
1919
} from './utils';
2020
import { useInternalTheme } from '../../core/theming';
21-
import type { MD3Elevation, ThemeProp } from '../../types';
21+
import type { Elevation, ThemeProp } from '../../types';
2222
import Surface from '../Surface';
2323

2424
export type Props = Omit<
@@ -234,7 +234,7 @@ const Appbar = ({
234234
insets,
235235
restStyle,
236236
]}
237-
elevation={elevation as MD3Elevation}
237+
elevation={elevation as Elevation}
238238
container
239239
{...rest}
240240
>

src/components/Appbar/AppbarAction.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { Animated, StyleProp, View, ViewStyle } from 'react-native';
44
import type { ThemeProp } from 'src/types';
55

66
import { useInternalTheme } from '../../core/theming';
7-
import type { MD3Theme } from '../../types';
7+
import type { Theme } from '../../types';
88
import { forwardRef } from '../../utils/forwardRef';
99
import type { IconSource } from '../Icon';
1010
import IconButton from '../IconButton/IconButton';
@@ -86,7 +86,7 @@ const AppbarAction = forwardRef<View, Props>(
8686
ref
8787
) => {
8888
const theme = useInternalTheme(themeOverrides);
89-
const { colors } = theme as MD3Theme;
89+
const { colors } = theme as Theme;
9090

9191
const actionIconColor = iconColor
9292
? iconColor

src/components/Appbar/AppbarContent.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import { modeTextVariant } from './utils';
1616
import { useInternalTheme } from '../../core/theming';
1717
import type {
1818
$RemoveChildren,
19-
MD3Theme,
20-
MD3TypescaleKey,
19+
Theme,
20+
TypescaleKey,
2121
ThemeProp,
2222
} from '../../types';
2323
import Text, { TextRef } from '../Typography/Text';
@@ -107,7 +107,7 @@ const AppbarContent = ({
107107
...rest
108108
}: Props) => {
109109
const theme = useInternalTheme(themeOverrides);
110-
const { colors, fonts } = theme as MD3Theme;
110+
const { colors, fonts } = theme as Theme;
111111

112112
const titleTextColor = titleColor ? titleColor : colors.onSurface;
113113

@@ -118,7 +118,7 @@ const AppbarContent = ({
118118
'center-aligned': styles.v3DefaultContainer,
119119
};
120120

121-
const variant = modeTextVariant[mode] as MD3TypescaleKey;
121+
const variant = modeTextVariant[mode] as TypescaleKey;
122122

123123
const contentWrapperProps = {
124124
pointerEvents: 'box-none' as ViewProps['pointerEvents'],

src/components/Appbar/utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import React from 'react';
22
import type { ColorValue, StyleProp, ViewStyle } from 'react-native';
33
import { StyleSheet, Animated } from 'react-native';
44

5-
import { white } from '../../styles/themes/v2/colors';
6-
import type { InternalTheme, MD3Theme, ThemeProp } from '../../types';
5+
import { white } from '../../styles/themes/colors';
6+
import type { InternalTheme, Theme, ThemeProp } from '../../types';
77

88
export type AppbarModes = 'small' | 'medium' | 'large' | 'center-aligned';
99

@@ -27,7 +27,7 @@ export const getAppbarBackgroundColor = (
2727
customBackground?: ColorValue,
2828
elevated?: boolean
2929
) => {
30-
const { colors } = theme as MD3Theme;
30+
const { colors } = theme as Theme;
3131
if (customBackground) {
3232
return customBackground;
3333
}

src/components/Avatar/AvatarIcon.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as React from 'react';
22
import { StyleProp, StyleSheet, View, ViewStyle } from 'react-native';
33

44
import { useInternalTheme } from '../../core/theming';
5-
import { white } from '../../styles/themes/v2/colors';
5+
import { white } from '../../styles/themes/colors';
66
import type { ThemeProp } from '../../types';
77
import getContrastingColor from '../../utils/getContrastingColor';
88
import Icon, { IconSource } from '../Icon';

src/components/Avatar/AvatarText.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
} from 'react-native';
1010

1111
import { useInternalTheme } from '../../core/theming';
12-
import { white } from '../../styles/themes/v2/colors';
12+
import { white } from '../../styles/themes/colors';
1313
import type { ThemeProp } from '../../types';
1414
import getContrastingColor from '../../utils/getContrastingColor';
1515
import Text from '../Typography/Text';

src/components/Banner.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Icon, { IconSource } from './Icon';
99
import Surface from './Surface';
1010
import Text from './Typography/Text';
1111
import { useInternalTheme } from '../core/theming';
12-
import type { $Omit, $RemoveChildren, MD3Theme, ThemeProp } from '../types';
12+
import type { $Omit, $RemoveChildren, Theme, ThemeProp } from '../types';
1313

1414
const DEFAULT_MAX_WIDTH = 960;
1515

@@ -131,7 +131,7 @@ const Banner = ({
131131
...rest
132132
}: Props) => {
133133
const theme = useInternalTheme(themeOverrides);
134-
const { colors } = theme as MD3Theme;
134+
const { colors } = theme as Theme;
135135
const { current: position } = React.useRef<Animated.Value>(
136136
new Animated.Value(visible ? 1 : 0)
137137
);

src/components/BottomNavigation/BottomNavigationBar.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
getLabelColor,
2020
} from './utils';
2121
import { useInternalTheme } from '../../core/theming';
22-
import type { MD3Theme, ThemeProp } from '../../types';
22+
import type { Theme, ThemeProp } from '../../types';
2323
import useAnimatedValue from '../../utils/useAnimatedValue';
2424
import useAnimatedValueArray from '../../utils/useAnimatedValueArray';
2525
import useIsKeyboardShown from '../../utils/useIsKeyboardShown';
@@ -333,7 +333,7 @@ const BottomNavigationBar = <Route extends BaseRoute>({
333333
theme: themeOverrides,
334334
}: Props<Route>) => {
335335
const theme = useInternalTheme(themeOverrides);
336-
const { colors } = theme as MD3Theme;
336+
const { colors } = theme as Theme;
337337
const { bottom, left, right } = useSafeAreaInsets();
338338
const { scale } = theme.animation;
339339
const compact = compactProp ?? false;
@@ -582,7 +582,7 @@ const BottomNavigationBar = <Route extends BaseRoute>({
582582

583583
const isLegacyOrV3Shifting = shifting && labeled;
584584

585-
const font = (theme as MD3Theme).fonts.labelMedium;
585+
const font = (theme as Theme).fonts.labelMedium;
586586

587587
return renderTouchable({
588588
key: route.key,

0 commit comments

Comments
 (0)