Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update material you theming #3053

Merged
merged 7 commits into from
Jan 31, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: ['lodash'],
};
2 changes: 1 addition & 1 deletion example/src/Examples/AppbarExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { View, Platform, StyleSheet } from 'react-native';
import type { StackNavigationProp } from '@react-navigation/stack';
import { Appbar, FAB, Switch, Paragraph } from 'react-native-paper';
import ScreenWrapper from '../ScreenWrapper';
import { yellowA200 } from '../../../src/styles/colors';
import { yellowA200 } from '../../../src/styles/themes/v2/colors';

type Props = {
navigation: StackNavigationProp<{}>;
Expand Down
2 changes: 1 addition & 1 deletion example/src/Examples/TextInputExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
pink400,
red500,
transparent,
} from '../../../src/styles/colors';
} from '../../../src/styles/themes/v2/colors';

const MAX_LENGTH = 20;

Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"dependencies": {
"@callstack/react-theme-provider": "^3.0.7",
"color": "^3.1.2",
"lodash": "^4.17.21",
"react-native-iphone-x-helper": "^1.3.1"
},
"devDependencies": {
Expand All @@ -58,6 +59,7 @@
"@release-it/conventional-changelog": "^1.1.0",
"@types/color": "^3.0.0",
"@types/jest": "^24.0.13",
"@types/lodash": "^4.14.178",
"@types/node": "^13.1.0",
"@types/react-dom": "^16.8.4",
"@types/react-native": "^0.66.1",
Expand All @@ -68,6 +70,7 @@
"babel-cli": "^6.26.0",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^26.1.0",
"babel-plugin-lodash": "^3.3.4",
"babel-test": "^0.1.1",
"chalk": "^4.0.0",
"commitlint": "^8.3.4",
Expand Down
2 changes: 1 addition & 1 deletion src/babel/__fixtures__/rewrite-imports/output.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import BottomNavigation from "react-native-paper/lib/module/components/BottomNav
import Button from "react-native-paper/lib/module/components/Button";
import FAB from "react-native-paper/lib/module/components/FAB";
import Appbar from "react-native-paper/lib/module/components/Appbar";
import * as Colors from "react-native-paper/lib/module/styles/colors";
import * as Colors from "react-native-paper/lib/module/styles/themes/v2/colors";
import { NonExistent, NonExistentSecond as Stuff, Theme } from "react-native-paper/lib/module/index.js";
import { ThemeProvider } from "react-native-paper/lib/module/core/theming";
import { withTheme } from "react-native-paper/lib/module/core/theming";
2 changes: 1 addition & 1 deletion src/components/Appbar/Appbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import AppbarAction from './AppbarAction';
import AppbarBackAction from './AppbarBackAction';
import Surface from '../Surface';
import { withTheme } from '../../core/theming';
import { black, white } from '../../styles/colors';
import { black, white } from '../../styles/themes/v2/colors';
import overlay from '../../styles/overlay';

type Props = Partial<React.ComponentPropsWithRef<typeof View>> & {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Appbar/AppbarAction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type {
ViewStyle,
TouchableWithoutFeedback,
} from 'react-native';
import { black } from '../../styles/colors';
import { black } from '../../styles/themes/v2/colors';
import IconButton from '../IconButton';
import type { IconSource } from '../Icon';

Expand Down
2 changes: 1 addition & 1 deletion src/components/Appbar/AppbarContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import color from 'color';
import Text from '../Typography/Text';

import { withTheme } from '../../core/theming';
import { white } from '../../styles/colors';
import { white } from '../../styles/themes/v2/colors';

import type { $RemoveChildren } from '../../types';

Expand Down
2 changes: 1 addition & 1 deletion src/components/Avatar/AvatarIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import { View, ViewStyle, StyleSheet, StyleProp } from 'react-native';
import Icon, { IconSource } from '../Icon';
import { withTheme } from '../../core/theming';
import { white } from '../../styles/colors';
import { white } from '../../styles/themes/v2/colors';
import getContrastingColor from '../../utils/getContrastingColor';

const defaultSize = 64;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Avatar/AvatarText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from 'react-native';
import Text from '../Typography/Text';
import { withTheme } from '../../core/theming';
import { white } from '../../styles/colors';
import { white } from '../../styles/themes/v2/colors';
import getContrastingColor from '../../utils/getContrastingColor';

const defaultSize = 64;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Badge.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { Animated, StyleSheet, StyleProp, TextStyle } from 'react-native';
import { white, black } from '../styles/colors';
import { white, black } from '../styles/themes/v2/colors';
import { withTheme } from '../core/theming';
import getContrastingColor from '../utils/getContrastingColor';

Expand Down
2 changes: 1 addition & 1 deletion src/components/BottomNavigation/BottomNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import Surface from '../Surface';
import Badge from '../Badge';
import TouchableRipple from '../TouchableRipple/TouchableRipple';
import Text from '../Typography/Text';
import { black, white } from '../../styles/colors';
import { black, white } from '../../styles/themes/v2/colors';
import { withTheme } from '../../core/theming';
import useAnimatedValue from '../../utils/useAnimatedValue';
import useAnimatedValueArray from '../../utils/useAnimatedValueArray';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Icon, { IconSource } from './Icon';
import Surface from './Surface';
import Text from './Typography/Text';
import TouchableRipple from './TouchableRipple/TouchableRipple';
import { black, white } from '../styles/colors';
import { black, white } from '../styles/themes/v2/colors';
import { withTheme } from '../core/theming';

type Props = React.ComponentProps<typeof Surface> & {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Card/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
ViewStyle,
} from 'react-native';
import color from 'color';
import { white, black } from '../../styles/colors';
import { white, black } from '../../styles/themes/v2/colors';
import CardContent from './CardContent';
import CardActions from './CardActions';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
Expand Down
2 changes: 1 addition & 1 deletion src/components/Card/CardCover.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { StyleSheet, View, ViewStyle, Image, StyleProp } from 'react-native';
import { withTheme } from '../../core/theming';
import { grey200 } from '../../styles/colors';
import { grey200 } from '../../styles/themes/v2/colors';

type Props = React.ComponentPropsWithRef<typeof Image> & {
/**
Expand Down
2 changes: 1 addition & 1 deletion src/components/Chip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import Surface from './Surface';
import Text from './Typography/Text';
import TouchableRipple from './TouchableRipple/TouchableRipple';
import { withTheme } from '../core/theming';
import { black, white } from '../styles/colors';
import { black, white } from '../styles/themes/v2/colors';
import type { EllipsizeProp } from '../types';

type Props = React.ComponentProps<typeof Surface> & {
Expand Down
2 changes: 1 addition & 1 deletion src/components/DataTable/DataTableHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import color from 'color';
import { StyleSheet, StyleProp, View, ViewStyle } from 'react-native';
import { black, white } from '../../styles/colors';
import { black, white } from '../../styles/themes/v2/colors';
import { withTheme } from '../../core/theming';

type Props = React.ComponentPropsWithRef<typeof View> & {
Expand Down
2 changes: 1 addition & 1 deletion src/components/DataTable/DataTableRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
ViewProps,
} from 'react-native';
import TouchableRipple from '../TouchableRipple/TouchableRipple';
import { black, white } from '../../styles/colors';
import { black, white } from '../../styles/themes/v2/colors';
import { withTheme } from '../../core/theming';
import type { $RemoveChildren } from '../../types';

Expand Down
2 changes: 1 addition & 1 deletion src/components/Divider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import color from 'color';
import { StyleSheet, View, ViewStyle, StyleProp } from 'react-native';
import { withTheme } from '../core/theming';
import { black, white } from '../styles/colors';
import { black, white } from '../styles/themes/v2/colors';
import type { $RemoveChildren } from '../types';

type Props = $RemoveChildren<typeof View> & {
Expand Down
2 changes: 1 addition & 1 deletion src/components/FAB/AnimatedFAB/AnimatedFAB.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import type {
NativeSyntheticEvent,
TextLayoutEventData,
} from 'react-native';
import { white, black } from '../../../styles/colors';
import { white, black } from '../../../styles/themes/v2/colors';
import AnimatedText from '../../Typography/AnimatedText';
import { getCombinedStyles } from './utils';

Expand Down
2 changes: 1 addition & 1 deletion src/components/FAB/FAB.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import CrossFadeIcon from '../CrossFadeIcon';
import Icon, { IconSource } from '../Icon';
import Text from '../Typography/Text';
import TouchableRipple from '../TouchableRipple/TouchableRipple';
import { black, white } from '../../styles/colors';
import { black, white } from '../../styles/themes/v2/colors';
import { withTheme } from '../../core/theming';
import getContrastingColor from '../../utils/getContrastingColor';
import type { $RemoveChildren } from '../../types';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Menu/MenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import Icon, { IconSource } from '../Icon';
import TouchableRipple from '../TouchableRipple/TouchableRipple';
import Text from '../Typography/Text';
import { black, white } from '../../styles/colors';
import { black, white } from '../../styles/themes/v2/colors';
import { withTheme } from '../../core/theming';

type Props = {
Expand Down
8 changes: 7 additions & 1 deletion src/components/Switch.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import * as React from 'react';
import { grey400, grey800, grey50, white, black } from '../styles/colors';
import {
grey400,
grey800,
grey50,
white,
black,
} from '../styles/themes/v2/colors';
import {
NativeModules,
Platform,
Expand Down
2 changes: 1 addition & 1 deletion src/components/ToggleButton/ToggleButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { withTheme } from '../../core/theming';
import color from 'color';
import IconButton from '../IconButton';
import { ToggleButtonGroupContext } from './ToggleButtonGroup';
import { black, white } from '../../styles/colors';
import { black, white } from '../../styles/themes/v2/colors';
import type { IconSource } from '../Icon';

type Props = {
Expand Down
2 changes: 1 addition & 1 deletion src/components/__tests__/Avatar.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import { StyleSheet } from 'react-native';
import renderer from 'react-test-renderer';
import * as Avatar from '../Avatar/Avatar.tsx';
import { red500 } from '../../styles/colors';
import { red500 } from '../../styles/themes/v2/colors';

const styles = StyleSheet.create({
bgColor: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/__tests__/Badge.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import renderer from 'react-test-renderer';
import Badge from '../Badge.tsx';
import { red500 } from '../../styles/colors.tsx';
import { red500 } from '../../styles/themes/v2/colors';

it('renders badge', () => {
const tree = renderer.create(<Badge />).toJSON();
Expand Down
2 changes: 1 addition & 1 deletion src/components/__tests__/BottomNavigation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { render } from 'react-native-testing-library';
import renderer from 'react-test-renderer';
import BottomNavigation from '../BottomNavigation/BottomNavigation.tsx';
import BottomNavigationRouteScreen from '../BottomNavigation/BottomNavigationRouteScreen.tsx';
import { red300 } from '../../styles/colors';
import { red300 } from '../../styles/themes/v2/colors';

const styles = StyleSheet.create({
bgColor: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/__tests__/Button.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import { StyleSheet } from 'react-native';
import renderer from 'react-test-renderer';
import Button from '../Button.tsx';
import { pink500 } from '../../styles/colors.tsx';
import { pink500 } from '../../styles/themes/v2/colors';

const styles = StyleSheet.create({
flexing: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/__tests__/IconButton.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import renderer from 'react-test-renderer';
import IconButton from '../IconButton.tsx';
import { pink500 } from '../../styles/colors.tsx';
import { pink500 } from '../../styles/themes/v2/colors';

it('renders icon button by default', () => {
const tree = renderer.create(<IconButton icon="camera" />).toJSON();
Expand Down
2 changes: 1 addition & 1 deletion src/components/__tests__/ListAccordion.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import renderer from 'react-test-renderer';
import ListAccordion from '../List/ListAccordion.tsx';
import ListItem from '../List/ListItem.tsx';
import ListIcon from '../List/ListIcon.tsx';
import { red500 } from '../../styles/colors';
import { red500 } from '../../styles/themes/v2/colors';

const styles = StyleSheet.create({
coloring: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/__tests__/ListItem.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Text, View } from 'react-native';
import ListItem from '../List/ListItem.tsx';
import ListIcon from '../List/ListIcon.tsx';
import Chip from '../Chip';
import { red500 } from '../../styles/colors';
import { red500 } from '../../styles/themes/v2/colors';

const styles = StyleSheet.create({
title: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/__tests__/ListSection.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ListSection from '../List/ListSection.tsx';
import ListItem from '../List/ListItem.tsx';
import ListIcon from '../List/ListIcon.tsx';
import ListSubheader from '../List/ListSubheader.tsx';
import { red500 } from '../../styles/colors';
import { red500 } from '../../styles/themes/v2/colors';

const styles = StyleSheet.create({
itemColor: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/__tests__/Switch.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import renderer from 'react-test-renderer';
import Switch from '../Switch.tsx';
import { pink500 } from '../../styles/colors.tsx';
import { pink500 } from '../../styles/themes/v2/colors';

it('renders on switch', () => {
const tree = renderer.create(<Switch value />).toJSON();
Expand Down
2 changes: 1 addition & 1 deletion src/components/__tests__/TextInput.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import { StyleSheet, Text, Platform } from 'react-native';
import { fireEvent, render } from 'react-native-testing-library';
import TextInput from '../TextInput/TextInput';
import { red500 } from '../../styles/colors';
import { red500 } from '../../styles/themes/v2/colors';

const style = StyleSheet.create({
inputStyle: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/__tests__/Typography/Caption.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import { StyleSheet } from 'react-native';
import renderer from 'react-test-renderer';
import Caption from '../../Typography/Caption.tsx';
import { red500 } from '../../../styles/colors';
import { red500 } from '../../../styles/themes/v2/colors';

const style = StyleSheet.create({
caption: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ exports[`renders list section with custom title style 1`] = `
},
},
"roundness": 4,
"version": 2,
}
}
>
Expand Down Expand Up @@ -357,6 +358,7 @@ exports[`renders list section with subheader 1`] = `
},
},
"roundness": 4,
"version": 2,
}
}
>
Expand Down Expand Up @@ -664,6 +666,7 @@ exports[`renders list section without subheader 1`] = `
},
},
"roundness": 4,
"version": 2,
}
}
>
Expand Down
Loading