diff --git a/docs/docs/guides/01-getting-started.md b/docs/docs/guides/01-getting-started.md
index 68071c4d25..19fc3c2dea 100644
--- a/docs/docs/guides/01-getting-started.md
+++ b/docs/docs/guides/01-getting-started.md
@@ -165,7 +165,3 @@ export default function Main() {
);
}
```
-
-:::note
-For MD2 check the following [Material Design 2 default theme](https://github.com/callstack/react-native-paper/blob/main/src/styles/themes/v2/LightTheme.tsx).
-:::
diff --git a/docs/docs/guides/02-theming.mdx b/docs/docs/guides/02-theming.mdx
index 76869182ae..ffb2f687c9 100644
--- a/docs/docs/guides/02-theming.mdx
+++ b/docs/docs/guides/02-theming.mdx
@@ -65,9 +65,7 @@ You can change the theme prop dynamically and all the components will automatica
A theme usually contains the following properties:
- `dark` (`boolean`): whether this is a dark theme or light theme.
-- `version`: specify which design system components should follow in the app
- - 3 - new Material You (MD3)
- - 2 - previous Material Design (MD2)
+- `version`: Material You (MD3); kept for compatibility and normalized to `3` by `PaperProvider`
- `mode` (`'adaptive' | 'exact'`): color mode for dark theme (See [Dark Theme](#dark-theme)).
- `roundness` (`number`): roundness of common elements, such as buttons.
- `colors` (`object`): various colors used throughout different elements.
@@ -229,31 +227,26 @@ export default function Main() {
### Sync dynamic colors with system colors
-Using [`pchmn/expo-material3-theme`](https://github.com/pchmn/expo-material3-theme) library you can easily access the Material 3 system colors from Android 12+ devices and seamlessly integrate them into your dynamic theme. Any changes made by the user to the system colors will be automatically reflected in the theme.
+React Native Paper provides built-in support for Android dynamic colors through `DynamicLightTheme` and `DynamicDarkTheme`. These themes use React Native's `PlatformColor` API to map all Material Design 3 color roles to Android system colors, so any changes the user makes to their system palette are automatically reflected in the app.
:::info
-In case of incompatible devices, the library will revert to a default theme.
+Dynamic colors require Android 12 (API 31+). On older Android versions and all other platforms, these themes fall back to the default `LightTheme` / `DarkTheme`.
:::
-To get started, follow the [installation instructions](https://github.com/pchmn/expo-material3-theme#installation) and check the following code:
-
```tsx
-import { useMaterial3Theme } from '@pchmn/expo-material3-theme';
import { useColorScheme } from 'react-native';
-import { MD3DarkTheme, MD3LightTheme, PaperProvider } from 'react-native-paper';
+import {
+ DynamicDarkTheme,
+ DynamicLightTheme,
+ PaperProvider,
+} from 'react-native-paper';
import App from './src/App';
export default function Main() {
- const colorScheme = useColorScheme();
- const { theme } = useMaterial3Theme();
-
- const paperTheme =
- colorScheme === 'dark'
- ? { ...MD3DarkTheme, colors: theme.dark }
- : { ...MD3LightTheme, colors: theme.light };
+ const isDarkMode = useColorScheme() === 'dark';
return (
-
+
);
@@ -471,111 +464,13 @@ export default function HomeScreen() {
}
```
-## Material Design 2
-
-Using Material Design 2 is fully supported in React Native Paper v5.x.
-
-### Simple setup
-
-In order to use the Material Design 2 theme you can just pass `{ version: 2 }` to the PaperProvider theme prop:
-
-```js
-import * as React from 'react';
-import { PaperProvider } from 'react-native-paper';
-import App from './src/App';
+## Material Design 3
-export default function Main() {
- return (
-
-
-
- );
-}
-```
-
-Specifying `{ version: 2 }` tells React Native Paper to use the built in Material Design 2 theme, so you don't have to fully extend it on your own.
-
-### Advanced setup
-
-As with any theme, you can also specify your custom properties within the Material Design 2 theme:
-
-```js
-import * as React from 'react';
-import { MD2LightTheme, PaperProvider } from 'react-native-paper';
-import App from './src/App';
-
-export default function Main() {
- const theme = {
- ...MD2LightTheme,
-
- // Specify a custom property
- custom: 'property',
-
- // Specify a custom nested property
- colors: {
- ...MD2LightTheme.colors,
- primary: '#fefefe',
- },
- };
-
- return (
-
-
-
- );
-}
-```
-
-### Typescript
-
-Due to the amount of changes in the theme's schema shape it falls into the [Advanced theme overrides](#advanced-theme-overrides) category. The steps are identical as with any advanced theme, just make sure to extend the built-in `MD2LightTheme` or `MD2DarkTheme` instead of `MD3LightTheme` or `MD3DarkTheme`.
-
-The final example for Material Design 2 would look like this:
-
-```ts
-import * as React from 'react';
-import { MD2LightTheme, PaperProvider, useTheme } from 'react-native-paper';
-import App from './src/App';
-
-const theme = {
- // Extend Material Design 2 theme
-
- ...MD2LightTheme, // or MD2DarkTheme
-
- // Specify a custom property
- myOwnProperty: true,
-
- // Specify a custom nested property
- colors: {
- ...MD2LightTheme.colors,
- myOwnColor: '#BADA55',
- },
-};
-
-export type AppTheme = typeof theme;
-
-export const useAppTheme = () => useTheme();
-
-export default function Main() {
- return (
-
-
-
- );
-}
-
-// App.tsx
-
-export default function App() {
- const { theme } = useAppTheme();
-
- return ;
-}
-```
+React Native Paper ships with Material Design 3 (Material You) only. Customize the default experience by extending `MD3LightTheme` or `MD3DarkTheme` (see [Extending the theme](#extending-the-theme) and [Advanced theme overrides](#advanced-theme-overrides)).
-### Migrating to Material You
+### Migrating from Material Design 2
-If you are migrating from Material Design 2 (4.x and lower) to Material You (5.x), please refer to our [Migration Guide](https://callstack.github.io/react-native-paper/docs/guides/migration-guide-to-5.0)
+If you are upgrading from Material Design 2 (4.x and lower), follow the [Migration Guide](https://callstack.github.io/react-native-paper/docs/guides/migration-guide-to-5.0).
## Applying a theme to a paper component
diff --git a/docs/docs/guides/04-fonts.md b/docs/docs/guides/04-fonts.md
index 60d3c6e457..5e8e435c0a 100644
--- a/docs/docs/guides/04-fonts.md
+++ b/docs/docs/guides/04-fonts.md
@@ -47,99 +47,8 @@ Now, you are able to use `fontFamily` from font files.
## Configuring fonts in ThemeProvider
-### Material Design 2
-
-#### Using `configureFonts` helper
-
-To create a custom font, prepare a `fontConfig` object where fonts are divided by platforms. After that, you have to:
-
-* pass the `fontConfig` into `configureFonts` params object property called `config`
-* set the params object property `isV3` to `false`.
-
-The `fontConfig` object accepts `ios`, `android`, `macos`, `windows`, `web`, and `native`. Use these to override fonts on particular platforms.
-
-:::info
-At a minimum, you need to explicitly pass fonts for `android`, `ios`, and `web`.
-:::
-
-```js
-import * as React from 'react';
-import { configureFonts, MD2LightTheme, PaperProvider } from 'react-native-paper';
-import App from './src/App';
-
-const fontConfig = {
- web: {
- regular: {
- fontFamily: 'sans-serif',
- fontWeight: 'normal',
- },
- medium: {
- fontFamily: 'sans-serif-medium',
- fontWeight: 'normal',
- },
- light: {
- fontFamily: 'sans-serif-light',
- fontWeight: 'normal',
- },
- thin: {
- fontFamily: 'sans-serif-thin',
- fontWeight: 'normal',
- },
- },
- ios: {
- regular: {
- fontFamily: 'sans-serif',
- fontWeight: 'normal',
- },
- medium: {
- fontFamily: 'sans-serif-medium',
- fontWeight: 'normal',
- },
- light: {
- fontFamily: 'sans-serif-light',
- fontWeight: 'normal',
- },
- thin: {
- fontFamily: 'sans-serif-thin',
- fontWeight: 'normal',
- },
- },
- android: {
- regular: {
- fontFamily: 'sans-serif',
- fontWeight: 'normal',
- },
- medium: {
- fontFamily: 'sans-serif-medium',
- fontWeight: 'normal',
- },
- light: {
- fontFamily: 'sans-serif-light',
- fontWeight: 'normal',
- },
- thin: {
- fontFamily: 'sans-serif-thin',
- fontWeight: 'normal',
- },
- }
-};
-
-const theme = {
- ...MD2LightTheme,
- fonts: configureFonts({config: fontConfig, isV3: false}),
-};
-
-export default function Main() {
- return (
-
-
-
- );
-}
-```
-
-:::tip
-If you're using TypeScript use `as const` when defining `fontConfig`.
+:::note
+Older Material Design 2 platform-split font configuration (`configureFonts` with per-platform `ios` / `android` / `web` keys) is no longer supported. Use the Material Design 3 typescale and `configureFonts` as documented below.
:::
### Material Design 3
diff --git a/docs/docs/guides/06-recommended-libraries.md b/docs/docs/guides/06-recommended-libraries.md
index e70157ca1d..7be319cedf 100644
--- a/docs/docs/guides/06-recommended-libraries.md
+++ b/docs/docs/guides/06-recommended-libraries.md
@@ -33,8 +33,4 @@ Material Design themed [date picker](https://material.io/components/date-pickers
## Time Picker
[web-ridge/react-native-paper-dates](https://github.com/web-ridge/react-native-paper-dates)
-Material Design themed [time picker](https://material.io/components/time-pickers), maintained by [@RichardLindhout](https://twitter.com/RichardLindhout)
-
-## System Colors
-[pchmn/expo-material3-theme](https://github.com/pchmn/expo-material3-theme)
-Retrieve Material 3 system colors from Android 12+ devices
\ No newline at end of file
+Material Design themed [time picker](https://material.io/components/time-pickers), maintained by [@RichardLindhout](https://twitter.com/RichardLindhout)
diff --git a/docs/docs/guides/08-theming-with-react-navigation.md b/docs/docs/guides/08-theming-with-react-navigation.md
index 6003953c02..15dbfbbec6 100644
--- a/docs/docs/guides/08-theming-with-react-navigation.md
+++ b/docs/docs/guides/08-theming-with-react-navigation.md
@@ -11,25 +11,9 @@ But how to make them work together?
## Themes adaptation
-### Material Design 2
-
-Fortunately, in Material Design 2, both React Navigation and React Native Paper offer very similar API when it comes to theming and theme color structure. It's possible to import them in light and dark variants from both.
-
-```js
-import {
- DarkTheme as NavigationDarkTheme,
- DefaultTheme as NavigationDefaultTheme,
-} from '@react-navigation/native';
-
-import {
- MD2LightTheme,
- MD2DarkTheme,
-} from 'react-native-paper';
-```
-
### Material Design 3
-From v5, React Native Paper theme colors structure follows the Material Design 3 (known as Material You) colors system, which differs significantly from both the previous Paper's theme and React Navigation theme.
+React Native Paper follows the Material Design 3 (Material You) color system, which differs from React Navigation’s default theme shape.
However, to simplify adapting React Navigation theme colors, to use the ones from React Native Paper, it's worth using a utility called `adaptNavigationTheme` – it accepts navigation-compliant themes in both modes and returns their equivalents adjusted to Material Design 3.
@@ -127,24 +111,6 @@ To make things easier we can use [deepmerge](https://www.npmjs.com/package/deepm
npm install deepmerge
```
-### Material Design 2
-
-```js
-import {
- NavigationContainer,
- DarkTheme as NavigationDarkTheme,
- DefaultTheme as NavigationDefaultTheme,
-} from '@react-navigation/native';
-import {
- MD2DarkTheme,
- MD2LightTheme,
-} from 'react-native-paper';
-import merge from 'deepmerge';
-
-const CombinedDefaultTheme = merge(MD2LightTheme, NavigationDefaultTheme);
-const CombinedDarkTheme = merge(MD2DarkTheme, NavigationDarkTheme);
-```
-
### Material Design 3
```js
@@ -171,27 +137,6 @@ const CombinedDarkTheme = merge(MD3DarkTheme, DarkTheme);
Alternatively, we could merge those themes using vanilla JavaScript:
-### Material Design 2
-
-```js
-const CombinedDefaultTheme = {
- ...MD2LightTheme,
- ...NavigationDefaultTheme,
- colors: {
- ...MD2LightTheme.colors,
- ...NavigationDefaultTheme.colors,
- },
-};
-const CombinedDarkTheme = {
- ...MD2DarkTheme,
- ...NavigationDarkTheme,
- colors: {
- ...MD2DarkTheme.colors,
- ...NavigationDarkTheme.colors,
- },
-};
-```
-
### Material Design 3
```js
diff --git a/docs/docs/guides/10-migration-guide-to-5.0.md b/docs/docs/guides/10-migration-guide-to-5.0.md
index 6c358d387f..7631b8cf94 100644
--- a/docs/docs/guides/10-migration-guide-to-5.0.md
+++ b/docs/docs/guides/10-migration-guide-to-5.0.md
@@ -4,7 +4,7 @@ title: Introducing v5 with Material You
React Native Paper v5 is all about adopting the new Material Design 3 aka Material You. It was released in October 2021 after intense work and effort to make Material You follow a more expressive approach to design.
-Paper now supports both Material Design 2 and 3 through the configuration described in [Versioning](#versioning) and is compatible with a handful of API changes.
+Current releases use Material Design 3 only; the historical `version: 2` / MD2 theme APIs described below were removed after v5. Use this guide when upgrading older apps to MD3.
# Migration guide to Material You 5.0
@@ -36,15 +36,12 @@ npx pod-install
### Versioning
-Introducing Material You (MD3) into `react-native-paper` doesn't mean dropping previous Material Design (MD2)! On the contrary, both of them will be supported, however, not simultaneously. To specify which design system components should follow in the app, there is a newly created property in [the theme](https://callstack.github.io/react-native-paper/docs/guides/theming#theme-properties) named `version` that accepts one of two values:
-
-* 3 – (default) new Material You (MD3),
-* 2 - previous Material Design (MD2).
+In v5, Material You (MD3) became the default theme. Earlier releases also exposed `version: 2` for Material Design 2; that option and MD2 theme exports have since been removed—use MD3 themes (`MD3LightTheme` / `MD3DarkTheme`) only.
```js
theme: {
/* ... */
- version: 3 | 2
+ version: 3
}
```
@@ -166,35 +163,13 @@ Take a look at the suggested replacement diff:
### Configure fonts
-The existing utility called `configureFonts` was adjusted to help users configure their theme fonts in both version, that's why that function, as of today, is going to accept the object with the follwing properties as an argument:
+The `configureFonts` helper configures the Material Design 3 typescale. Pass overrides via the `config` object (see [Fonts](https://callstack.github.io/react-native-paper/docs/guides/fonts.html)).
```ts
-configureFonts(params)
-```
-
-Parameters:
-
-| NAME | TYPE | REQUIRED |
-| ----------- | ----------- | ----------- |
-| params | object | No |
-
-Valid `params` keys are:
-
- * `config` ([MD2FontsConfig](https://github.com/callstack/react-native-paper/blob/main/src/styles/fonts.tsx#L63) | [MD3FontsConfig](https://github.com/callstack/react-native-paper/blob/main/src/styles/fonts.tsx#L67)) - fonts config object appropriate to the MD version
- * `isV3` (boolean) - whether adjusting theme fonts for v3. Default it true.
-
-To use your current font config from v2 and migrate to v3 there are two requirements:
-* the font config previously passed directly into function has to be passed into the params object property called `config`
-* the params object property `isV3` has to be set to `false`
-
-```diff
-- configureFonts(fontConfig)
-+ configureFonts({config: fontConfig, isV3: false})
+configureFonts({ config: { bodyLarge: { fontFamily: 'System' } } })
```
-:::tip
-If you want to check how to use `configureFonts` on MD3, check the [Fonts](https://callstack.github.io/react-native-paper/docs/guides/fonts.html) guide.
-:::
+Older direct calls like `configureFonts(fontConfig)` and MD2 platform-split configs should be replaced with MD3 variant keys (`displayLarge`, `bodyMedium`, and so on).
## Components
diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js
index 1dec1bb6ec..ab4a61be5e 100644
--- a/docs/docusaurus.config.js
+++ b/docs/docusaurus.config.js
@@ -170,6 +170,7 @@ const config = {
TextInputAffix: 'TextInput/Adornment/TextInputAffix',
TextInputIcon: 'TextInput/Adornment/TextInputIcon',
},
+ TextField: 'TextField/TextField',
ToggleButton: {
ToggleButton: 'ToggleButton/ToggleButton',
ToggleButtonGroup: 'ToggleButton/ToggleButtonGroup',
@@ -206,6 +207,8 @@ const config = {
}
const customUrls = {
+ TextField: 'src/components/TextField/TextField.tsx',
+ TextInput: 'src/components/TextInput/TextInput.tsx',
TextInputAffix:
'src/components/TextInput/Adornment/TextInputAffix.tsx',
TextInputIcon:
diff --git a/docs/src/components/PropTable.tsx b/docs/src/components/PropTable.tsx
index 35f5069433..47ffe3d4f5 100644
--- a/docs/src/components/PropTable.tsx
+++ b/docs/src/components/PropTable.tsx
@@ -11,17 +11,23 @@ const typeDefinitions = {
'https://github.com/callstack/react-native-paper/blob/main/src/components/Icon.tsx#L16',
ThemeProp:
'https://callstack.github.io/react-native-paper/docs/guides/theming#theme-properties',
+ 'ComponentType':
+ 'https://github.com/callstack/react-native-paper/blob/main/src/components/TextField/TextField.tsx#L21',
AccessibilityState:
'https://reactnative.dev/docs/accessibility#accessibilitystate',
'StyleProp': 'https://reactnative.dev/docs/view-style-props',
'StyleProp': 'https://reactnative.dev/docs/text-style-props',
+ TextProps: 'https://reactnative.dev/docs/text#props',
};
const renderBadge = (annotation: string) => {
const [annotType, ...annotLabel] = annotation.split(' ');
// eslint-disable-next-line prettier/prettier
- return `${annotLabel.join(' ')}`;
+ return `${annotLabel.join(' ')}`;
};
export default function PropTable({
@@ -56,7 +62,9 @@ export default function PropTable({
if (line.includes('@')) {
const annotIndex = line.indexOf('@');
// eslint-disable-next-line prettier/prettier
- return `${line.substr(0, annotIndex)} ${renderBadge(line.substr(annotIndex))}`;
+ return `${line.substr(0, annotIndex)} ${renderBadge(
+ line.substr(annotIndex)
+ )}`;
} else {
return line;
}
diff --git a/docs/src/data/screenshots.js b/docs/src/data/screenshots.js
index c1afa99a6a..185fa877a3 100644
--- a/docs/src/data/screenshots.js
+++ b/docs/src/data/screenshots.js
@@ -146,6 +146,10 @@ const screenshots = {
'iOS (disabled)': 'screenshots/switch-disabled.ios.png',
},
Text: 'screenshots/typography.png',
+ TextField: {
+ filled: 'screenshots/text-field-filled.png',
+ outlined: 'screenshots/text-field-outlined.png',
+ },
TextInput: {
'flat (focused)': 'screenshots/textinput-flat.focused.png',
'flat (disabled)': 'screenshots/textinput-flat.disabled.png',
diff --git a/docs/static/llms.txt b/docs/static/llms.txt
index 46da789d41..4029ace3ea 100644
--- a/docs/static/llms.txt
+++ b/docs/static/llms.txt
@@ -7,7 +7,7 @@
- Install: npm install react-native-paper react-native-safe-area-context
- Wrap your app with PaperProvider
-- Default theme is Material You (MD3); set theme.version: 2 for MD2
+- Default theme is Material You (MD3)
- Requires React Native 0.72+ and React 18+
## Guides
@@ -63,7 +63,7 @@
- Theme object accepts colors, dark, roundness, fonts, animation, and version properties
- Use useTheme() hook or ThemeProvider for nested theme overrides
-- MD3 (Material You) is the default; set version: 2 for MD2 compatibility
+- MD3 (Material You) is the only supported design system; extend MD3LightTheme / MD3DarkTheme
- See theming guide: https://callstack.github.io/react-native-paper/docs/guides/theming
## Provider Pattern
diff --git a/docs/static/screenshots/text-field-filled.png b/docs/static/screenshots/text-field-filled.png
new file mode 100644
index 0000000000..03ab10d37e
Binary files /dev/null and b/docs/static/screenshots/text-field-filled.png differ
diff --git a/docs/static/screenshots/text-field-outlined.png b/docs/static/screenshots/text-field-outlined.png
new file mode 100644
index 0000000000..1abb39e072
Binary files /dev/null and b/docs/static/screenshots/text-field-outlined.png differ
diff --git a/example/package.json b/example/package.json
index 667c56cb19..3ae36fb1ec 100644
--- a/example/package.json
+++ b/example/package.json
@@ -16,7 +16,6 @@
"dependencies": {
"@expo/vector-icons": "^15.0.2",
"@expo/webpack-config": "~19.0.1",
- "@pchmn/expo-material3-theme": "^1.3.2",
"@react-native-async-storage/async-storage": "2.2.0",
"@react-native-masked-view/masked-view": "0.3.2",
"@react-navigation/bottom-tabs": "^7.3.10",
diff --git a/example/src/DrawerItems.tsx b/example/src/DrawerItems.tsx
index 2d3ca6c202..8bcee32967 100644
--- a/example/src/DrawerItems.tsx
+++ b/example/src/DrawerItems.tsx
@@ -9,7 +9,6 @@ import {
Button,
Dialog,
Drawer,
- MD2Colors,
MD3Colors,
Switch,
Text,
@@ -17,7 +16,7 @@ import {
Portal,
} from 'react-native-paper';
-import { deviceColorsSupported, isWeb } from '../utils';
+import { dynamicThemeSupported, isWeb } from '../utils';
import { useExampleTheme } from './hooks/useExampleTheme';
import { PreferencesContext } from './PreferencesContext';
@@ -104,10 +103,9 @@ function DrawerItems() {
if (!preferences) throw new Error('PreferencesContext not provided');
const {
- toggleShouldUseDeviceColors,
+ toggleShouldUseDynamicTheme,
toggleTheme,
toggleRtl: toggleRTL,
- toggleThemeVersion,
toggleCollapsed,
toggleCustomFont,
toggleRippleEffect,
@@ -116,7 +114,7 @@ function DrawerItems() {
collapsed,
rtl: isRTL,
theme: { dark: isDarkTheme },
- shouldUseDeviceColors,
+ shouldUseDynamicTheme,
} = preferences;
const _handleToggleRTL = () => {
@@ -137,14 +135,10 @@ function DrawerItems() {
};
const coloredLabelTheme = {
- colors: isV3
- ? {
- secondaryContainer: MD3Colors.tertiary80,
- onSecondaryContainer: MD3Colors.tertiary20,
- }
- : {
- primary: MD2Colors.tealA200,
- },
+ colors: {
+ secondaryContainer: MD3Colors.tertiary80,
+ onSecondaryContainer: MD3Colors.tertiary20,
+ },
};
return (
@@ -187,12 +181,12 @@ function DrawerItems() {
- {deviceColorsSupported && isV3 ? (
-
-
- Use device colors *
+ {dynamicThemeSupported ? (
+
+
+ Use Dynamic Theme
-
+
@@ -217,15 +211,6 @@ function DrawerItems() {
)}
-
-
- MD 2
-
-
-
-
-
-
{isV3 && (
diff --git a/example/src/ExampleList.tsx b/example/src/ExampleList.tsx
index 016f085caa..bdaa584e12 100644
--- a/example/src/ExampleList.tsx
+++ b/example/src/ExampleList.tsx
@@ -43,6 +43,7 @@ import SwitchExample from './Examples/SwitchExample';
import TeamDetails from './Examples/TeamDetails';
import TeamsList from './Examples/TeamsList';
import TextExample from './Examples/TextExample';
+import TextFieldExample from './Examples/TextFieldExample';
import TextInputExample from './Examples/TextInputExample';
import ThemeExample from './Examples/ThemeExample';
import ThemingWithReactNavigation from './Examples/ThemingWithReactNavigation';
@@ -89,6 +90,7 @@ export const mainExamples: Record<
surface: SurfaceExample,
switch: SwitchExample,
text: TextExample,
+ textField: TextFieldExample,
textInput: TextInputExample,
toggleButton: ToggleButtonExample,
tooltipExample: TooltipExample,
diff --git a/example/src/Examples/ActivityIndicatorExample.tsx b/example/src/Examples/ActivityIndicatorExample.tsx
index 8013142921..15686054fa 100644
--- a/example/src/Examples/ActivityIndicatorExample.tsx
+++ b/example/src/Examples/ActivityIndicatorExample.tsx
@@ -1,20 +1,12 @@
import * as React from 'react';
import { StyleSheet, View } from 'react-native';
-import {
- ActivityIndicator,
- FAB,
- List,
- MD2Colors,
- MD3Colors,
-} from 'react-native-paper';
+import { ActivityIndicator, FAB, List, MD3Colors } from 'react-native-paper';
-import { useExampleTheme } from '../hooks/useExampleTheme';
import ScreenWrapper from '../ScreenWrapper';
const ActivityIndicatorExample = () => {
const [animating, setAnimating] = React.useState(true);
- const { isV3 } = useExampleTheme();
return (
@@ -49,7 +41,7 @@ const ActivityIndicatorExample = () => {
diff --git a/example/src/Examples/AnimatedFABExample/AnimatedFABExample.tsx b/example/src/Examples/AnimatedFABExample/AnimatedFABExample.tsx
index 4bffa05322..f9b2303fad 100644
--- a/example/src/Examples/AnimatedFABExample/AnimatedFABExample.tsx
+++ b/example/src/Examples/AnimatedFABExample/AnimatedFABExample.tsx
@@ -3,13 +3,7 @@ import type { NativeScrollEvent, NativeSyntheticEvent } from 'react-native';
import { Animated, FlatList, Platform, StyleSheet, View } from 'react-native';
import Icon from '@expo/vector-icons/MaterialCommunityIcons';
-import {
- Avatar,
- MD2Colors,
- MD3Colors,
- Paragraph,
- Text,
-} from 'react-native-paper';
+import { Avatar, MD3Colors, Text } from 'react-native-paper';
import CustomFAB from './CustomFAB';
import CustomFABControls, {
@@ -32,7 +26,7 @@ type Item = {
};
const AnimatedFABExample = () => {
- const { colors, isV3 } = useExampleTheme();
+ const { colors } = useExampleTheme();
const isIOS = Platform.OS === 'ios';
@@ -47,63 +41,55 @@ const AnimatedFABExample = () => {
const renderItem = React.useCallback(
({ item }: { item: Item }) => {
- const TextComponent = isV3 ? Text : Paragraph;
-
return (
-
{item.sender}
-
-
+
{item.date}
-
+
-
{item.header}
-
-
+
{item.message}
-
+
setVisible(!visible)}
@@ -114,7 +100,7 @@ const AnimatedFABExample = () => {
);
},
- [visible, isV3]
+ [visible]
);
const onScroll = ({
diff --git a/example/src/Examples/AppbarExample.tsx b/example/src/Examples/AppbarExample.tsx
index 1ebe74bad5..f70294e67e 100644
--- a/example/src/Examples/AppbarExample.tsx
+++ b/example/src/Examples/AppbarExample.tsx
@@ -6,7 +6,7 @@ import {
Appbar,
FAB,
List,
- Paragraph,
+ MD3Colors,
RadioButton,
Snackbar,
Switch,
@@ -14,7 +14,6 @@ import {
} from 'react-native-paper';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
-import { yellowA200 } from '../../../src/styles/themes/v2/colors';
import { useExampleTheme } from '../hooks/useExampleTheme';
import ScreenWrapper from '../ScreenWrapper';
@@ -41,7 +40,7 @@ const AppbarExample = ({ navigation }: Props) => {
const theme = useExampleTheme();
const { bottom, left, right } = useSafeAreaInsets();
- const height = theme.isV3 ? 80 : 56;
+ const height = 80;
const isCenterAlignedMode = appbarMode === 'center-aligned';
@@ -92,21 +91,14 @@ const AppbarExample = ({ navigation }: Props) => {
showElevated,
]);
- const TextComponent = theme.isV3 ? Text : Paragraph;
-
const renderFAB = () => {
return (
{}}
- style={[
- styles.fab,
- theme.isV3
- ? { top: (height - MEDIUM_FAB_HEIGHT) / 2 }
- : { bottom: height / 2 + bottom },
- ]}
+ style={[styles.fab, { top: (height - MEDIUM_FAB_HEIGHT) / 2 }]}
/>
);
};
@@ -114,49 +106,41 @@ const AppbarExample = ({ navigation }: Props) => {
const renderDefaultOptions = () => (
<>
- Left icon
+ Left icon
- {!theme.isV3 && (
-
- Subtitle
-
-
- )}
- Search icon
+ Subtitle
+
+
+
+ Search icon
- More icon
+ More icon
- {theme.isV3 && (
-
- Calendar icon
-
-
- )}
- Custom Color
+ Calendar icon
+
+
+
+ Custom Color
- {!theme.isV3 && (
-
- Exact Dark Theme
-
-
- )}
- {theme.isV3 && (
-
- Elevated
-
-
- )}
+
+ Exact Dark Theme
+
+
+
+ Elevated
+
+
>
);
@@ -166,40 +150,34 @@ const AppbarExample = ({ navigation }: Props) => {
style={{ marginBottom: height + bottom }}
contentContainerStyle={styles.contentContainer}
>
- {theme.isV3 ? (
-
- {renderDefaultOptions()}
-
- ) : (
- renderDefaultOptions()
- )}
- {theme.isV3 && (
-
-
- setAppbarMode(value as AppbarModes)
- }
- >
-
- Small (default)
-
-
-
- Medium
-
-
-
- Large
-
-
-
- Center-aligned
-
-
-
-
- )}
+
+ {renderDefaultOptions()}
+
+
+
+ setAppbarMode(value as AppbarModes)
+ }
+ >
+
+ Small (default)
+
+
+
+ Medium
+
+
+
+ Large
+
+
+
+ Center-aligned
+
+
+
+
{
{
height: height + bottom,
},
- theme.isV3 && {
- backgroundColor: theme.colors.elevation.level2,
+ {
+ backgroundColor: theme.colors.surfaceContainerHigh,
},
]}
safeAreaInsets={{ bottom, left, right }}
@@ -218,9 +196,8 @@ const AppbarExample = ({ navigation }: Props) => {
{}} />
{}} />
{}} />
- {theme.isV3 && renderFAB()}
+ {renderFAB()}
- {!theme.isV3 && renderFAB()}
setShowSnackbar(false)}
@@ -258,6 +235,6 @@ const styles = StyleSheet.create({
right: 16,
},
customColor: {
- backgroundColor: yellowA200,
+ backgroundColor: MD3Colors.secondary80,
},
});
diff --git a/example/src/Examples/AvatarExample.tsx b/example/src/Examples/AvatarExample.tsx
index b77da80b09..229c2f4a0b 100644
--- a/example/src/Examples/AvatarExample.tsx
+++ b/example/src/Examples/AvatarExample.tsx
@@ -1,13 +1,11 @@
import * as React from 'react';
import { StyleSheet, View } from 'react-native';
-import { Avatar, List, MD2Colors, MD3Colors } from 'react-native-paper';
+import { Avatar, List, MD3Colors } from 'react-native-paper';
-import { useExampleTheme } from '../hooks/useExampleTheme';
import ScreenWrapper from '../ScreenWrapper';
const AvatarExample = () => {
- const { isV3 } = useExampleTheme();
return (
@@ -16,11 +14,11 @@ const AvatarExample = () => {
style={[
styles.avatar,
{
- backgroundColor: isV3 ? MD3Colors.error70 : MD2Colors.yellow500,
+ backgroundColor: MD3Colors.error70,
},
]}
label="XD"
- color={isV3 ? MD3Colors.primary0 : MD2Colors.black}
+ color={MD3Colors.primary0}
/>
@@ -32,11 +30,11 @@ const AvatarExample = () => {
style={[
styles.avatar,
{
- backgroundColor: isV3 ? MD3Colors.error70 : MD2Colors.yellow500,
+ backgroundColor: MD3Colors.error70,
},
]}
icon="folder"
- color={isV3 ? MD3Colors.primary0 : MD2Colors.black}
+ color={MD3Colors.primary0}
/>
diff --git a/example/src/Examples/BadgeExample.tsx b/example/src/Examples/BadgeExample.tsx
index 17f0e1b160..3269dc70a8 100644
--- a/example/src/Examples/BadgeExample.tsx
+++ b/example/src/Examples/BadgeExample.tsx
@@ -5,18 +5,15 @@ import {
Badge,
IconButton,
List,
- MD2Colors,
MD3Colors,
Text,
Switch,
} from 'react-native-paper';
-import { useExampleTheme } from '../hooks/useExampleTheme';
import ScreenWrapper from '../ScreenWrapper';
const BadgeExample = () => {
const [visible, setVisible] = React.useState(true);
- const { isV3 } = useExampleTheme();
return (
@@ -44,9 +41,7 @@ const BadgeExample = () => {
style={[
styles.badge,
{
- backgroundColor: isV3
- ? MD3Colors.primary80
- : MD2Colors.blue500,
+ backgroundColor: MD3Colors.primary80,
},
]}
>
@@ -59,11 +54,11 @@ const BadgeExample = () => {
-
+
-
+
diff --git a/example/src/Examples/BannerExample.tsx b/example/src/Examples/BannerExample.tsx
index 0e856e9699..7ec874a283 100644
--- a/example/src/Examples/BannerExample.tsx
+++ b/example/src/Examples/BannerExample.tsx
@@ -8,7 +8,7 @@ import {
View,
} from 'react-native';
-import { Banner, FAB, MD2Colors, MD3Colors } from 'react-native-paper';
+import { Banner, FAB, MD3Colors } from 'react-native-paper';
import { useExampleTheme } from '../hooks/useExampleTheme';
import ScreenWrapper from '../ScreenWrapper';
@@ -29,25 +29,18 @@ const BannerExample = () => {
setHeight(layoutHeight);
};
- const customTheme = !defaultTheme.isV3
- ? {
- ...defaultTheme,
- colors: {
- text: MD2Colors.white,
- surface: MD2Colors.blue200,
- primary: MD2Colors.purple900,
- },
- }
- : {
- ...defaultTheme,
- colors: {
- onSurface: MD3Colors.tertiary100,
- elevation: {
- level1: MD3Colors.tertiary50,
- },
- primary: MD3Colors.tertiary10,
- },
- };
+ const customTheme = {
+ ...defaultTheme,
+ colors: {
+ ...defaultTheme.colors,
+ onSurface: MD3Colors.tertiary100,
+ elevation: {
+ ...defaultTheme.colors.elevation,
+ level1: MD3Colors.tertiary50,
+ },
+ primary: MD3Colors.tertiary10,
+ },
+ };
return (
<>
diff --git a/example/src/Examples/BottomNavigationExample.tsx b/example/src/Examples/BottomNavigationExample.tsx
index 6ed5d7add5..419aca0f9d 100644
--- a/example/src/Examples/BottomNavigationExample.tsx
+++ b/example/src/Examples/BottomNavigationExample.tsx
@@ -17,7 +17,6 @@ import {
} from 'react-native-paper';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
-import { useExampleTheme } from '../hooks/useExampleTheme';
import ScreenWrapper from '../ScreenWrapper';
type Route = { route: { key: string } };
@@ -49,7 +48,6 @@ const PhotoGallery = ({ route }: Route) => {
};
const BottomNavigationExample = ({ navigation }: Props) => {
- const { isV3 } = useExampleTheme();
const insets = useSafeAreaInsets();
const [index, setIndex] = React.useState(0);
const [menuVisible, setMenuVisible] = React.useState(false);
@@ -63,34 +61,25 @@ const BottomNavigationExample = ({ navigation }: Props) => {
key: 'album',
title: 'Album',
focusedIcon: 'image-album',
- ...(!isV3 && { color: '#6200ee' }),
},
{
key: 'library',
title: 'Library',
focusedIcon: 'inbox',
+ unfocusedIcon: 'inbox-outline',
badge: true,
- ...(isV3
- ? { unfocusedIcon: 'inbox-outline' }
- : {
- color: '#2962ff',
- }),
},
{
key: 'favorites',
title: 'Favorites',
focusedIcon: 'heart',
- ...(isV3
- ? { unfocusedIcon: 'heart-outline' }
- : {
- color: '#00796b',
- }),
+ unfocusedIcon: 'heart-outline',
},
{
key: 'purchased',
title: 'Purchased',
focusedIcon: 'shopping',
- ...(isV3 ? { unfocusedIcon: 'shopping-outline' } : { color: '#c51162' }),
+ unfocusedIcon: 'shopping-outline',
},
]);
@@ -112,7 +101,6 @@ const BottomNavigationExample = ({ navigation }: Props) => {
setMenuVisible(true)}
- {...(!isV3 && { color: 'white' })}
/>
}
>
diff --git a/example/src/Examples/ButtonExample.tsx b/example/src/Examples/ButtonExample.tsx
index 7ec58f90f4..c6ecc56d09 100644
--- a/example/src/Examples/ButtonExample.tsx
+++ b/example/src/Examples/ButtonExample.tsx
@@ -9,11 +9,11 @@ import ScreenWrapper from '../ScreenWrapper';
const ButtonExample = () => {
const theme = useExampleTheme();
- const color = theme.isV3 ? theme.colors.inversePrimary : theme.colors.accent;
+ const color = theme.colors.inversePrimary;
return (
-
+
- {theme.isV3 && (
-
-
-
-
-
-
-
-
-
-
- )}
-
+
+
+
+
+
+
+
+
+
+
+
-
+
- {theme.isV3 && (
-
-
-
-
-
-
-
-
-
-
- )}
+
+
+
+
+
+
+
+
+
+
diff --git a/example/src/Examples/CheckboxExample.tsx b/example/src/Examples/CheckboxExample.tsx
index c8ce8c23a7..06088a646a 100644
--- a/example/src/Examples/CheckboxExample.tsx
+++ b/example/src/Examples/CheckboxExample.tsx
@@ -1,16 +1,8 @@
import * as React from 'react';
import { StyleSheet, View } from 'react-native';
-import {
- Checkbox,
- MD2Colors,
- MD3Colors,
- Paragraph,
- Text,
- TouchableRipple,
-} from 'react-native-paper';
+import { Checkbox, MD3Colors, Text, TouchableRipple } from 'react-native-paper';
-import { useExampleTheme } from '../hooks/useExampleTheme';
import ScreenWrapper from '../ScreenWrapper';
const CheckboxExample = () => {
@@ -18,14 +10,11 @@ const CheckboxExample = () => {
const [checkedCustom, setCheckedCustom] = React.useState(true);
const [indeterminate, setIndeterminate] = React.useState(true);
- const { isV3 } = useExampleTheme();
- const TextComponent = isV3 ? Text : Paragraph;
-
return (
setCheckedNormal(!checkedNormal)}>
- Normal
+ Normal
@@ -34,10 +23,10 @@ const CheckboxExample = () => {
setCheckedCustom(!checkedCustom)}>
- Custom
+ Custom
@@ -46,7 +35,7 @@ const CheckboxExample = () => {
setIndeterminate(!indeterminate)}>
- Indeterminate
+ Indeterminate
@@ -54,15 +43,15 @@ const CheckboxExample = () => {
- Checked (Disabled)
+ Checked (Disabled)
- Unchecked (Disabled)
+ Unchecked (Disabled)
- Indeterminate (Disabled)
+ Indeterminate (Disabled)
diff --git a/example/src/Examples/ChipExample.tsx b/example/src/Examples/ChipExample.tsx
index 20f0393153..211ebfde49 100644
--- a/example/src/Examples/ChipExample.tsx
+++ b/example/src/Examples/ChipExample.tsx
@@ -2,16 +2,8 @@ import * as React from 'react';
import { Image, StyleSheet, View } from 'react-native';
import color from 'color';
-import {
- Chip,
- List,
- MD2Colors,
- MD3Colors,
- Snackbar,
- Text,
-} from 'react-native-paper';
+import { Chip, List, MD3Colors, Snackbar, Text } from 'react-native-paper';
-import { useExampleTheme } from '../hooks/useExampleTheme';
import ScreenWrapper from '../ScreenWrapper';
const ChipExample = () => {
@@ -19,8 +11,7 @@ const ChipExample = () => {
visible: false,
text: '',
});
- const { isV3 } = useExampleTheme();
- const customColor = isV3 ? MD3Colors.error50 : MD2Colors.purple900;
+ const customColor = MD3Colors.error50;
return (
<>
@@ -30,24 +21,20 @@ const ChipExample = () => {
{}} style={styles.chip}>
Simple
- {isV3 && (
- <>
- {}}
- style={styles.chip}
- >
- With selected overlay
-
- {}} style={styles.chip}>
- Elevated
-
- {}}>
- Compact chip
-
- >
- )}
+ {}}
+ style={styles.chip}
+ >
+ With selected overlay
+
+ {}} style={styles.chip}>
+ Elevated
+
+ {}}>
+ Compact chip
+
{}}
onClose={() =>
@@ -137,35 +124,31 @@ const ChipExample = () => {
{}} style={styles.chip}>
Simple
- {isV3 && (
- <>
- {}}
- style={styles.chip}
- >
- With selected overlay
-
- {}}
- style={styles.chip}
- >
- Elevated
-
- {}}
- style={styles.chip}
- >
- Compact chip
-
- >
- )}
+ {}}
+ style={styles.chip}
+ >
+ With selected overlay
+
+ {}}
+ style={styles.chip}
+ >
+ Elevated
+
+ {}}
+ style={styles.chip}
+ >
+ Compact chip
+
{}}
@@ -251,38 +234,34 @@ const ChipExample = () => {
- {isV3 && (
- <>
- {}}
- compact
- avatar={
-
- }
- style={[styles.chip, styles.customBorderRadius]}
- >
- Compact with custom border radius
-
- {}}
- compact
- avatar={
-
- }
- style={[styles.chip, styles.customBorderRadius]}
- >
- Compact with custom border radius
-
- >
- )}
+ {}}
+ compact
+ avatar={
+
+ }
+ style={[styles.chip, styles.customBorderRadius]}
+ >
+ Compact with custom border radius
+
+ {}}
+ compact
+ avatar={
+
+ }
+ style={[styles.chip, styles.customBorderRadius]}
+ >
+ Compact with custom border radius
+
{}}
diff --git a/example/src/Examples/Dialogs/DialogWithCustomColors.tsx b/example/src/Examples/Dialogs/DialogWithCustomColors.tsx
index 251b7b6fdb..e3bffafd60 100644
--- a/example/src/Examples/Dialogs/DialogWithCustomColors.tsx
+++ b/example/src/Examples/Dialogs/DialogWithCustomColors.tsx
@@ -1,15 +1,8 @@
import * as React from 'react';
-import {
- Button,
- Portal,
- Dialog,
- MD2Colors,
- MD3Colors,
-} from 'react-native-paper';
+import { Button, Portal, Dialog, MD3Colors } from 'react-native-paper';
import { TextComponent } from './DialogTextComponent';
-import { useExampleTheme } from '../../hooks/useExampleTheme';
const DialogWithCustomColors = ({
visible,
@@ -18,34 +11,25 @@ const DialogWithCustomColors = ({
visible: boolean;
close: () => void;
}) => {
- const { isV3 } = useExampleTheme();
-
return (
diff --git a/example/src/Examples/ProgressBarExample.tsx b/example/src/Examples/ProgressBarExample.tsx
index 565147f4c6..5ab797bb1d 100644
--- a/example/src/Examples/ProgressBarExample.tsx
+++ b/example/src/Examples/ProgressBarExample.tsx
@@ -4,7 +4,6 @@ import { View, StyleSheet, Animated } from 'react-native';
import {
Button,
ProgressBar,
- MD2Colors,
MD3Colors,
ProgressBarProps,
Text,
@@ -29,7 +28,6 @@ const ProgressBarExample = () => {
const [visible, setVisible] = React.useState(true);
const [progress, setProgress] = React.useState(0.3);
const theme = useExampleTheme();
- const { isV3 } = theme;
const { current: progressBarValue } = React.useRef(new Animated.Value(0));
const runCustomAnimation = () => {
@@ -64,7 +62,7 @@ const ProgressBarExample = () => {
@@ -75,9 +73,9 @@ const ProgressBarExample = () => {
diff --git a/example/src/Examples/RadioButtonExample.tsx b/example/src/Examples/RadioButtonExample.tsx
index 88bf9ebfb7..7e3b3cf754 100644
--- a/example/src/Examples/RadioButtonExample.tsx
+++ b/example/src/Examples/RadioButtonExample.tsx
@@ -2,29 +2,24 @@ import * as React from 'react';
import { StyleSheet, View } from 'react-native';
import {
- MD2Colors,
MD3Colors,
- Paragraph,
RadioButton,
Text,
TouchableRipple,
} from 'react-native-paper';
-import { useExampleTheme } from '../hooks/useExampleTheme';
import ScreenWrapper from '../ScreenWrapper';
type State = 'normal' | 'normal-ios' | 'normal-item' | 'custom';
const RadioButtonExample = () => {
const [checked, setChecked] = React.useState('normal');
- const { isV3 } = useExampleTheme();
- const TextComponent = isV3 ? Text : Paragraph;
return (
setChecked('normal')}>
- Normal - Material Design
+ Normal - Material Design
{
setChecked('normal-ios')}>
- Normal 2 - IOS
+ Normal 2 - IOS
{
setChecked('custom')}>
- Custom
+ Custom
@@ -63,11 +58,11 @@ const RadioButtonExample = () => {
onPress={() => setChecked('normal-item')}
/>
- Checked (Disabled)
+ Checked (Disabled)
- Unchecked (Disabled)
+ Unchecked (Disabled)
{
const [valueNormal, setNormalValue] = React.useState(true);
const [valueCustom, setCustomValue] = React.useState(true);
- const { isV3 } = useExampleTheme();
-
const switchValueNormalLabel = `switch ${
valueNormal === true ? 'on' : 'off'
}`;
@@ -26,13 +16,11 @@ const SwitchExample = () => {
valueCustom === true ? 'on' : 'off'
}`;
- const TextComponent = isV3 ? Text : Paragraph;
-
return Platform.OS === 'android' ? (
setNormalValue(!valueNormal)}>
- Normal {switchValueNormalLabel}
+ Normal {switchValueNormalLabel}
@@ -40,47 +28,44 @@ const SwitchExample = () => {
setCustomValue(!valueCustom)}>
- Custom {switchValueCustomlLabel}
+ Custom {switchValueCustomlLabel}
-
+
- Switch on (disabled)
+ Switch on (disabled)
- Switch off (disabled)
+ Switch off (disabled)
) : (
- Normal {switchValueNormalLabel}
+ Normal {switchValueNormalLabel}
setNormalValue(!valueNormal)}
/>
- Custom {switchValueCustomlLabel}
+ Custom {switchValueCustomlLabel}
setCustomValue(!valueCustom)}
- color={isV3 ? MD3Colors.tertiary50 : MD2Colors.blue500}
+ color={MD3Colors.tertiary50}
/>
- Switch on (disabled)
+ Switch on (disabled)
- Switch off (disabled)
+ Switch off (disabled)
diff --git a/example/src/Examples/TextFieldExample.tsx b/example/src/Examples/TextFieldExample.tsx
new file mode 100644
index 0000000000..f0c2758696
--- /dev/null
+++ b/example/src/Examples/TextFieldExample.tsx
@@ -0,0 +1,213 @@
+import * as React from 'react';
+import { Pressable, StyleSheet, View } from 'react-native';
+
+import {
+ Icon,
+ List,
+ TextField,
+ type TextFieldAccessoryProps,
+} from 'react-native-paper';
+
+import { useExampleTheme } from '../hooks/useExampleTheme';
+import ScreenWrapper from '../ScreenWrapper';
+
+const TextFieldExample = () => {
+ const { colors } = useExampleTheme();
+ const iconMuted = colors.onSurfaceVariant;
+ const [searchQuery, setSearchQuery] = React.useState('');
+ const [email, setEmail] = React.useState('');
+ const [filledPassword, setFilledPassword] = React.useState('');
+ const [filledNotes, setFilledNotes] = React.useState('');
+ const [outlinedSearchQuery, setOutlinedSearchQuery] = React.useState('');
+ const [outlinedText, setOutlinedText] = React.useState('');
+ const [outlinedPassword, setOutlinedPassword] = React.useState('');
+ const [outlinedNotes, setOutlinedNotes] = React.useState('');
+ const [errorField, setErrorField] = React.useState('invalid@');
+
+ const ClearFilledSearchAccessory = ({
+ style,
+ editable,
+ }: TextFieldAccessoryProps) => {
+ return (
+ setSearchQuery('')}
+ accessibilityRole="button"
+ accessibilityLabel="Clear text"
+ >
+
+
+ );
+ };
+
+ const ClearOutlinedSearchAccessory = ({
+ style,
+ editable,
+ }: TextFieldAccessoryProps) => {
+ return (
+ setOutlinedSearchQuery('')}
+ accessibilityRole="button"
+ accessibilityLabel="Clear text"
+ >
+
+
+ );
+ };
+
+ const SearchLeadingAccessory = ({ style }: TextFieldAccessoryProps) => {
+ return (
+
+
+
+ );
+ };
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
+TextFieldExample.title = 'TextField';
+
+const styles = StyleSheet.create({
+ container: {
+ paddingHorizontal: 16,
+ paddingVertical: 8,
+ },
+ field: {},
+ section: {
+ gap: 16,
+ },
+});
+
+export default TextFieldExample;
diff --git a/example/src/Examples/TextInputExample.tsx b/example/src/Examples/TextInputExample.tsx
index 7102abd0b6..37c039ba13 100644
--- a/example/src/Examples/TextInputExample.tsx
+++ b/example/src/Examples/TextInputExample.tsx
@@ -13,7 +13,6 @@ import {
configureFonts,
HelperText,
List,
- MD2Colors,
MD3Colors,
TextInput,
} from 'react-native-paper';
@@ -138,11 +137,7 @@ const TextInputExample = () => {
const newColors = {
...state.iconsColor,
- [name]: !color
- ? theme.isV3
- ? theme.colors.primary
- : theme.colors?.accent
- : undefined,
+ [name]: !color ? theme.colors.primary : undefined,
};
dispatch({
@@ -572,9 +567,7 @@ const TextInputExample = () => {
*
@@ -604,12 +597,8 @@ const TextInputExample = () => {
onChangeText={(flatUnderlineColors) =>
inputActionHandler('flatUnderlineColors', flatUnderlineColors)
}
- underlineColor={
- theme.isV3 ? MD3Colors.primary70 : MD2Colors.pink400
- }
- activeUnderlineColor={
- theme.isV3 ? MD3Colors.tertiary50 : MD2Colors.amber900
- }
+ underlineColor={MD3Colors.primary70}
+ activeUnderlineColor={MD3Colors.tertiary50}
/>
{
onChangeText={(outlinedColors) =>
inputActionHandler('outlinedColors', outlinedColors)
}
- outlineColor={
- theme.isV3 ? MD3Colors.primary70 : MD2Colors.pink400
- }
- activeOutlineColor={
- theme.isV3 ? MD3Colors.tertiary50 : MD2Colors.amber900
- }
+ outlineColor={MD3Colors.primary70}
+ activeOutlineColor={MD3Colors.tertiary50}
/>
void;
toggleRtl: () => void;
- toggleThemeVersion: () => void;
toggleCollapsed: () => void;
toggleCustomFont: () => void;
toggleRippleEffect: () => void;
- toggleShouldUseDeviceColors?: () => void;
- theme: MD2Theme | MD3Theme;
+ toggleShouldUseDynamicTheme?: () => void;
+ theme: MD3Theme;
rtl: boolean;
collapsed: boolean;
customFontLoaded: boolean;
rippleEffectEnabled: boolean;
- shouldUseDeviceColors?: boolean;
+ shouldUseDynamicTheme?: boolean;
} | null>(null);
diff --git a/example/src/hooks/useExampleTheme.ts b/example/src/hooks/useExampleTheme.ts
index 9196f044b0..059ab4d05c 100644
--- a/example/src/hooks/useExampleTheme.ts
+++ b/example/src/hooks/useExampleTheme.ts
@@ -1,3 +1,3 @@
-import { MD2Theme, MD3Theme, useTheme } from 'react-native-paper';
+import { useTheme, type MD3Theme } from 'react-native-paper';
-export const useExampleTheme = () => useTheme();
+export const useExampleTheme = () => useTheme();
diff --git a/example/src/index.native.tsx b/example/src/index.native.tsx
index 0878a1f13b..821386cc83 100644
--- a/example/src/index.native.tsx
+++ b/example/src/index.native.tsx
@@ -1,7 +1,6 @@
import * as React from 'react';
import { I18nManager } from 'react-native';
-import { useMaterial3Theme } from '@pchmn/expo-material3-theme';
import AsyncStorage from '@react-native-async-storage/async-storage';
import { createDrawerNavigator } from '@react-navigation/drawer';
import { InitialState, NavigationContainer } from '@react-navigation/native';
@@ -11,17 +10,17 @@ import { StatusBar } from 'expo-status-bar';
import * as Updates from 'expo-updates';
import {
PaperProvider,
- MD2DarkTheme,
- MD2LightTheme,
MD3DarkTheme,
MD3LightTheme,
+ DynamicLightTheme,
+ DynamicDarkTheme,
} from 'react-native-paper';
import { SafeAreaInsetsContext } from 'react-native-safe-area-context';
import DrawerItems from './DrawerItems';
-import App from './RootNavigator';
-import { deviceColorsSupported } from '../utils';
import { PreferencesContext } from './PreferencesContext';
+import App from './RootNavigator';
+import { dynamicThemeSupported } from '../utils';
import {
CombinedDefaultTheme,
CombinedDarkTheme,
@@ -46,10 +45,9 @@ export default function PaperExample() {
InitialState | undefined
>();
- const [shouldUseDeviceColors, setShouldUseDeviceColors] =
+ const [shouldUseDynamicTheme, setShouldUseDynamicTheme] =
React.useState(true);
const [isDarkMode, setIsDarkMode] = React.useState(false);
- const [themeVersion, setThemeVersion] = React.useState<2 | 3>(3);
const [rtl, setRtl] = React.useState(
I18nManager.getConstants().isRTL
);
@@ -57,20 +55,13 @@ export default function PaperExample() {
const [customFontLoaded, setCustomFont] = React.useState(false);
const [rippleEffectEnabled, setRippleEffectEnabled] = React.useState(true);
- const { theme: mdTheme } = useMaterial3Theme();
const theme = React.useMemo(() => {
- if (themeVersion === 2) {
- return isDarkMode ? MD2DarkTheme : MD2LightTheme;
- }
-
- if (!deviceColorsSupported || !shouldUseDeviceColors) {
- return isDarkMode ? MD3DarkTheme : MD3LightTheme;
+ if (dynamicThemeSupported && shouldUseDynamicTheme) {
+ return isDarkMode ? DynamicDarkTheme : DynamicLightTheme;
}
- return isDarkMode
- ? { ...MD3DarkTheme, colors: mdTheme.dark }
- : { ...MD3LightTheme, colors: mdTheme.light };
- }, [isDarkMode, mdTheme, shouldUseDeviceColors, themeVersion]);
+ return isDarkMode ? MD3DarkTheme : MD3LightTheme;
+ }, [isDarkMode, shouldUseDynamicTheme]);
React.useEffect(() => {
const restoreState = async () => {
@@ -137,32 +128,26 @@ export default function PaperExample() {
const preferences = React.useMemo(
() => ({
- toggleShouldUseDeviceColors: () =>
- setShouldUseDeviceColors((oldValue) => !oldValue),
+ toggleShouldUseDynamicTheme: () =>
+ setShouldUseDynamicTheme((oldValue) => !oldValue),
toggleTheme: () => setIsDarkMode((oldValue) => !oldValue),
toggleRtl: () => setRtl((rtl) => !rtl),
toggleCollapsed: () => setCollapsed(!collapsed),
toggleCustomFont: () => setCustomFont(!customFontLoaded),
toggleRippleEffect: () => setRippleEffectEnabled(!rippleEffectEnabled),
- toggleThemeVersion: () => {
- setCustomFont(false);
- setCollapsed(false);
- setThemeVersion((oldThemeVersion) => (oldThemeVersion === 2 ? 3 : 2));
- setRippleEffectEnabled(true);
- },
customFontLoaded,
rippleEffectEnabled,
collapsed,
rtl,
theme,
- shouldUseDeviceColors,
+ shouldUseDynamicTheme: shouldUseDynamicTheme,
}),
[
rtl,
theme,
collapsed,
customFontLoaded,
- shouldUseDeviceColors,
+ shouldUseDynamicTheme,
rippleEffectEnabled,
]
);
@@ -213,7 +198,7 @@ export default function PaperExample() {
);
}}
-
+
diff --git a/example/src/index.tsx b/example/src/index.tsx
index 76607763f1..a6ee5ccc08 100644
--- a/example/src/index.tsx
+++ b/example/src/index.tsx
@@ -5,13 +5,7 @@ import { createDrawerNavigator } from '@react-navigation/drawer';
import { InitialState, NavigationContainer } from '@react-navigation/native';
import { useFonts } from 'expo-font';
import { useKeepAwake } from 'expo-keep-awake';
-import {
- PaperProvider,
- MD3DarkTheme,
- MD3LightTheme,
- MD2DarkTheme,
- MD2LightTheme,
-} from 'react-native-paper';
+import { PaperProvider, MD3DarkTheme, MD3LightTheme } from 'react-native-paper';
import { SafeAreaInsetsContext } from 'react-native-safe-area-context';
import DrawerItems from './DrawerItems';
@@ -43,18 +37,14 @@ export default function PaperExample() {
>();
const [isDarkMode, setIsDarkMode] = React.useState(false);
- const [themeVersion, setThemeVersion] = React.useState<2 | 3>(3);
const [collapsed, setCollapsed] = React.useState(false);
const [customFontLoaded, setCustomFont] = React.useState(false);
const [rippleEffectEnabled, setRippleEffectEnabled] = React.useState(true);
- const theme = React.useMemo(() => {
- if (themeVersion === 2) {
- return isDarkMode ? MD2DarkTheme : MD2LightTheme;
- }
-
- return isDarkMode ? MD3DarkTheme : MD3LightTheme;
- }, [isDarkMode, themeVersion]);
+ const theme = React.useMemo(
+ () => (isDarkMode ? MD3DarkTheme : MD3LightTheme),
+ [isDarkMode]
+ );
React.useEffect(() => {
const restoreState = async () => {
@@ -112,12 +102,6 @@ export default function PaperExample() {
const preferences = React.useMemo(
() => ({
toggleTheme: () => setIsDarkMode((oldValue) => !oldValue),
- toggleThemeVersion: () => {
- setCustomFont(false);
- setCollapsed(false);
- setThemeVersion((oldThemeVersion) => (oldThemeVersion === 2 ? 3 : 2));
- setRippleEffectEnabled(true);
- },
toggleCollapsed: () => setCollapsed(!collapsed),
toggleCustomFont: () => setCustomFont(!customFontLoaded),
toggleRippleEffect: () => setRippleEffectEnabled(!rippleEffectEnabled),
@@ -127,9 +111,9 @@ export default function PaperExample() {
rippleEffectEnabled,
// noop for web, specified to avoid type errors
toggleRtl: noop,
- toggleShouldUseDeviceColors: noop,
+ toggleShouldUseDynamicTheme: noop,
rtl: false,
- shouldUseDeviceColors: false,
+ shouldUseDynamicTheme: false,
}),
[theme, collapsed, customFontLoaded, rippleEffectEnabled]
);
diff --git a/example/utils/index.ts b/example/utils/index.ts
index 5c15917644..d0856f19a5 100644
--- a/example/utils/index.ts
+++ b/example/utils/index.ts
@@ -1,6 +1,5 @@
import { Platform } from 'react-native';
-import ExpoMaterial3ThemeModule from '@pchmn/expo-material3-theme/build/ExpoMaterial3ThemeModule';
import { MD3DarkTheme, MD3LightTheme, MD3Theme } from 'react-native-paper';
type ReducerAction = {
@@ -1162,71 +1161,71 @@ export const colorThemes = {
pink: {
light: {
...MD3LightTheme,
- ...lightPinkColors,
+ colors: { ...MD3LightTheme.colors, ...lightPinkColors.colors },
},
dark: {
...MD3DarkTheme,
- ...darkPinkColors,
+ colors: { ...MD3DarkTheme.colors, ...darkPinkColors.colors },
},
},
green: {
light: {
...MD3LightTheme,
- ...lightGreenColors,
+ colors: { ...MD3LightTheme.colors, ...lightGreenColors.colors },
},
dark: {
...MD3DarkTheme,
- ...darkGreenColors,
+ colors: { ...MD3DarkTheme.colors, ...darkGreenColors.colors },
},
},
blue: {
light: {
...MD3LightTheme,
- ...lightBlueColors,
+ colors: { ...MD3LightTheme.colors, ...lightBlueColors.colors },
},
dark: {
...MD3DarkTheme,
- ...darkBlueColors,
+ colors: { ...MD3DarkTheme.colors, ...darkBlueColors.colors },
},
},
orange: {
light: {
...MD3LightTheme,
- ...lightOrangeColors,
+ colors: { ...MD3LightTheme.colors, ...lightOrangeColors.colors },
},
dark: {
...MD3DarkTheme,
- ...darkOrangeColors,
+ colors: { ...MD3DarkTheme.colors, ...darkOrangeColors.colors },
},
},
red: {
light: {
...MD3LightTheme,
- ...lightRedColors,
+ colors: { ...MD3LightTheme.colors, ...lightRedColors.colors },
},
dark: {
...MD3DarkTheme,
- ...darkRedColors,
+ colors: { ...MD3DarkTheme.colors, ...darkRedColors.colors },
},
},
yellow: {
light: {
...MD3LightTheme,
- ...lightYellowColors,
+ colors: { ...MD3LightTheme.colors, ...lightYellowColors.colors },
},
dark: {
...MD3DarkTheme,
- ...darkYellowColors,
+ colors: { ...MD3DarkTheme.colors, ...darkYellowColors.colors },
},
},
cyan: {
light: {
...MD3LightTheme,
- ...lightCyanColors,
+ colors: { ...MD3LightTheme.colors, ...lightCyanColors.colors },
},
dark: {
...MD3DarkTheme,
- ...darkCyanColors,
+ colors: { ...MD3DarkTheme.colors, ...darkCyanColors.colors },
},
},
} as { [key: string]: { light: MD3Theme; dark: MD3Theme } };
@@ -1420,7 +1419,5 @@ export const restaurantsData = [
},
];
-export const deviceColorsSupported =
- Boolean(ExpoMaterial3ThemeModule) &&
- Platform.OS === 'android' &&
- Platform.Version >= 31;
+export const dynamicThemeSupported =
+ Platform.OS === 'android' && (Platform.Version as number) >= 31;
diff --git a/src/babel/__fixtures__/rewrite-imports/code.js b/src/babel/__fixtures__/rewrite-imports/code.js
index cc5e6d0b5c..6509ef2f67 100644
--- a/src/babel/__fixtures__/rewrite-imports/code.js
+++ b/src/babel/__fixtures__/rewrite-imports/code.js
@@ -5,7 +5,6 @@ import {
Button,
FAB,
Appbar,
- MD2Colors,
MD3Colors,
NonExistent,
NonExistentSecond as Stuff,
diff --git a/src/babel/__fixtures__/rewrite-imports/output.js b/src/babel/__fixtures__/rewrite-imports/output.js
index ecaff8d814..7204b0ca33 100644
--- a/src/babel/__fixtures__/rewrite-imports/output.js
+++ b/src/babel/__fixtures__/rewrite-imports/output.js
@@ -4,7 +4,6 @@ import BottomNavigation from "react-native-paper/lib/module/components/BottomNav
import Button from "react-native-paper/lib/module/components/Button/Button";
import FAB from "react-native-paper/lib/module/components/FAB";
import Appbar from "react-native-paper/lib/module/components/Appbar";
-import * as MD2Colors from "react-native-paper/lib/module/styles/themes/v2/colors";
import { MD3Colors } from "react-native-paper/lib/module/styles/themes/v3/tokens";
import { NonExistent, NonExistentSecond as Stuff } from "react-native-paper/lib/module/index.js";
import { ThemeProvider } from "react-native-paper/lib/module/core/theming";
diff --git a/src/components/ActivityIndicator.tsx b/src/components/ActivityIndicator.tsx
index 5a3b9f8736..3de4e73d2f 100644
--- a/src/components/ActivityIndicator.tsx
+++ b/src/components/ActivityIndicator.tsx
@@ -45,10 +45,10 @@ const DURATION = 2400;
* ## Usage
* ```js
* import * as React from 'react';
- * import { ActivityIndicator, MD2Colors } from 'react-native-paper';
+ * import { ActivityIndicator, MD3Colors } from 'react-native-paper';
*
* const MyComponent = () => (
- *
+ *
* );
*
* export default MyComponent;
diff --git a/src/components/Appbar/Appbar.tsx b/src/components/Appbar/Appbar.tsx
index d59c626769..707f5c15c2 100644
--- a/src/components/Appbar/Appbar.tsx
+++ b/src/components/Appbar/Appbar.tsx
@@ -1,7 +1,6 @@
import * as React from 'react';
import {
Animated,
- Platform,
StyleProp,
StyleSheet,
View,
@@ -9,12 +8,9 @@ import {
ColorValue,
} from 'react-native';
-import color from 'color';
-
import AppbarContent from './AppbarContent';
import {
AppbarModes,
- DEFAULT_APPBAR_HEIGHT,
getAppbarBackgroundColor,
modeAppbarHeight,
renderAppbarContent,
@@ -114,7 +110,7 @@ export type Props = Omit<
* styles.bottom,
* {
* height: BOTTOM_APPBAR_HEIGHT + bottom,
- * backgroundColor: theme.colors.elevation.level2,
+ * backgroundColor: theme.colors.surfaceContainer,
* },
* ]}
* safeAreaInsets={{ bottom }}
@@ -165,11 +161,10 @@ const Appbar = ({
...rest
}: Props) => {
const theme = useInternalTheme(themeOverrides);
- const { isV3 } = theme;
const flattenedStyle = StyleSheet.flatten(style);
const {
backgroundColor: customBackground,
- elevation = isV3 ? (elevated ? 2 : 0) : 4,
+ elevation = elevated ? 2 : 0,
...restStyle
} = (flattenedStyle || {}) as Exclude & {
elevation?: number;
@@ -184,28 +179,17 @@ const Appbar = ({
);
const isMode = (modeToCompare: AppbarModes) => {
- return isV3 && mode === modeToCompare;
+ return mode === modeToCompare;
};
- let isDark = false;
-
- if (typeof dark === 'boolean') {
- isDark = dark;
- } else if (!isV3) {
- isDark =
- backgroundColor === 'transparent'
- ? false
- : typeof backgroundColor === 'string'
- ? !color(backgroundColor).isLight()
- : true;
- }
+ const isDark = typeof dark === 'boolean' ? dark : false;
- const isV3CenterAlignedMode = isV3 && isMode('center-aligned');
+ const isCenterAlignedMode = isMode('center-aligned');
let shouldCenterContent = false;
let shouldAddLeftSpacing = false;
let shouldAddRightSpacing = false;
- if ((!isV3 && Platform.OS === 'ios') || isV3CenterAlignedMode) {
+ if (isCenterAlignedMode) {
let hasAppbarContent = false;
let leftItemsCount = 0;
let rightItemsCount = 0;
@@ -225,14 +209,12 @@ const Appbar = ({
});
shouldCenterContent =
- hasAppbarContent &&
- leftItemsCount < 2 &&
- rightItemsCount < (isV3 ? 3 : 2);
+ hasAppbarContent && leftItemsCount < 2 && rightItemsCount < 3;
shouldAddLeftSpacing = shouldCenterContent && leftItemsCount === 0;
shouldAddRightSpacing = shouldCenterContent && rightItemsCount === 0;
}
- const spacingStyle = isV3 ? styles.v3Spacing : styles.spacing;
+ const spacingStyle = styles.v3Spacing;
const insets = {
paddingBottom: safeAreaInsets?.bottom,
@@ -247,27 +229,25 @@ const Appbar = ({
{ backgroundColor },
styles.appbar,
{
- height: isV3 ? modeAppbarHeight[mode] : DEFAULT_APPBAR_HEIGHT,
+ height: modeAppbarHeight[mode],
},
insets,
restStyle,
- !theme.isV3 && { elevation },
]}
elevation={elevation as MD3Elevation}
container
{...rest}
>
{shouldAddLeftSpacing ? : null}
- {(!isV3 || isMode('small') || isMode('center-aligned')) && (
+ {(isMode('small') || isMode('center-aligned')) && (
<>
{/* Render only the back action at first place */}
{renderAppbarContent({
children,
isDark,
theme,
- isV3,
renderOnly: ['Appbar.BackAction'],
- shouldCenterContent: isV3CenterAlignedMode || shouldCenterContent,
+ shouldCenterContent: isCenterAlignedMode || shouldCenterContent,
})}
{/* Render the rest of the content except the back action */}
{renderAppbarContent({
@@ -278,9 +258,8 @@ const Appbar = ({
],
isDark,
theme,
- isV3,
renderExcept: ['Appbar.BackAction'],
- shouldCenterContent: isV3CenterAlignedMode || shouldCenterContent,
+ shouldCenterContent: isCenterAlignedMode || shouldCenterContent,
})}
>
)}
@@ -297,14 +276,12 @@ const Appbar = ({
{renderAppbarContent({
children,
isDark,
- isV3,
renderOnly: ['Appbar.BackAction'],
mode,
})}
{renderAppbarContent({
children: filterAppbarActions(children, true),
isDark,
- isV3,
renderOnly: ['Appbar.Action'],
mode,
})}
@@ -313,7 +290,6 @@ const Appbar = ({
{renderAppbarContent({
children: filterAppbarActions(children),
isDark,
- isV3,
renderExcept: [
'Appbar',
'Appbar.BackAction',
@@ -327,7 +303,6 @@ const Appbar = ({
{renderAppbarContent({
children,
isDark,
- isV3,
renderOnly: ['Appbar.Content'],
mode,
})}
@@ -344,9 +319,6 @@ const styles = StyleSheet.create({
alignItems: 'center',
paddingHorizontal: 4,
},
- spacing: {
- width: 48,
- },
v3Spacing: {
width: 52,
},
diff --git a/src/components/Appbar/AppbarAction.tsx b/src/components/Appbar/AppbarAction.tsx
index ab5a72a110..212fcca952 100644
--- a/src/components/Appbar/AppbarAction.tsx
+++ b/src/components/Appbar/AppbarAction.tsx
@@ -1,17 +1,10 @@
import * as React from 'react';
-import type {
- Animated,
- ColorValue,
- StyleProp,
- View,
- ViewStyle,
-} from 'react-native';
+import type { Animated, StyleProp, View, ViewStyle } from 'react-native';
-import color from 'color';
import type { ThemeProp } from 'src/types';
import { useInternalTheme } from '../../core/theming';
-import { black } from '../../styles/themes/v2/colors';
+import type { MD3Theme } from '../../types';
import { forwardRef } from '../../utils/forwardRef';
import type { IconSource } from '../Icon';
import IconButton from '../IconButton/IconButton';
@@ -21,10 +14,6 @@ export type Props = React.ComponentPropsWithoutRef & {
* Custom color for action icon.
*/
color?: string;
- /**
- * Color of the ripple effect.
- */
- rippleColor?: ColorValue;
/**
* Name of the icon to show.
*/
@@ -92,20 +81,18 @@ const AppbarAction = forwardRef(
accessibilityLabel,
isLeading,
theme: themeOverrides,
- rippleColor,
...rest
}: Props,
ref
) => {
const theme = useInternalTheme(themeOverrides);
+ const { colors } = theme as MD3Theme;
const actionIconColor = iconColor
? iconColor
- : theme.isV3
- ? isLeading
- ? theme.colors.onSurface
- : theme.colors.onSurfaceVariant
- : color(black).alpha(0.54).rgb().string();
+ : isLeading
+ ? colors.onSurface
+ : colors.onSurfaceVariant;
return (
(
accessibilityLabel={accessibilityLabel}
animated
ref={ref}
- rippleColor={rippleColor}
{...rest}
/>
);
diff --git a/src/components/Appbar/AppbarContent.tsx b/src/components/Appbar/AppbarContent.tsx
index dad67e21c8..14005427d7 100644
--- a/src/components/Appbar/AppbarContent.tsx
+++ b/src/components/Appbar/AppbarContent.tsx
@@ -12,12 +12,14 @@ import {
ViewProps,
} from 'react-native';
-import color from 'color';
-
import { modeTextVariant } from './utils';
import { useInternalTheme } from '../../core/theming';
-import { white } from '../../styles/themes/v2/colors';
-import type { $RemoveChildren, MD3TypescaleKey, ThemeProp } from '../../types';
+import type {
+ $RemoveChildren,
+ MD3Theme,
+ MD3TypescaleKey,
+ ThemeProp,
+} from '../../types';
import Text, { TextRef } from '../Typography/Text';
type TitleString = {
@@ -102,8 +104,6 @@ export type Props = $RemoveChildren & {
*/
const AppbarContent = ({
color: titleColor,
- subtitle,
- subtitleStyle,
onPress,
disabled,
style,
@@ -117,15 +117,9 @@ const AppbarContent = ({
...rest
}: Props) => {
const theme = useInternalTheme(themeOverrides);
- const { isV3, colors } = theme;
-
- const titleTextColor = titleColor
- ? titleColor
- : isV3
- ? colors.onSurface
- : white;
+ const { colors, fonts } = theme as MD3Theme;
- const subtitleColor = color(titleTextColor).alpha(0.7).rgb().string();
+ const titleTextColor = titleColor ? titleColor : colors.onSurface;
const modeContainerStyles = {
small: styles.v3DefaultContainer,
@@ -138,7 +132,7 @@ const AppbarContent = ({
const contentWrapperProps = {
pointerEvents: 'box-none' as ViewProps['pointerEvents'],
- style: [styles.container, isV3 && modeContainerStyles[mode], style],
+ style: [styles.container, modeContainerStyles[mode], style],
testID,
...rest,
};
@@ -147,18 +141,13 @@ const AppbarContent = ({
<>
{typeof title === 'string' ? (
- {subtitle}
-
- ) : null}
>
);
@@ -233,12 +214,6 @@ const styles = StyleSheet.create({
justifyContent: 'flex-end',
paddingBottom: 28,
},
- title: {
- fontSize: Platform.OS === 'ios' ? 17 : 20,
- },
- subtitle: {
- fontSize: Platform.OS === 'ios' ? 11 : 14,
- },
});
const touchableRole: AccessibilityRole = 'button';
diff --git a/src/components/Appbar/AppbarHeader.tsx b/src/components/Appbar/AppbarHeader.tsx
index e0eb6386d7..9efe81bba1 100644
--- a/src/components/Appbar/AppbarHeader.tsx
+++ b/src/components/Appbar/AppbarHeader.tsx
@@ -13,7 +13,6 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { Appbar } from './Appbar';
import {
- DEFAULT_APPBAR_HEIGHT,
getAppbarBackgroundColor,
modeAppbarHeight,
getAppbarBorders,
@@ -104,14 +103,13 @@ const AppbarHeader = ({
...rest
}: Props) => {
const theme = useInternalTheme(themeOverrides);
- const { isV3 } = theme;
const flattenedStyle = StyleSheet.flatten(style);
const {
- height = isV3 ? modeAppbarHeight[mode] : DEFAULT_APPBAR_HEIGHT,
- elevation = isV3 ? (elevated ? 2 : 0) : 4,
+ height = modeAppbarHeight[mode],
+ elevation = elevated ? 2 : 0,
backgroundColor: customBackground,
- zIndex = isV3 && elevated ? 1 : 0,
+ zIndex = elevated ? 1 : 0,
...restStyle
} = (flattenedStyle || {}) as Exclude & {
height?: number;
@@ -150,10 +148,8 @@ const AppbarHeader = ({
testID={testID}
style={[{ height, backgroundColor }, styles.appbar, restStyle]}
dark={dark}
- {...(isV3 && {
- mode,
- })}
{...rest}
+ mode={mode}
theme={theme}
/>
diff --git a/src/components/Appbar/utils.ts b/src/components/Appbar/utils.ts
index a6c68af2a5..893326dead 100644
--- a/src/components/Appbar/utils.ts
+++ b/src/components/Appbar/utils.ts
@@ -2,9 +2,8 @@ import React from 'react';
import type { ColorValue, StyleProp, ViewStyle } from 'react-native';
import { StyleSheet, Animated } from 'react-native';
-import overlay from '../../styles/overlay';
-import { black, white } from '../../styles/themes/v2/colors';
-import type { InternalTheme, ThemeProp } from '../../types';
+import { white } from '../../styles/themes/v2/colors';
+import type { InternalTheme, MD3Theme, ThemeProp } from '../../types';
export type AppbarModes = 'small' | 'medium' | 'large' | 'center-aligned';
@@ -24,26 +23,17 @@ const borderStyleProperties = [
export const getAppbarBackgroundColor = (
theme: InternalTheme,
- elevation: number,
+ _elevation: number,
customBackground?: ColorValue,
elevated?: boolean
) => {
- const { isV3, dark: isDarkTheme, mode, colors } = theme;
- const isAdaptiveMode = mode === 'adaptive';
+ const { colors } = theme as MD3Theme;
if (customBackground) {
return customBackground;
}
- if (!isV3) {
- if (isDarkTheme && isAdaptiveMode) {
- return overlay(elevation, colors?.surface);
- }
-
- return colors.primary;
- }
-
if (elevated) {
- return theme.colors.elevation.level2;
+ return colors.surfaceContainer;
}
return colors.surface;
@@ -52,7 +42,6 @@ export const getAppbarBackgroundColor = (
export const getAppbarColor = ({
color,
isDark,
- isV3,
}: BaseProps & { color: string }) => {
if (typeof color !== 'undefined') {
return color;
@@ -62,11 +51,7 @@ export const getAppbarColor = ({
return white;
}
- if (isV3) {
- return undefined;
- }
-
- return black;
+ return undefined;
};
export const getAppbarBorders = (
@@ -89,13 +74,11 @@ export const getAppbarBorders = (
type BaseProps = {
isDark: boolean;
- isV3: boolean;
};
type RenderAppbarContentProps = BaseProps & {
children: React.ReactNode;
shouldCenterContent?: boolean;
- isV3: boolean;
renderOnly?: (string | boolean)[];
renderExcept?: string[];
mode?: AppbarModes;
@@ -133,7 +116,6 @@ export const renderAppbarContent = ({
children,
isDark,
shouldCenterContent = false,
- isV3,
renderOnly,
renderExcept,
mode = 'small',
@@ -172,16 +154,14 @@ export const renderAppbarContent = ({
theme?: ThemeProp;
} = {
theme,
- color: getAppbarColor({ color: child.props.color, isDark, isV3 }),
+ color: getAppbarColor({ color: child.props.color, isDark }),
};
// @ts-expect-error: TypeScript complains about the type of type but it doesn't matter
if (child.type.displayName === 'Appbar.Content') {
props.mode = mode;
props.style = [
- isV3
- ? i === 0 && !shouldCenterContent && styles.v3Spacing
- : i !== 0 && styles.v2Spacing,
+ i === 0 && !shouldCenterContent && styles.v3Spacing,
shouldCenterContent && styles.centerAlignedContent,
child.props.style,
];
@@ -195,9 +175,6 @@ const styles = StyleSheet.create({
centerAlignedContent: {
alignItems: 'center',
},
- v2Spacing: {
- marginLeft: 8,
- },
v3Spacing: {
marginLeft: 12,
},
diff --git a/src/components/Badge.tsx b/src/components/Badge.tsx
index 54c70770f2..d8bf38015b 100644
--- a/src/components/Badge.tsx
+++ b/src/components/Badge.tsx
@@ -8,9 +8,7 @@ import {
} from 'react-native';
import { useInternalTheme } from '../core/theming';
-import { black, white } from '../styles/themes/v2/colors';
import type { ThemeProp } from '../types';
-import getContrastingColor from '../utils/getContrastingColor';
const defaultSize = 20;
@@ -85,20 +83,14 @@ const Badge = ({
}).start();
}, [visible, opacity, scale]);
- const {
- backgroundColor = theme.isV3
- ? theme.colors.error
- : theme.colors?.notification,
- ...restStyle
- } = (StyleSheet.flatten(style) || {}) as TextStyle;
+ const { backgroundColor = theme.colors.error, ...restStyle } =
+ (StyleSheet.flatten(style) || {}) as TextStyle;
- const textColor = theme.isV3
- ? theme.colors.onError
- : getContrastingColor(backgroundColor, white, black);
+ const textColor = theme.colors.onError;
const borderRadius = size / 2;
- const paddingHorizontal = theme.isV3 ? 3 : 4;
+ const paddingHorizontal = 3;
return (
{
const theme = useInternalTheme(themeOverrides);
+ const { colors } = theme as MD3Theme;
const { current: position } = React.useRef(
new Animated.Value(visible ? 1 : 0)
);
@@ -192,10 +193,10 @@ const Banner = ({
return (
@@ -222,12 +223,11 @@ const Banner = ({
) : null}
@@ -292,9 +292,6 @@ const styles = StyleSheet.create({
button: {
margin: 4,
},
- elevation: {
- elevation: 1,
- },
transparent: {
opacity: 0,
},
diff --git a/src/components/BottomNavigation/BottomNavigation.tsx b/src/components/BottomNavigation/BottomNavigation.tsx
index c4e9b71a60..da764929ee 100644
--- a/src/components/BottomNavigation/BottomNavigation.tsx
+++ b/src/components/BottomNavigation/BottomNavigation.tsx
@@ -353,9 +353,8 @@ const BottomNavigation = ({
}: Props) => {
const theme = useInternalTheme(themeOverrides);
const { scale } = theme.animation;
- const compact = compactProp ?? !theme.isV3;
- let shifting =
- shiftingProp ?? (theme.isV3 ? false : navigationState.routes.length > 3);
+ const compact = compactProp ?? false;
+ let shifting = shiftingProp ?? false;
if (shifting && navigationState.routes.length < 2) {
shifting = false;
@@ -404,7 +403,7 @@ const BottomNavigation = ({
...navigationState.routes.map((_, i) =>
Animated.timing(tabsPositionAnims[i], {
toValue: i === index ? 0 : i >= index ? 1 : -1,
- duration: theme.isV3 || shifting ? 150 * scale : 0,
+ duration: 150 * scale,
useNativeDriver: true,
easing: sceneAnimationEasing,
})
@@ -424,13 +423,11 @@ const BottomNavigation = ({
});
},
[
- shifting,
navigationState.routes,
offsetsAnims,
scale,
tabsPositionAnims,
sceneAnimationEasing,
- theme,
]
);
diff --git a/src/components/BottomNavigation/BottomNavigationBar.tsx b/src/components/BottomNavigation/BottomNavigationBar.tsx
index 05264c610a..066f42a201 100644
--- a/src/components/BottomNavigation/BottomNavigationBar.tsx
+++ b/src/components/BottomNavigation/BottomNavigationBar.tsx
@@ -11,7 +11,6 @@ import {
ViewStyle,
} from 'react-native';
-import color from 'color';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import {
@@ -20,9 +19,7 @@ import {
getLabelColor,
} from './utils';
import { useInternalTheme } from '../../core/theming';
-import overlay from '../../styles/overlay';
-import { black, white } from '../../styles/themes/v2/colors';
-import type { ThemeProp } from '../../types';
+import type { MD3Theme, ThemeProp } from '../../types';
import useAnimatedValue from '../../utils/useAnimatedValue';
import useAnimatedValueArray from '../../utils/useAnimatedValueArray';
import useIsKeyboardShown from '../../utils/useIsKeyboardShown';
@@ -212,7 +209,6 @@ export type Props = {
testID?: string;
};
-const MIN_RIPPLE_SCALE = 0.001; // Minimum scale is not 0 due to bug with animation
const MIN_TAB_WIDTH = 96;
const MAX_TAB_WIDTH = 168;
const BAR_HEIGHT = 56;
@@ -321,7 +317,7 @@ const BottomNavigationBar = ({
),
getLabelText = ({ route }: { route: Route }) => route.title,
getBadge = ({ route }: { route: Route }) => route.badge,
- getColor = ({ route }: { route: Route }) => route.color,
+ getColor: _getColor = ({ route }: { route: Route }) => route.color,
getAccessibilityLabel = ({ route }: { route: Route }) =>
route.accessibilityLabel,
getTestID = ({ route }: { route: Route }) => route.testID,
@@ -342,11 +338,11 @@ const BottomNavigationBar = ({
theme: themeOverrides,
}: Props) => {
const theme = useInternalTheme(themeOverrides);
+ const { colors } = theme as MD3Theme;
const { bottom, left, right } = useSafeAreaInsets();
const { scale } = theme.animation;
- const compact = compactProp ?? !theme.isV3;
- let shifting =
- shiftingProp ?? (theme.isV3 ? false : navigationState.routes.length > 3);
+ const compact = compactProp ?? false;
+ let shifting = shiftingProp ?? false;
if (shifting && navigationState.routes.length < 2) {
shifting = false;
@@ -371,18 +367,7 @@ const BottomNavigationBar = ({
);
/**
- * Index of the currently active tab. Used for setting the background color.
- * We don't use the color as an animated value directly, because `setValue` seems to be buggy with colors?.
- */
- const indexAnim = useAnimatedValue(navigationState.index);
-
- /**
- * Animation for the background color ripple, used to determine it's scale and opacity.
- */
- const rippleAnim = useAnimatedValue(MIN_RIPPLE_SCALE);
-
- /**
- * Layout of the navigation bar. The width is used to determine the size and position of the ripple.
+ * Layout of the navigation bar.
*/
const [layout, onLayout] = useLayout();
@@ -412,42 +397,21 @@ const BottomNavigationBar = ({
const animateToIndex = React.useCallback(
(index: number) => {
- // Reset the ripple to avoid glitch if it's currently animating
- rippleAnim.setValue(MIN_RIPPLE_SCALE);
-
- Animated.parallel([
- Animated.timing(rippleAnim, {
- toValue: 1,
- duration: theme.isV3 || shifting ? 400 * scale : 0,
- useNativeDriver: true,
- }),
- ...navigationState.routes.map((_, i) =>
+ Animated.parallel(
+ navigationState.routes.map((_, i) =>
Animated.timing(tabsAnims[i], {
toValue: i === index ? 1 : 0,
- duration: theme.isV3 || shifting ? 150 * scale : 0,
+ duration: 150 * scale,
useNativeDriver: true,
easing: animationEasing,
})
- ),
- ]).start(() => {
+ )
+ ).start(() => {
// Workaround a bug in native animations where this is reset after first animation
tabsAnims.map((tab, i) => tab.setValue(i === index ? 1 : 0));
-
- // Update the index to change bar's background color and then hide the ripple
- indexAnim.setValue(index);
- rippleAnim.setValue(MIN_RIPPLE_SCALE);
});
},
- [
- rippleAnim,
- theme.isV3,
- shifting,
- scale,
- navigationState.routes,
- tabsAnims,
- animationEasing,
- indexAnim,
- ]
+ [scale, navigationState.routes, tabsAnims, animationEasing]
);
React.useEffect(() => {
@@ -479,62 +443,28 @@ const BottomNavigationBar = ({
};
const { routes } = navigationState;
- const { colors, dark: isDarkTheme, mode, isV3 } = theme;
- const { backgroundColor: customBackground, elevation = 4 } =
- (StyleSheet.flatten(style) || {}) as {
- elevation?: number;
- backgroundColor?: ColorValue;
- };
+ const { backgroundColor: customBackground } = (StyleSheet.flatten(style) ||
+ {}) as {
+ elevation?: number;
+ backgroundColor?: ColorValue;
+ };
- const approxBackgroundColor = customBackground
- ? customBackground
- : isDarkTheme && mode === 'adaptive'
- ? overlay(elevation, colors?.surface)
- : colors?.primary;
-
- const v2BackgroundColorInterpolation = shifting
- ? indexAnim.interpolate({
- inputRange: routes.map((_, i) => i),
- // FIXME: does outputRange support ColorValue or just strings?
- // @ts-expect-error
- outputRange: routes.map(
- (route) => getColor({ route }) || approxBackgroundColor
- ),
- })
- : approxBackgroundColor;
-
- const backgroundColor = isV3
- ? customBackground || theme.colors.elevation.level2
- : shifting
- ? v2BackgroundColorInterpolation
- : approxBackgroundColor;
-
- const isDark =
- typeof approxBackgroundColor === 'string'
- ? !color(approxBackgroundColor).isLight()
- : true;
-
- const textColor = isDark ? white : black;
+ const backgroundColor = customBackground || colors.surfaceContainer;
const activeTintColor = getActiveTintColor({
activeColor,
- defaultColor: textColor,
theme,
});
const inactiveTintColor = getInactiveTintColor({
inactiveColor,
- defaultColor: textColor,
theme,
});
- const touchColor = color(activeTintColor).alpha(0.12).rgb().string();
const maxTabWidth = routes.length > 3 ? MIN_TAB_WIDTH : MAX_TAB_WIDTH;
const maxTabBarWidth = maxTabWidth * routes.length;
- const rippleSize = layout.width / 4;
-
const insets = {
left: safeAreaInsets?.left ?? left,
right: safeAreaInsets?.right ?? right,
@@ -543,10 +473,9 @@ const BottomNavigationBar = ({
return (
({
accessibilityRole={'tablist'}
testID={`${testID}-content-wrapper`}
>
- {shifting && !isV3 ? (
-
- ) : null}
{routes.map((route, index) => {
const focused = navigationState.index === index;
const active = tabsAnims[index];
- // Scale the label up
- const scale =
- labeled && shifting
- ? active.interpolate({
- inputRange: [0, 1],
- outputRange: [0.5, 1],
- })
- : 1;
-
// Move down the icon to account for no-label in shifting and smaller label in non-shifting.
const translateY = labeled
? shifting
@@ -684,7 +567,6 @@ const BottomNavigationBar = ({
tintColor: activeTintColor,
hasColor: Boolean(activeColor),
focused,
- defaultColor: textColor,
theme,
});
@@ -692,55 +574,53 @@ const BottomNavigationBar = ({
tintColor: inactiveTintColor,
hasColor: Boolean(inactiveColor),
focused,
- defaultColor: textColor,
theme,
});
const badgeStyle = {
- top: !isV3 ? -2 : typeof badge === 'boolean' ? 4 : 2,
+ top: typeof badge === 'boolean' ? 4 : 2,
right:
- (badge != null && typeof badge !== 'boolean'
+ badge != null && typeof badge !== 'boolean'
? String(badge).length * -2
- : 0) - (!isV3 ? 2 : 0),
+ : 0,
};
- const isLegacyOrV3Shifting = !isV3 || (isV3 && shifting && labeled);
+ const isLegacyOrV3Shifting = shifting && labeled;
- const font = isV3 ? theme.fonts.labelMedium : {};
+ const font = (theme as MD3Theme).fonts.labelMedium;
return renderTouchable({
key: route.key,
route,
borderless: true,
centered: true,
- rippleColor: isV3 ? 'transparent' : touchColor,
+ rippleColor: 'transparent',
onPress: () => onTabPress(eventForIndex(index)),
onLongPress: () => onTabLongPress?.(eventForIndex(index)),
testID: getTestID({ route }),
accessibilityLabel: getAccessibilityLabel({ route }),
accessibilityRole: Platform.OS === 'ios' ? 'button' : 'tab',
accessibilityState: { selected: focused },
- style: [styles.item, isV3 && styles.v3Item],
+ style: [styles.item, styles.v3Item],
children: (
- {isV3 && focused && (
+ {focused && (
({
scaleX: outlineScale,
},
],
- backgroundColor: theme.colors.secondaryContainer,
+ backgroundColor: colors.secondaryContainer,
},
activeIndicatorStyle,
]}
@@ -759,7 +639,7 @@ const BottomNavigationBar = ({
({
({
) : (
({
{typeof badge === 'boolean' ? (
-
+
) : (
{badge}
@@ -821,12 +701,7 @@ const BottomNavigationBar = ({
{labeled ? (
-
+
({
)}
- ) : (
- !isV3 &&
- )}
+ ) : null}
),
});
@@ -939,9 +812,6 @@ const styles = StyleSheet.create({
v3Item: {
paddingVertical: 0,
},
- ripple: {
- position: 'absolute',
- },
iconContainer: {
height: 24,
width: 24,
@@ -1002,7 +872,4 @@ const styles = StyleSheet.create({
borderRadius: OUTLINE_WIDTH / 4,
alignSelf: 'center',
},
- elevation: {
- elevation: 4,
- },
});
diff --git a/src/components/BottomNavigation/utils.ts b/src/components/BottomNavigation/utils.ts
index 93a4d95091..20208d4b7d 100644
--- a/src/components/BottomNavigation/utils.ts
+++ b/src/components/BottomNavigation/utils.ts
@@ -1,70 +1,51 @@
-import color from 'color';
-import type { InternalTheme } from 'src/types';
-
-import type { black, white } from '../../styles/themes/v2/colors';
-
-type BaseProps = {
- defaultColor: typeof black | typeof white;
- theme: InternalTheme;
-};
+import type { InternalTheme, MD3Theme } from '../../types';
export const getActiveTintColor = ({
activeColor,
- defaultColor,
theme,
-}: BaseProps & {
+}: {
activeColor: string | undefined;
+ theme: InternalTheme;
}) => {
if (typeof activeColor === 'string') {
return activeColor;
}
- if (theme.isV3) {
- return theme.colors.onSecondaryContainer;
- }
-
- return defaultColor;
+ return (theme as MD3Theme).colors.onSecondaryContainer;
};
export const getInactiveTintColor = ({
inactiveColor,
- defaultColor,
theme,
-}: BaseProps & {
+}: {
inactiveColor: string | undefined;
+ theme: InternalTheme;
}) => {
if (typeof inactiveColor === 'string') {
return inactiveColor;
}
- if (theme.isV3) {
- return theme.colors.onSurfaceVariant;
- }
-
- return color(defaultColor).alpha(0.5).rgb().string();
+ return (theme as MD3Theme).colors.onSurfaceVariant;
};
export const getLabelColor = ({
tintColor,
hasColor,
focused,
- defaultColor,
theme,
-}: BaseProps & {
+}: {
tintColor: string;
hasColor: boolean;
focused: boolean;
+ theme: InternalTheme;
}) => {
+ const { colors } = theme as MD3Theme;
if (hasColor) {
return tintColor;
}
- if (theme.isV3) {
- if (focused) {
- return theme.colors.onSurface;
- }
- return theme.colors.onSurfaceVariant;
+ if (focused) {
+ return colors.onSurface;
}
-
- return defaultColor;
+ return colors.onSurfaceVariant;
};
diff --git a/src/components/Button/Button.tsx b/src/components/Button/Button.tsx
index 2e4d2cf519..9f0b3a98dc 100644
--- a/src/components/Button/Button.tsx
+++ b/src/components/Button/Button.tsx
@@ -2,7 +2,6 @@ import * as React from 'react';
import {
AccessibilityRole,
Animated,
- ColorValue,
GestureResponderEvent,
Platform,
PressableAndroidRippleConfig,
@@ -13,15 +12,13 @@ import {
ViewStyle,
} from 'react-native';
-import color from 'color';
-
import {
ButtonMode,
getButtonColors,
getButtonTouchableRippleStyle,
} from './utils';
import { useInternalTheme } from '../../core/theming';
-import type { $Omit, ThemeProp } from '../../types';
+import type { $Omit, MD3Theme, ThemeProp } from '../../types';
import { forwardRef } from '../../utils/forwardRef';
import hasTouchHandler from '../../utils/hasTouchHandler';
import { splitStyles } from '../../utils/splitStyles';
@@ -66,10 +63,6 @@ export type Props = $Omit, 'mode'> & {
* Custom button's text color.
*/
textColor?: string;
- /**
- * Color of the ripple effect.
- */
- rippleColor?: ColorValue;
/**
* Whether to show a loading indicator.
*/
@@ -186,7 +179,6 @@ const Button = (
icon,
buttonColor: customButtonColor,
textColor: customTextColor,
- rippleColor: customRippleColor,
children,
accessibilityLabel,
accessibilityHint,
@@ -218,8 +210,8 @@ const Button = (
},
[mode]
);
- const { roundness, isV3, animation } = theme;
- const uppercase = uppercaseProp ?? !theme.isV3;
+ const { roundness, animation } = theme;
+ const uppercase = uppercaseProp ?? false;
const isWeb = Platform.OS === 'web';
const hasPassedTouchHandler = hasTouchHandler({
@@ -229,10 +221,9 @@ const Button = (
onLongPress,
});
- const isElevationEntitled =
- !disabled && (isV3 ? isMode('elevated') : isMode('contained'));
- const initialElevation = isV3 ? 1 : 2;
- const activeElevation = isV3 ? 2 : 8;
+ const isElevationEntitled = !disabled && isMode('elevated');
+ const initialElevation = 1;
+ const activeElevation = 2;
const { current: elevation } = React.useRef(
new Animated.Value(isElevationEntitled ? initialElevation : 0)
@@ -250,7 +241,7 @@ const Button = (
const handlePressIn = (e: GestureResponderEvent) => {
onPressIn?.(e);
- if (isV3 ? isMode('elevated') : isMode('contained')) {
+ if (isMode('elevated')) {
const { scale } = animation;
Animated.timing(elevation, {
toValue: activeElevation,
@@ -263,7 +254,7 @@ const Button = (
const handlePressOut = (e: GestureResponderEvent) => {
onPressOut?.(e);
- if (isV3 ? isMode('elevated') : isMode('contained')) {
+ if (isMode('elevated')) {
const { scale } = animation;
Animated.timing(elevation, {
toValue: initialElevation,
@@ -280,21 +271,24 @@ const Button = (
(style) => style.startsWith('border') && style.endsWith('Radius')
);
- const borderRadius = (isV3 ? 5 : 1) * roundness;
- const iconSize = isV3 ? 18 : 16;
+ const borderRadius = 5 * roundness;
+ const iconSize = 18;
- const { backgroundColor, borderColor, textColor, borderWidth } =
- getButtonColors({
- customButtonColor,
- customTextColor,
- theme,
- mode,
- disabled,
- dark,
- });
-
- const rippleColor =
- customRippleColor || color(textColor).alpha(0.12).rgb().string();
+ const {
+ backgroundColor,
+ borderColor,
+ textColor,
+ textOpacity,
+ borderWidth,
+ backgroundOpacity,
+ } = getButtonColors({
+ customButtonColor,
+ customTextColor,
+ theme,
+ mode,
+ disabled,
+ dark,
+ });
const touchableStyle = {
...borderRadiusStyles,
@@ -302,7 +296,7 @@ const Button = (
};
const buttonStyle = {
- backgroundColor,
+ backgroundColor: backgroundOpacity < 1 ? 'transparent' : backgroundColor,
borderColor,
borderWidth,
...touchableStyle,
@@ -311,7 +305,7 @@ const Button = (
const { color: customLabelColor, fontSize: customLabelSize } =
StyleSheet.flatten(labelStyle) || {};
- const font = isV3 ? theme.fonts.labelLarge : theme.fonts.medium;
+ const font = (theme as MD3Theme).fonts.labelLarge;
const textStyle = {
color: textColor,
@@ -322,16 +316,14 @@ const Button = (
StyleSheet.flatten(contentStyle)?.flexDirection === 'row-reverse'
? [
styles.iconReverse,
- isV3 && styles[`md3IconReverse${compact ? 'Compact' : ''}`],
- isV3 &&
- isMode('text') &&
+ styles[`md3IconReverse${compact ? 'Compact' : ''}`],
+ isMode('text') &&
styles[`md3IconReverseTextMode${compact ? 'Compact' : ''}`],
]
: [
styles.icon,
- isV3 && styles[`md3Icon${compact ? 'Compact' : ''}`],
- isV3 &&
- isMode('text') &&
+ styles[`md3Icon${compact ? 'Compact' : ''}`],
+ isMode('text') &&
styles[`md3IconTextMode${compact ? 'Compact' : ''}`],
];
@@ -346,12 +338,24 @@ const Button = (
compact && styles.compact,
buttonStyle,
style,
- !isV3 && !disabled && { elevation },
] as Animated.WithAnimatedValue>
}
- {...(isV3 && { elevation: elevation })}
+ elevation={elevation}
container
>
+ {backgroundOpacity < 1 && (
+
+ )}
-
+
{icon && loading !== true ? (
{
+ const { colors } = theme as MD3Theme;
if (customButtonColor && !disabled) {
return customButtonColor;
}
- if (theme.isV3) {
- if (disabled) {
- if (isMode('outlined') || isMode('text')) {
- return 'transparent';
- }
-
- return theme.colors.surfaceDisabled;
- }
-
- if (isMode('elevated')) {
- return theme.colors.elevation.level1;
- }
-
- if (isMode('contained')) {
- return theme.colors.primary;
+ if (disabled) {
+ if (isMode('outlined') || isMode('text')) {
+ return 'transparent';
}
+ return colors.onSurface;
+ }
- if (isMode('contained-tonal')) {
- return theme.colors.secondaryContainer;
- }
+ if (isMode('elevated')) {
+ return colors.surfaceContainerLow;
}
if (isMode('contained')) {
- if (disabled) {
- return color(theme.dark ? white : black)
- .alpha(0.12)
- .rgb()
- .string();
- }
+ return colors.primary;
+ }
- return theme.colors.primary;
+ if (isMode('contained-tonal')) {
+ return colors.secondaryContainer;
}
return 'transparent';
@@ -101,85 +85,51 @@ const getButtonTextColor = ({
backgroundColor: string;
dark?: boolean;
}) => {
+ const { colors } = theme as MD3Theme;
if (customTextColor && !disabled) {
return customTextColor;
}
- if (theme.isV3) {
- if (disabled) {
- return theme.colors.onSurfaceDisabled;
- }
-
- if (typeof dark === 'boolean') {
- if (
- isMode('contained') ||
- isMode('contained-tonal') ||
- isMode('elevated')
- ) {
- return isDark({ dark, backgroundColor }) ? white : black;
- }
- }
-
- if (isMode('outlined') || isMode('text') || isMode('elevated')) {
- return theme.colors.primary;
- }
-
- if (isMode('contained')) {
- return theme.colors.onPrimary;
- }
+ if (disabled) {
+ return theme.colors.onSurface;
+ }
- if (isMode('contained-tonal')) {
- return theme.colors.onSecondaryContainer;
+ if (typeof dark === 'boolean') {
+ if (
+ isMode('contained') ||
+ isMode('contained-tonal') ||
+ isMode('elevated')
+ ) {
+ return isDark({ dark, backgroundColor }) ? white : black;
}
}
- if (disabled) {
- return color(theme.dark ? white : black)
- .alpha(0.32)
- .rgb()
- .string();
+ if (isMode('outlined') || isMode('text') || isMode('elevated')) {
+ return colors.primary;
}
if (isMode('contained')) {
- return isDark({ dark, backgroundColor }) ? white : black;
+ return colors.onPrimary;
}
- return theme.colors.primary;
-};
-
-const getButtonBorderColor = ({ isMode, disabled, theme }: BaseProps) => {
- if (theme.isV3) {
- if (disabled && isMode('outlined')) {
- return theme.colors.surfaceDisabled;
- }
-
- if (isMode('outlined')) {
- return theme.colors.outline;
- }
+ if (isMode('contained-tonal')) {
+ return colors.onSecondaryContainer;
}
+ return colors.primary;
+};
+
+const getButtonBorderColor = ({ isMode, theme }: BaseProps) => {
if (isMode('outlined')) {
- return color(theme.dark ? white : black)
- .alpha(0.29)
- .rgb()
- .string();
+ return theme.colors.outlineVariant;
}
return 'transparent';
};
-const getButtonBorderWidth = ({
- isMode,
- theme,
-}: Omit) => {
- if (theme.isV3) {
- if (isMode('outlined')) {
- return 1;
- }
- }
-
+const getButtonBorderWidth = ({ isMode }: Omit) => {
if (isMode('outlined')) {
- return StyleSheet.hairlineWidth;
+ return 1;
}
return 0;
@@ -220,15 +170,24 @@ export const getButtonColors = ({
dark,
});
- const borderColor = getButtonBorderColor({ isMode, theme, disabled });
+ const borderColor = getButtonBorderColor({ isMode, theme });
const borderWidth = getButtonBorderWidth({ isMode, theme });
+ const textOpacity = disabled ? stateOpacity.disabled : stateOpacity.enabled;
+
+ const backgroundOpacity =
+ disabled && !isMode('outlined') && !isMode('text')
+ ? stateOpacity.pressed
+ : stateOpacity.enabled;
+
return {
backgroundColor,
borderColor,
textColor,
+ textOpacity,
borderWidth,
+ backgroundOpacity,
};
};
diff --git a/src/components/Card/Card.tsx b/src/components/Card/Card.tsx
index 848be9fa13..422101b4e8 100644
--- a/src/components/Card/Card.tsx
+++ b/src/components/Card/Card.tsx
@@ -181,7 +181,7 @@ const Card = (
const { current: elevationDarkAdaptive } = React.useRef(
new Animated.Value(cardElevation)
);
- const { animation, dark, mode, roundness, isV3 } = theme;
+ const { animation, dark, mode, roundness } = theme;
const prevDarkRef = React.useRef(dark);
React.useEffect(() => {
@@ -213,20 +213,20 @@ const Card = (
]);
const runElevationAnimation = (pressType: HandlePressType) => {
- if (isV3 && isMode('contained')) {
+ if (isMode('contained')) {
return;
}
const isPressTypeIn = pressType === 'in';
if (dark && isAdaptiveMode) {
Animated.timing(elevationDarkAdaptive, {
- toValue: isPressTypeIn ? (isV3 ? 2 : 8) : cardElevation,
+ toValue: isPressTypeIn ? 2 : cardElevation,
duration: animationDuration,
useNativeDriver: false,
}).start();
} else {
Animated.timing(elevation, {
- toValue: isPressTypeIn ? (isV3 ? 2 : 8) : cardElevation,
+ toValue: isPressTypeIn ? 2 : cardElevation,
duration: animationDuration,
useNativeDriver: false,
}).start();
@@ -267,7 +267,7 @@ const Card = (
);
const borderRadiusCombinedStyles = {
- borderRadius: (isV3 ? 3 : 1) * roundness,
+ borderRadius: 3 * roundness,
...borderRadiusStyles,
};
@@ -290,20 +290,12 @@ const Card = (
& {
* ```
*/
const CardActions = ({ theme, style, children, ...rest }: Props) => {
- const { isV3 } = useInternalTheme(theme);
+ useInternalTheme(theme);
- const justifyContent = (
- isV3 ? 'flex-end' : 'flex-start'
- ) as ViewStyle['justifyContent'];
+ const justifyContent = 'flex-end' as ViewStyle['justifyContent'];
const containerStyle = [styles.container, { justifyContent }, style];
return (
@@ -50,11 +48,10 @@ const CardActions = ({ theme, style, children, ...rest }: Props) => {
return child;
}
- const compact = !isV3 && child.props.compact !== false;
+ const compact = child.props.compact;
const mode =
- child.props.mode ??
- (isV3 ? (index === 0 ? 'outlined' : 'contained') : undefined);
- const childStyle = [isV3 && styles.button, child.props.style];
+ child.props.mode ?? (index === 0 ? 'outlined' : 'contained');
+ const childStyle = [styles.button, child.props.style];
return React.cloneElement(child, {
...child.props,
diff --git a/src/components/Card/CardTitle.tsx b/src/components/Card/CardTitle.tsx
index b3d78fc259..f24809c405 100644
--- a/src/components/Card/CardTitle.tsx
+++ b/src/components/Card/CardTitle.tsx
@@ -10,8 +10,6 @@ import {
import { useInternalTheme } from '../../core/theming';
import type { MD3TypescaleKey, ThemeProp } from '../../types';
import Text from '../Typography/Text';
-import Caption from '../Typography/v2/Caption';
-import Title from '../Typography/v2/Title';
export type Props = React.ComponentPropsWithRef & {
/**
@@ -151,9 +149,7 @@ const CardTitle = ({
style,
theme: themeOverrides,
}: Props) => {
- const theme = useInternalTheme(themeOverrides);
- const TitleComponent = theme.isV3 ? Text : Title;
- const SubtitleComponent = theme.isV3 ? Text : Caption;
+ useInternalTheme(themeOverrides);
const minHeight = subtitle || left || right ? 72 : 50;
const marginBottom = subtitle ? 0 : 2;
@@ -170,24 +166,24 @@ const CardTitle = ({
{title && (
-
{title}
-
+
)}
{subtitle && (
-
{subtitle}
-
+
)}
{right ? right({ size: 24 }) : null}
diff --git a/src/components/Card/utils.tsx b/src/components/Card/utils.tsx
index c0f10951c5..9a4ed5df7d 100644
--- a/src/components/Card/utils.tsx
+++ b/src/components/Card/utils.tsx
@@ -1,9 +1,6 @@
import type { StyleProp, ViewStyle } from 'react-native';
-import color from 'color';
-
-import { black, white } from '../../styles/themes/v2/colors';
-import type { InternalTheme } from '../../types';
+import type { InternalTheme, MD3Theme } from '../../types';
type CardMode = 'elevated' | 'outlined' | 'contained';
@@ -20,8 +17,8 @@ export type CardActionChildProps = {
export const getCardCoverStyle = ({
theme,
- index,
- total,
+ index: _index,
+ total: _total,
borderRadiusStyles,
}: {
theme: InternalTheme;
@@ -29,7 +26,7 @@ export const getCardCoverStyle = ({
index?: number;
total?: number;
}) => {
- const { isV3, roundness } = theme;
+ const { roundness } = theme;
if (Object.keys(borderRadiusStyles).length > 0) {
return {
@@ -38,43 +35,13 @@ export const getCardCoverStyle = ({
};
}
- if (isV3) {
- return {
- borderRadius: 3 * roundness,
- };
- }
-
- if (index === 0) {
- if (total === 1) {
- return {
- borderRadius: roundness,
- };
- }
-
- return {
- borderTopLeftRadius: roundness,
- borderTopRightRadius: roundness,
- };
- }
-
- if (typeof total === 'number' && index === total - 1) {
- return {
- borderBottomLeftRadius: roundness,
- };
- }
-
- return undefined;
+ return {
+ borderRadius: 3 * roundness,
+ };
};
const getBorderColor = ({ theme }: { theme: InternalTheme }) => {
- if (theme.isV3) {
- return theme.colors.outline;
- }
-
- if (theme.dark) {
- return color(white).alpha(0.12).rgb().string();
- }
- return color(black).alpha(0.12).rgb().string();
+ return (theme as MD3Theme).colors.outline;
};
const getBackgroundColor = ({
@@ -84,13 +51,12 @@ const getBackgroundColor = ({
theme: InternalTheme;
isMode: (mode: CardMode) => boolean;
}) => {
- if (theme.isV3) {
- if (isMode('contained')) {
- return theme.colors.surfaceVariant;
- }
- if (isMode('outlined')) {
- return theme.colors.surface;
- }
+ const { colors } = theme as MD3Theme;
+ if (isMode('contained')) {
+ return colors.surfaceVariant;
+ }
+ if (isMode('outlined')) {
+ return colors.surface;
}
return undefined;
};
diff --git a/src/components/Checkbox/CheckboxAndroid.tsx b/src/components/Checkbox/CheckboxAndroid.tsx
index 642602b0fa..a4e6fb0c23 100644
--- a/src/components/Checkbox/CheckboxAndroid.tsx
+++ b/src/components/Checkbox/CheckboxAndroid.tsx
@@ -99,7 +99,7 @@ const CheckboxAndroid = ({
const checked = status === 'checked';
const indeterminate = status === 'indeterminate';
- const { rippleColor, selectionControlColor } =
+ const { selectionControlColor, selectionControlOpacity } =
getAndroidSelectionControlColor({
theme,
disabled,
@@ -123,7 +123,6 @@ const CheckboxAndroid = ({
-
+
;
}
- const textColor = theme.isV3 ? theme.colors.onSurface : theme.colors.text;
- const disabledTextColor = theme.isV3
- ? theme.colors.onSurfaceDisabled
- : theme.colors.disabled;
+ const textColor = theme.colors.onSurface;
const textAlign = isLeading ? 'right' : 'left';
const computedStyle = {
- color: disabled ? disabledTextColor : textColor,
+ color: textColor,
+ opacity: disabled
+ ? tokens.md.ref.stateOpacity.disabled
+ : tokens.md.ref.stateOpacity.enabled,
textAlign,
} as TextStyle;
@@ -189,7 +184,6 @@ const CheckboxItem = ({
onLongPress={onLongPress}
testID={testID}
disabled={disabled}
- rippleColor={rippleColor}
theme={theme}
background={background}
hitSlop={hitSlop}
@@ -204,12 +198,7 @@ const CheckboxItem = ({
variant={labelVariant}
testID={`${testID}-text`}
maxFontSizeMultiplier={labelMaxFontSizeMultiplier}
- style={[
- styles.label,
- !theme.isV3 && styles.font,
- computedStyle,
- labelStyle,
- ]}
+ style={[styles.label, computedStyle, labelStyle]}
>
{label}
@@ -238,7 +227,4 @@ const styles = StyleSheet.create({
flexShrink: 1,
flexGrow: 1,
},
- font: {
- fontSize: 16,
- },
});
diff --git a/src/components/Checkbox/utils.ts b/src/components/Checkbox/utils.ts
index 81677d46b2..7a9e8add67 100644
--- a/src/components/Checkbox/utils.ts
+++ b/src/components/Checkbox/utils.ts
@@ -1,7 +1,8 @@
-import color from 'color';
-
+import { tokens } from '../../styles/themes/v3/tokens';
import type { InternalTheme } from '../../types';
+const { stateOpacity } = tokens.md.ref;
+
const getAndroidCheckedColor = ({
theme,
customColor,
@@ -13,11 +14,7 @@ const getAndroidCheckedColor = ({
return customColor;
}
- if (theme.isV3) {
- return theme.colors.primary;
- }
-
- return theme.colors.accent;
+ return theme.colors.primary;
};
const getAndroidUncheckedColor = ({
@@ -31,34 +28,7 @@ const getAndroidUncheckedColor = ({
return customUncheckedColor;
}
- if (theme.isV3) {
- return theme.colors.onSurfaceVariant;
- }
-
- if (theme.dark) {
- return color(theme.colors.text).alpha(0.7).rgb().string();
- }
-
- return color(theme.colors.text).alpha(0.54).rgb().string();
-};
-
-const getAndroidRippleColor = ({
- theme,
- checkedColor,
- disabled,
-}: {
- theme: InternalTheme;
- checkedColor: string;
- disabled?: boolean;
-}) => {
- if (disabled) {
- if (theme.isV3) {
- return color(theme.colors.onSurface).alpha(0.16).rgb().string();
- }
- return color(theme.colors.text).alpha(0.16).rgb().string();
- }
-
- return color(checkedColor).fade(0.32).rgb().string();
+ return theme.colors.onSurfaceVariant;
};
const getAndroidControlColor = ({
@@ -75,10 +45,7 @@ const getAndroidControlColor = ({
disabled?: boolean;
}) => {
if (disabled) {
- if (theme.isV3) {
- return theme.colors.onSurfaceDisabled;
- }
- return theme.colors.disabled;
+ return theme.colors.onSurface;
}
if (checked) {
@@ -105,8 +72,11 @@ export const getAndroidSelectionControlColor = ({
theme,
customUncheckedColor,
});
+ const selectionControlOpacity = disabled
+ ? stateOpacity.disabled
+ : stateOpacity.enabled;
+
return {
- rippleColor: getAndroidRippleColor({ theme, checkedColor, disabled }),
selectionControlColor: getAndroidControlColor({
theme,
disabled,
@@ -114,6 +84,7 @@ export const getAndroidSelectionControlColor = ({
checkedColor,
uncheckedColor,
}),
+ selectionControlOpacity,
};
};
@@ -127,39 +98,14 @@ const getIOSCheckedColor = ({
disabled?: boolean;
}) => {
if (disabled) {
- if (theme.isV3) {
- return theme.colors.onSurfaceDisabled;
- }
- return theme.colors.disabled;
+ return theme.colors.primary;
}
if (customColor) {
return customColor;
}
- if (theme.isV3) {
- return theme.colors.primary;
- }
-
- return theme.colors.accent;
-};
-
-const getIOSRippleColor = ({
- theme,
- checkedColor,
- disabled,
-}: {
- theme: InternalTheme;
- checkedColor: string;
- disabled?: boolean;
-}) => {
- if (disabled) {
- if (theme.isV3) {
- return color(theme.colors.onSurface).alpha(0.16).rgb().string();
- }
- return color(theme.colors.text).alpha(0.16).rgb().string();
- }
- return color(checkedColor).fade(0.32).rgb().string();
+ return theme.colors.primary;
};
export const getSelectionControlIOSColor = ({
@@ -172,12 +118,12 @@ export const getSelectionControlIOSColor = ({
customColor?: string;
}) => {
const checkedColor = getIOSCheckedColor({ theme, disabled, customColor });
+ const checkedColorOpacity = disabled
+ ? stateOpacity.disabled
+ : stateOpacity.enabled;
+
return {
checkedColor,
- rippleColor: getIOSRippleColor({
- theme,
- checkedColor,
- disabled,
- }),
+ checkedColorOpacity,
};
};
diff --git a/src/components/Chip/Chip.tsx b/src/components/Chip/Chip.tsx
index 0e48e5c145..2c79e8201d 100644
--- a/src/components/Chip/Chip.tsx
+++ b/src/components/Chip/Chip.tsx
@@ -2,7 +2,6 @@ import * as React from 'react';
import {
AccessibilityState,
Animated,
- ColorValue,
GestureResponderEvent,
Platform,
PressableAndroidRippleConfig,
@@ -19,7 +18,7 @@ import useLatestCallback from 'use-latest-callback';
import { ChipAvatarProps, getChipColors } from './helpers';
import { useInternalTheme } from '../../core/theming';
import { white } from '../../styles/themes/v2/colors';
-import type { $Omit, EllipsizeProp, ThemeProp } from '../../types';
+import type { $Omit, EllipsizeProp, MD3Theme, ThemeProp } from '../../types';
import hasTouchHandler from '../../utils/hasTouchHandler';
import type { IconSource } from '../Icon';
import Icon from '../Icon';
@@ -73,10 +72,6 @@ export type Props = $Omit, 'mode'> & {
* Note: Check will not be shown if `icon` is specified. If specified, `icon` will be shown regardless of `selected`.
*/
showSelectedCheck?: boolean;
- /**
- * Color of the ripple effect.
- */
- rippleColor?: ColorValue;
/**
* Whether the chip is disabled. A disabled chip is greyed out and `onPress` is not called on touch.
*/
@@ -201,8 +196,6 @@ const Chip = ({
theme: themeOverrides,
testID = 'chip',
selectedColor,
- rippleColor: customRippleColor,
- showSelectedOverlay = false,
showSelectedCheck = true,
ellipsizeMode,
compact,
@@ -212,11 +205,11 @@ const Chip = ({
...rest
}: Props) => {
const theme = useInternalTheme(themeOverrides);
- const { isV3, roundness } = theme;
+ const { roundness } = theme;
const isWeb = Platform.OS === 'web';
const { current: elevation } = React.useRef(
- new Animated.Value(isV3 && elevated ? 1 : 0)
+ new Animated.Value(elevated ? 1 : 0)
);
const hasPassedTouchHandler = hasTouchHandler({
@@ -232,7 +225,7 @@ const Chip = ({
const { scale } = theme.animation;
onPressIn?.(e);
Animated.timing(elevation, {
- toValue: isV3 ? (elevated ? 2 : 0) : 4,
+ toValue: elevated ? 2 : 0,
duration: 200 * scale,
useNativeDriver:
isWeb || Platform.constants.reactNativeVersion.minor <= 72,
@@ -243,16 +236,16 @@ const Chip = ({
const { scale } = theme.animation;
onPressOut?.(e);
Animated.timing(elevation, {
- toValue: isV3 && elevated ? 1 : 0,
+ toValue: elevated ? 1 : 0,
duration: 150 * scale,
useNativeDriver:
isWeb || Platform.constants.reactNativeVersion.minor <= 72,
}).start();
});
- const opacity = isV3 ? 0.38 : 0.26;
- const defaultBorderRadius = roundness * (isV3 ? 2 : 4);
- const iconSize = isV3 ? 18 : 16;
+ const opacity = 0.38;
+ const defaultBorderRadius = roundness * 2;
+ const iconSize = 18;
const {
backgroundColor: customBackgroundColor,
@@ -263,17 +256,15 @@ const Chip = ({
borderColor,
textColor,
iconColor,
- rippleColor,
+ contentOpacity,
selectedBackgroundColor,
backgroundColor,
} = getChipColors({
isOutlined,
theme,
selectedColor,
- showSelectedOverlay,
customBackgroundColor,
disabled,
- customRippleColor,
});
const accessibilityState: AccessibilityState = {
@@ -281,8 +272,8 @@ const Chip = ({
disabled,
};
- const elevationStyle = isV3 || Platform.OS === 'android' ? elevation : 0;
- const multiplier = isV3 ? (compact ? 1.5 : 2) : 1;
+ const elevationStyle = elevation;
+ const multiplier = compact ? 1.5 : 2;
const labelSpacings = {
marginRight: onClose ? 0 : 8 * multiplier,
marginLeft:
@@ -291,20 +282,17 @@ const Chip = ({
: 8 * multiplier,
};
const contentSpacings = {
- paddingRight: isV3 ? (onClose ? 34 : 0) : onClose ? 32 : 4,
+ paddingRight: onClose ? 34 : 0,
};
const labelTextStyle = {
color: textColor,
- ...(isV3 ? theme.fonts.labelLarge : theme.fonts.regular),
+ ...(theme as MD3Theme).fonts.labelLarge,
};
return (
{avatar && !icon ? (
@@ -358,12 +350,12 @@ const Chip = ({
-
+
{closeIcon ? (
) : (
theme as MD3Theme;
+
+const { stateOpacity } = tokens.md.ref;
export type ChipAvatarProps = {
style?: StyleProp;
@@ -20,40 +24,24 @@ const getBorderColor = ({
isOutlined,
disabled,
selectedColor,
- backgroundColor,
}: BaseProps & { backgroundColor: string; selectedColor?: string }) => {
const isSelectedColor = selectedColor !== undefined;
+ const { colors } = md3(theme);
- if (theme.isV3) {
- if (!isOutlined) {
- // If the Chip mode is "flat", set border color to transparent
- return 'transparent';
- }
-
- if (disabled) {
- return color(theme.colors.onSurfaceVariant).alpha(0.12).rgb().string();
- }
-
- if (isSelectedColor) {
- return color(selectedColor).alpha(0.29).rgb().string();
- }
-
- return theme.colors.outline;
+ if (!isOutlined) {
+ // If the Chip mode is "flat", set border color to transparent
+ return 'transparent';
}
- if (isOutlined) {
- if (isSelectedColor) {
- return color(selectedColor).alpha(0.29).rgb().string();
- }
-
- if (theme.dark) {
- return color(white).alpha(0.29).rgb().string();
- }
+ if (disabled) {
+ return colors.surfaceContainer;
+ }
- return color(black).alpha(0.29).rgb().string();
+ if (isSelectedColor) {
+ return color(selectedColor).alpha(0.29).rgb().string();
}
- return backgroundColor;
+ return colors.outlineVariant;
};
const getTextColor = ({
@@ -65,54 +53,32 @@ const getTextColor = ({
selectedColor?: string;
}) => {
const isSelectedColor = selectedColor !== undefined;
- if (theme.isV3) {
- if (disabled) {
- return theme.colors.onSurfaceDisabled;
- }
-
- if (isSelectedColor) {
- return selectedColor;
- }
-
- if (isOutlined) {
- return theme.colors.onSurfaceVariant;
- }
-
- return theme.colors.onSecondaryContainer;
- }
-
+ const { colors } = md3(theme);
if (disabled) {
- return theme.colors.disabled;
+ return colors.onSurface;
}
if (isSelectedColor) {
- return color(selectedColor).alpha(0.87).rgb().string();
+ return selectedColor;
+ }
+
+ if (isOutlined) {
+ return colors.onSurfaceVariant;
}
- return color(theme.colors.text).alpha(0.87).rgb().string();
+ return colors.onSecondaryContainer;
};
const getDefaultBackgroundColor = ({
theme,
isOutlined,
}: Omit) => {
- if (theme.isV3) {
- if (isOutlined) {
- return theme.colors.surface;
- }
-
- return theme.colors.secondaryContainer;
- }
-
+ const { colors } = md3(theme);
if (isOutlined) {
- return theme.colors?.surface;
- }
-
- if (theme.dark) {
- return '#383838';
+ return colors.surface;
}
- return '#ebebeb';
+ return colors.secondaryContainer;
};
const getBackgroundColor = ({
@@ -123,17 +89,16 @@ const getBackgroundColor = ({
}: BaseProps & {
customBackgroundColor?: ColorValue;
}) => {
+ const { colors } = md3(theme);
if (typeof customBackgroundColor === 'string') {
return customBackgroundColor;
}
- if (theme.isV3) {
- if (disabled) {
- if (isOutlined) {
- return 'transparent';
- }
- return color(theme.colors.onSurfaceVariant).alpha(0.12).rgb().string();
+ if (disabled) {
+ if (isOutlined) {
+ return 'transparent';
}
+ return colors.surfaceContainerLow;
}
return getDefaultBackgroundColor({ theme, isOutlined });
@@ -144,57 +109,15 @@ const getSelectedBackgroundColor = ({
isOutlined,
disabled,
customBackgroundColor,
- showSelectedOverlay,
}: BaseProps & {
customBackgroundColor?: ColorValue;
- showSelectedOverlay?: boolean;
}) => {
- const backgroundColor = getBackgroundColor({
+ return getBackgroundColor({
theme,
disabled,
isOutlined,
customBackgroundColor,
});
-
- if (theme.isV3) {
- if (isOutlined) {
- if (showSelectedOverlay) {
- return color(backgroundColor)
- .mix(color(theme.colors.onSurfaceVariant), 0.12)
- .rgb()
- .string();
- }
- return color(backgroundColor)
- .mix(color(theme.colors.onSurfaceVariant), 0)
- .rgb()
- .string();
- }
-
- if (showSelectedOverlay) {
- return color(backgroundColor)
- .mix(color(theme.colors.onSecondaryContainer), 0.12)
- .rgb()
- .string();
- }
-
- return color(backgroundColor)
- .mix(color(theme.colors.onSecondaryContainer), 0)
- .rgb()
- .string();
- }
-
- if (theme.dark) {
- if (isOutlined) {
- return color(backgroundColor).lighten(0.2).rgb().string();
- }
- return color(backgroundColor).lighten(0.4).rgb().string();
- }
-
- if (isOutlined) {
- return color(backgroundColor).darken(0.08).rgb().string();
- }
-
- return color(backgroundColor).darken(0.2).rgb().string();
};
const getIconColor = ({
@@ -206,86 +129,32 @@ const getIconColor = ({
selectedColor?: string;
}) => {
const isSelectedColor = selectedColor !== undefined;
- if (theme.isV3) {
- if (disabled) {
- return theme.colors.onSurfaceDisabled;
- }
-
- if (isSelectedColor) {
- return selectedColor;
- }
-
- if (isOutlined) {
- return theme.colors.onSurfaceVariant;
- }
-
- return theme.colors.onSecondaryContainer;
- }
-
+ const { colors } = md3(theme);
if (disabled) {
- return theme.colors.disabled;
+ return colors.onSurface;
}
if (isSelectedColor) {
- return color(selectedColor).alpha(0.54).rgb().string();
+ return selectedColor;
}
- return color(theme.colors.text).alpha(0.54).rgb().string();
-};
-
-const getRippleColor = ({
- theme,
- isOutlined,
- disabled,
- selectedColor,
- selectedBackgroundColor,
- customRippleColor,
-}: BaseProps & {
- selectedBackgroundColor: string;
- selectedColor?: string;
- customRippleColor?: ColorValue;
-}) => {
- if (customRippleColor) {
- return customRippleColor;
- }
-
- const isSelectedColor = selectedColor !== undefined;
- const textColor = getTextColor({
- theme,
- disabled,
- selectedColor,
- isOutlined,
- });
-
- if (theme.isV3) {
- if (isSelectedColor) {
- return color(selectedColor).alpha(0.12).rgb().string();
- }
-
- return color(textColor).alpha(0.12).rgb().string();
- }
-
- if (isSelectedColor) {
- return color(selectedColor).fade(0.5).rgb().string();
+ if (isOutlined) {
+ return colors.onSurfaceVariant;
}
- return selectedBackgroundColor;
+ return colors.onSecondaryContainer;
};
export const getChipColors = ({
isOutlined,
theme,
selectedColor,
- showSelectedOverlay,
customBackgroundColor,
disabled,
- customRippleColor,
}: BaseProps & {
customBackgroundColor?: ColorValue;
disabled?: boolean;
- showSelectedOverlay?: boolean;
selectedColor?: string;
- customRippleColor?: ColorValue;
}) => {
const baseChipColorProps = { theme, isOutlined, disabled };
@@ -297,9 +166,12 @@ export const getChipColors = ({
const selectedBackgroundColor = getSelectedBackgroundColor({
...baseChipColorProps,
customBackgroundColor,
- showSelectedOverlay,
});
+ const contentOpacity = disabled
+ ? stateOpacity.disabled
+ : stateOpacity.enabled;
+
return {
borderColor: getBorderColor({
...baseChipColorProps,
@@ -314,12 +186,7 @@ export const getChipColors = ({
...baseChipColorProps,
selectedColor,
}),
- rippleColor: getRippleColor({
- ...baseChipColorProps,
- selectedColor,
- selectedBackgroundColor,
- customRippleColor,
- }),
+ contentOpacity,
backgroundColor,
selectedBackgroundColor,
};
diff --git a/src/components/DataTable/DataTableHeader.tsx b/src/components/DataTable/DataTableHeader.tsx
index a4619ebb99..1fee2a02ab 100644
--- a/src/components/DataTable/DataTableHeader.tsx
+++ b/src/components/DataTable/DataTableHeader.tsx
@@ -1,10 +1,7 @@
import * as React from 'react';
import { StyleProp, StyleSheet, View, ViewStyle } from 'react-native';
-import color from 'color';
-
import { useInternalTheme } from '../../core/theming';
-import { black, white } from '../../styles/themes/v2/colors';
import type { ThemeProp } from '../../types';
export type Props = React.ComponentPropsWithRef & {
@@ -52,12 +49,7 @@ const DataTableHeader = ({
...rest
}: Props) => {
const theme = useInternalTheme(themeOverrides);
- const borderBottomColor = theme.isV3
- ? theme.colors.surfaceVariant
- : color(theme.dark ? white : black)
- .alpha(0.12)
- .rgb()
- .string();
+ const borderBottomColor = theme.colors.surfaceVariant;
return (
diff --git a/src/components/DataTable/DataTablePagination.tsx b/src/components/DataTable/DataTablePagination.tsx
index dd72dbe54f..6a3fc52b3d 100644
--- a/src/components/DataTable/DataTablePagination.tsx
+++ b/src/components/DataTable/DataTablePagination.tsx
@@ -1,6 +1,5 @@
import * as React from 'react';
import {
- ColorValue,
I18nManager,
StyleProp,
StyleSheet,
@@ -8,7 +7,6 @@ import {
ViewStyle,
} from 'react-native';
-import color from 'color';
import type { ThemeProp } from 'src/types';
import { useInternalTheme } from '../../core/theming';
@@ -57,14 +55,6 @@ type PaginationDropdownProps = {
* The function to set the number of rows per page.
*/
onItemsPerPageChange?: (numberOfItemsPerPage: number) => void;
- /**
- * Color of the dropdown item ripple effect.
- */
- dropdownItemRippleColor?: ColorValue;
- /**
- * Color of the select page dropdown ripple effect.
- */
- selectPageDropdownRippleColor?: ColorValue;
/**
* @optional
*/
@@ -88,10 +78,6 @@ type PaginationControlsProps = {
* Whether to show fast forward and fast rewind buttons in pagination. False by default.
*/
showFastPaginationControls?: boolean;
- /**
- * Color of the pagination control ripple effect.
- */
- paginationControlRippleColor?: ColorValue;
/**
* @optional
*/
@@ -104,11 +90,10 @@ const PaginationControls = ({
onPageChange,
showFastPaginationControls,
theme: themeOverrides,
- paginationControlRippleColor,
}: PaginationControlsProps) => {
const theme = useInternalTheme(themeOverrides);
- const textColor = theme.isV3 ? theme.colors.onSurface : theme.colors.text;
+ const textColor = theme.colors.onSurface;
return (
<>
@@ -123,7 +108,6 @@ const PaginationControls = ({
/>
)}
iconColor={textColor}
- rippleColor={paginationControlRippleColor}
disabled={page === 0}
onPress={() => onPageChange(0)}
accessibilityLabel="page-first"
@@ -140,7 +124,6 @@ const PaginationControls = ({
/>
)}
iconColor={textColor}
- rippleColor={paginationControlRippleColor}
disabled={page === 0}
onPress={() => onPageChange(page - 1)}
accessibilityLabel="chevron-left"
@@ -156,7 +139,6 @@ const PaginationControls = ({
/>
)}
iconColor={textColor}
- rippleColor={paginationControlRippleColor}
disabled={numberOfPages === 0 || page === numberOfPages - 1}
onPress={() => onPageChange(page + 1)}
accessibilityLabel="chevron-right"
@@ -173,7 +155,6 @@ const PaginationControls = ({
/>
)}
iconColor={textColor}
- rippleColor={paginationControlRippleColor}
disabled={numberOfPages === 0 || page === numberOfPages - 1}
onPress={() => onPageChange(numberOfPages - 1)}
accessibilityLabel="page-last"
@@ -189,8 +170,6 @@ const PaginationDropdown = ({
numberOfItemsPerPage,
onItemsPerPageChange,
theme: themeOverrides,
- selectPageDropdownRippleColor,
- dropdownItemRippleColor,
}: PaginationDropdownProps) => {
const theme = useInternalTheme(themeOverrides);
const { colors } = theme;
@@ -209,7 +188,6 @@ const PaginationDropdown = ({
icon="menu-down"
contentStyle={styles.contentStyle}
theme={theme}
- rippleColor={selectPageDropdownRippleColor}
>
{`${numberOfItemsPerPage}`}
@@ -227,7 +205,6 @@ const PaginationDropdown = ({
onItemsPerPageChange?.(option);
toggleSelect(false);
}}
- rippleColor={dropdownItemRippleColor}
title={option}
theme={theme}
/>
@@ -304,18 +281,11 @@ const DataTablePagination = ({
onItemsPerPageChange,
selectPageDropdownLabel,
selectPageDropdownAccessibilityLabel,
- selectPageDropdownRippleColor,
- dropdownItemRippleColor,
theme: themeOverrides,
...rest
}: Props) => {
const theme = useInternalTheme(themeOverrides);
- const labelColor = color(
- theme.isV3 ? theme.colors.onSurface : theme?.colors.text
- )
- .alpha(0.6)
- .rgb()
- .string();
+ const labelColor = theme.colors.onSurfaceVariant;
return (
diff --git a/src/components/DataTable/DataTableRow.tsx b/src/components/DataTable/DataTableRow.tsx
index 25491955d4..d492f4ce53 100644
--- a/src/components/DataTable/DataTableRow.tsx
+++ b/src/components/DataTable/DataTableRow.tsx
@@ -8,10 +8,7 @@ import {
ViewStyle,
} from 'react-native';
-import color from 'color';
-
import { useInternalTheme } from '../../core/theming';
-import { black, white } from '../../styles/themes/v2/colors';
import type { $RemoveChildren, ThemeProp } from '../../types';
import TouchableRipple from '../TouchableRipple/TouchableRipple';
@@ -66,12 +63,7 @@ const DataTableRow = ({
...rest
}: Props) => {
const theme = useInternalTheme(themeOverrides);
- const borderBottomColor = theme.isV3
- ? theme.colors.surfaceVariant
- : color(theme.dark ? white : black)
- .alpha(0.12)
- .rgb()
- .string();
+ const borderBottomColor = theme.colors.surfaceVariant;
return (
{
const { right, left } = useSafeAreaInsets();
const theme = useInternalTheme(themeOverrides);
- const { isV3, dark, mode, colors, roundness } = theme;
- const borderRadius = (isV3 ? 7 : 1) * roundness;
+ const { roundness } = theme as MD3Theme;
+ const borderRadius = 7 * roundness;
- const backgroundColorV2 =
- dark && mode === 'adaptive'
- ? overlay(DIALOG_ELEVATION, colors?.surface)
- : colors?.surface;
- const backgroundColor = isV3
- ? theme.colors.elevation.level3
- : backgroundColorV2;
+ const backgroundColor = theme.colors.surfaceContainerHigh;
return (
child != null && typeof child !== 'boolean')
.map((child, i) => {
- if (isV3) {
- if (i === 0 && React.isValidElement(child)) {
- return React.cloneElement(child, {
- style: [{ marginTop: 24 }, child.props.style],
- });
- }
- }
-
- if (
- i === 0 &&
- React.isValidElement(child) &&
- child.type === DialogContent
- ) {
- // Dialog content is the first item, so we add a top padding
+ if (i === 0 && React.isValidElement(child)) {
return React.cloneElement(child, {
- style: [{ paddingTop: 24 }, child.props.style],
+ style: [{ marginTop: 24 }, child.props.style],
});
}
diff --git a/src/components/Dialog/DialogActions.tsx b/src/components/Dialog/DialogActions.tsx
index cabebd2fe2..7b34739da5 100644
--- a/src/components/Dialog/DialogActions.tsx
+++ b/src/components/Dialog/DialogActions.tsx
@@ -47,21 +47,18 @@ export type Props = React.ComponentPropsWithRef & {
* ```
*/
const DialogActions = (props: Props) => {
- const { isV3 } = useInternalTheme(props.theme);
+ useInternalTheme(props.theme);
const actionsLength = React.Children.toArray(props.children).length;
return (
-
+
{React.Children.map(props.children, (child, i) =>
React.isValidElement(child)
? React.cloneElement(child, {
compact: true,
- uppercase: !isV3,
+ uppercase: false,
style: [
- isV3 && {
+ {
marginRight: i + 1 === actionsLength ? 0 : 8,
},
child.props.style,
@@ -76,12 +73,6 @@ const DialogActions = (props: Props) => {
DialogActions.displayName = 'Dialog.Actions';
const styles = StyleSheet.create({
- container: {
- flexDirection: 'row',
- alignItems: 'center',
- justifyContent: 'flex-end',
- padding: 8,
- },
v3Container: {
flexDirection: 'row',
flexGrow: 1,
diff --git a/src/components/Dialog/DialogIcon.tsx b/src/components/Dialog/DialogIcon.tsx
index ad5841b93a..7682054003 100644
--- a/src/components/Dialog/DialogIcon.tsx
+++ b/src/components/Dialog/DialogIcon.tsx
@@ -4,6 +4,7 @@ import { StyleSheet, View } from 'react-native';
import type { ThemeProp } from 'src/types';
import { useInternalTheme } from '../../core/theming';
+import type { MD3Theme } from '../../types';
import Icon, { IconSource } from '../Icon';
export type Props = {
@@ -69,13 +70,10 @@ const DialogIcon = ({
theme: themeOverrides,
}: Props) => {
const theme = useInternalTheme(themeOverrides);
-
- if (!theme.isV3) {
- return null;
- }
+ const { colors } = theme as MD3Theme;
//@ts-ignore
- const iconColor = color || theme.colors.secondary;
+ const iconColor = color || colors.secondary;
return (
diff --git a/src/components/Dialog/DialogScrollArea.tsx b/src/components/Dialog/DialogScrollArea.tsx
index 66fdcef6a0..5deeb4a5e6 100644
--- a/src/components/Dialog/DialogScrollArea.tsx
+++ b/src/components/Dialog/DialogScrollArea.tsx
@@ -4,6 +4,7 @@ import { StyleProp, StyleSheet, View, ViewStyle } from 'react-native';
import type { ThemeProp } from 'src/types';
import { useInternalTheme } from '../../core/theming';
+import type { MD3Theme } from '../../types';
export type Props = React.ComponentPropsWithRef & {
/**
@@ -50,22 +51,16 @@ export type Props = React.ComponentPropsWithRef & {
*/
const DialogScrollArea = (props: Props) => {
const theme = useInternalTheme(props.theme);
+ const { colors } = theme as MD3Theme;
const borderStyles = {
- borderColor: theme.isV3
- ? theme.colors.surfaceVariant
- : 'rgba(0, 0, 0, .12)',
- borderTopWidth: theme.isV3 ? 1 : StyleSheet.hairlineWidth,
- borderBottomWidth: theme.isV3 ? 1 : StyleSheet.hairlineWidth,
+ borderColor: colors.surfaceVariant,
+ borderTopWidth: 1,
+ borderBottomWidth: 1,
};
return (
{props.children}
diff --git a/src/components/Dialog/DialogTitle.tsx b/src/components/Dialog/DialogTitle.tsx
index 9953fc506c..407acb68b3 100644
--- a/src/components/Dialog/DialogTitle.tsx
+++ b/src/components/Dialog/DialogTitle.tsx
@@ -2,11 +2,10 @@ import * as React from 'react';
import { StyleProp, StyleSheet, TextStyle } from 'react-native';
import { useInternalTheme } from '../../core/theming';
-import type { ThemeProp } from '../../types';
+import type { MD3Theme, ThemeProp } from '../../types';
import Text from '../Typography/Text';
-import Title from '../Typography/v2/Title';
-export type Props = React.ComponentPropsWithRef & {
+export type Props = React.ComponentPropsWithRef & {
/**
* Title text for the `DialogTitle`.
*/
@@ -53,24 +52,22 @@ const DialogTitle = ({
...rest
}: Props) => {
const theme = useInternalTheme(themeOverrides);
- const { isV3, colors, fonts } = theme;
-
- const TextComponent = isV3 ? Text : Title;
+ const { colors, fonts } = theme as MD3Theme;
const headerTextStyle = {
- color: isV3 ? colors.onSurface : colors?.text,
- ...(isV3 ? fonts.headlineSmall : {}),
+ color: colors.onSurface,
+ ...fonts.headlineSmall,
};
return (
-
{children}
-
+
);
};
diff --git a/src/components/Divider.tsx b/src/components/Divider.tsx
index be30d94c7c..c697a2a04a 100644
--- a/src/components/Divider.tsx
+++ b/src/components/Divider.tsx
@@ -1,10 +1,7 @@
import * as React from 'react';
import { StyleProp, StyleSheet, View, ViewStyle } from 'react-native';
-import color from 'color';
-
import { useInternalTheme } from '../core/theming';
-import { black, white } from '../styles/themes/v2/colors';
import type { $RemoveChildren, ThemeProp } from '../types';
export type Props = $RemoveChildren & {
@@ -60,23 +57,17 @@ const Divider = ({
...rest
}: Props) => {
const theme = useInternalTheme(themeOverrides);
- const { dark: isDarkTheme, isV3 } = theme;
- const dividerColor = isV3
- ? theme.colors.outlineVariant
- : color(isDarkTheme ? white : black)
- .alpha(0.12)
- .rgb()
- .string();
+ const dividerColor = theme.colors.outlineVariant;
return (
@@ -84,9 +75,6 @@ const Divider = ({
};
const styles = StyleSheet.create({
- leftInset: {
- marginLeft: 72,
- },
v3LeftInset: {
marginLeft: 16,
},
diff --git a/src/components/Drawer/DrawerCollapsedItem.tsx b/src/components/Drawer/DrawerCollapsedItem.tsx
index 9fb461e9c5..c10c7ac0b6 100644
--- a/src/components/Drawer/DrawerCollapsedItem.tsx
+++ b/src/components/Drawer/DrawerCollapsedItem.tsx
@@ -111,7 +111,6 @@ const DrawerCollapsedItem = ({
...rest
}: Props) => {
const theme = useInternalTheme(themeOverrides);
- const { isV3 } = theme;
const { scale } = theme.animation;
const [numOfLines, setNumOfLines] = React.useState(1);
@@ -126,10 +125,6 @@ const DrawerCollapsedItem = ({
}
}, [animScale, active]);
- if (!isV3) {
- return null;
- }
-
const handlePressOut = () => {
Animated.timing(animScale, {
toValue: 1,
@@ -163,7 +158,7 @@ const DrawerCollapsedItem = ({
const labelTextStyle = {
color: labelColor,
- ...(isV3 ? theme.fonts.labelMedium : {}),
+ ...theme.fonts.labelMedium,
};
const icon =
diff --git a/src/components/Drawer/DrawerItem.tsx b/src/components/Drawer/DrawerItem.tsx
index 604df1b83b..6902b4b8cb 100644
--- a/src/components/Drawer/DrawerItem.tsx
+++ b/src/components/Drawer/DrawerItem.tsx
@@ -1,6 +1,5 @@
import * as React from 'react';
import {
- ColorValue,
GestureResponderEvent,
PressableAndroidRippleConfig,
StyleProp,
@@ -9,8 +8,6 @@ import {
ViewStyle,
} from 'react-native';
-import color from 'color';
-
import { useInternalTheme } from '../../core/theming';
import type { ThemeProp } from '../../types';
import Icon, { IconSource } from '../Icon';
@@ -57,10 +54,6 @@ export type Props = React.ComponentPropsWithRef & {
* Specifies the largest possible scale a label font can reach.
*/
labelMaxFontSizeMultiplier?: number;
- /**
- * Color of the ripple effect.
- */
- rippleColor?: ColorValue;
/**
* Sets additional distance outside of element in which a press can be detected.
*/
@@ -97,7 +90,6 @@ const DrawerItem = ({
active,
disabled,
theme: themeOverrides,
- rippleColor: customRippleColor,
style,
onPress,
background,
@@ -108,27 +100,16 @@ const DrawerItem = ({
...rest
}: Props) => {
const theme = useInternalTheme(themeOverrides);
- const { roundness, isV3 } = theme;
+ const { roundness } = theme;
- const backgroundColor = active
- ? isV3
- ? theme.colors.secondaryContainer
- : color(theme.colors.primary).alpha(0.12).rgb().string()
- : undefined;
+ const backgroundColor = active ? theme.colors.secondaryContainer : undefined;
const contentColor = active
- ? isV3
- ? theme.colors.onSecondaryContainer
- : theme.colors.primary
- : isV3
- ? theme.colors.onSurfaceVariant
- : color(theme.colors.text).alpha(0.68).rgb().string();
+ ? theme.colors.onSecondaryContainer
+ : theme.colors.onSurfaceVariant;
- const labelMargin = icon ? (isV3 ? 12 : 32) : 0;
- const borderRadius = (isV3 ? 7 : 1) * roundness;
- const rippleColor = isV3
- ? color(contentColor).alpha(0.12).rgb().string()
- : undefined;
- const font = isV3 ? theme.fonts.labelLarge : theme.fonts.medium;
+ const labelMargin = icon ? 12 : 0;
+ const borderRadius = 7 * roundness;
+ const font = theme.fonts.labelLarge;
return (
@@ -139,18 +120,17 @@ const DrawerItem = ({
onPress={onPress}
style={[
styles.container,
+ styles.v3Container,
{ backgroundColor, borderRadius },
- isV3 && styles.v3Container,
style,
]}
accessibilityRole="button"
accessibilityState={{ selected: active }}
accessibilityLabel={accessibilityLabel}
- rippleColor={customRippleColor || rippleColor}
theme={theme}
hitSlop={hitSlop}
>
-
+
{icon ? (
diff --git a/src/components/Drawer/DrawerSection.tsx b/src/components/Drawer/DrawerSection.tsx
index ed79c5e054..a701d38ad6 100644
--- a/src/components/Drawer/DrawerSection.tsx
+++ b/src/components/Drawer/DrawerSection.tsx
@@ -1,8 +1,6 @@
import * as React from 'react';
import { StyleProp, StyleSheet, View, ViewStyle } from 'react-native';
-import color from 'color';
-
import { useInternalTheme } from '../../core/theming';
import { MD3Colors } from '../../styles/themes/v3/tokens';
import type { ThemeProp } from '../../types';
@@ -73,17 +71,14 @@ const DrawerSection = ({
...rest
}: Props) => {
const theme = useInternalTheme(themeOverrides);
- const { isV3 } = theme;
- const titleColor = isV3
- ? theme.colors.onSurfaceVariant
- : color(theme.colors.text).alpha(0.54).rgb().string();
- const titleMargin = isV3 ? 28 : 16;
- const font = isV3 ? theme.fonts.titleSmall : theme.fonts.medium;
+ const titleColor = theme.colors.onSurfaceVariant;
+ const titleMargin = 28;
+ const font = theme.fonts.titleSmall;
return (
{title && (
-
+
{title && (
)}
diff --git a/src/components/FAB/AnimatedFAB.tsx b/src/components/FAB/AnimatedFAB.tsx
index ecfe7e1c60..ed4a200b09 100644
--- a/src/components/FAB/AnimatedFAB.tsx
+++ b/src/components/FAB/AnimatedFAB.tsx
@@ -1,7 +1,6 @@
import * as React from 'react';
import type {
AccessibilityState,
- ColorValue,
NativeSyntheticEvent,
PressableAndroidRippleConfig,
TextLayoutEventData,
@@ -20,8 +19,6 @@ import {
Text,
} from 'react-native';
-import color from 'color';
-
import { getCombinedStyles, getFABColors, getLabelSizeWeb } from './utils';
import { useInternalTheme } from '../../core/theming';
import type { $Omit, $RemoveChildren, ThemeProp } from '../../types';
@@ -67,14 +64,6 @@ export type Props = $Omit<$RemoveChildren, 'mode'> & {
* Custom color for the icon and label of the `FAB`.
*/
color?: string;
- /**
- * Color of the ripple effect.
- */
- rippleColor?: ColorValue;
- /**
- * Whether `FAB` is disabled. A disabled button is greyed out and `onPress` is not called on touch.
- */
- disabled?: boolean;
/**
* Whether `FAB` is currently visible.
*/
@@ -129,7 +118,6 @@ export type Props = $Omit<$RemoveChildren, 'mode'> & {
};
const SIZE = 56;
-const SCALE = 0.9;
/**
* An animated, extending horizontally floating action button represents the primary action in an application.
@@ -214,8 +202,6 @@ const AnimatedFAB = ({
accessibilityLabel = label,
accessibilityState,
color: customColor,
- rippleColor: customRippleColor,
- disabled,
onPress,
onLongPress,
delayLongPress,
@@ -233,7 +219,7 @@ const AnimatedFAB = ({
...rest
}: Props) => {
const theme = useInternalTheme(themeOverrides);
- const uppercase: boolean = uppercaseProp ?? !theme.isV3;
+ const uppercase: boolean = uppercaseProp ?? false;
const isIOS = Platform.OS === 'ios';
const isWeb = Platform.OS === 'web';
const isAnimatedFromRight = animateFrom === 'right';
@@ -246,7 +232,7 @@ const AnimatedFAB = ({
const { current: animFAB } = React.useRef(
new Animated.Value(0)
);
- const { isV3, animation } = theme;
+ const { animation } = theme;
const { scale } = animation;
const labelSize = isWeb ? getLabelSizeWeb(labelRef) : null;
@@ -257,7 +243,7 @@ const AnimatedFAB = ({
labelSize?.height ?? 0
);
- const borderRadius = SIZE / (isV3 ? 3.5 : 2);
+ const borderRadius = SIZE / 3.5;
React.useEffect(() => {
if (!isWeb) {
@@ -309,14 +295,10 @@ const AnimatedFAB = ({
const { backgroundColor, foregroundColor } = getFABColors({
theme,
variant,
- disabled,
customColor,
customBackgroundColor,
});
- const rippleColor =
- customRippleColor || color(foregroundColor).alpha(0.12).rgb().string();
-
const extendedWidth = textWidth + SIZE + borderRadius;
const distance = isAnimatedFromRight
@@ -364,23 +346,19 @@ const AnimatedFAB = ({
animFAB,
});
- const font = isV3 ? theme.fonts.labelLarge : theme.fonts.medium;
+ const font = theme.fonts.labelLarge;
const textStyle = {
color: foregroundColor,
...font,
};
- const md2Elevation = disabled || !isIOS ? 0 : 6;
- const md3Elevation = disabled || !isIOS ? 0 : 3;
+ const md3Elevation = !isIOS ? 0 : 3;
- const shadowStyle = isV3 ? styles.v3Shadow : styles.shadow;
- const baseStyle = [
- StyleSheet.absoluteFill,
- disabled ? styles.disabled : shadowStyle,
- ];
+ const shadowStyle = styles.v3Shadow;
+ const baseStyle = [StyleSheet.absoluteFill, shadowStyle];
- const newAccessibilityState = { ...accessibilityState, disabled };
+ const newAccessibilityState = { ...accessibilityState };
return (
-
+
, 'mode'> & {
* Custom color for the icon and label of the `FAB`.
*/
color?: string;
- /**
- * Color of the ripple effect.
- */
- rippleColor?: ColorValue;
- /**
- * Whether `FAB` is disabled. A disabled button is greyed out and `onPress` is not called on touch.
- */
- disabled?: boolean;
/**
* Whether `FAB` is currently visible.
*/
@@ -189,8 +180,6 @@ const FAB = forwardRef(
accessibilityState,
animated = true,
color: customColor,
- rippleColor: customRippleColor,
- disabled,
onPress,
onLongPress,
delayLongPress,
@@ -210,11 +199,11 @@ const FAB = forwardRef(
ref
) => {
const theme = useInternalTheme(themeOverrides);
- const uppercase = uppercaseProp ?? !theme.isV3;
+ const uppercase = uppercaseProp ?? false;
const { current: visibility } = React.useRef(
new Animated.Value(visible ? 1 : 0)
);
- const { isV3, animation } = theme;
+ const { animation } = theme;
const { scale } = animation;
React.useEffect(() => {
@@ -242,20 +231,18 @@ const FAB = forwardRef(
backgroundColor: customBackgroundColor,
} = (StyleSheet.flatten(style) || {}) as ViewStyle;
- const { backgroundColor, foregroundColor, rippleColor } = getFABColors({
+ const { backgroundColor, foregroundColor } = getFABColors({
theme,
variant,
- disabled,
customColor,
customBackgroundColor,
- customRippleColor,
});
const isLargeSize = size === 'large';
const isFlatMode = mode === 'flat';
const iconSize = isLargeSize ? 36 : 24;
const loadingIndicatorSize = isLargeSize ? 24 : 18;
- const font = isV3 ? theme.fonts.labelLarge : theme.fonts.medium;
+ const font = theme.fonts.labelLarge;
const extendedStyle = getExtendedFabStyle({ customSize, theme });
const textStyle = {
@@ -263,9 +250,7 @@ const FAB = forwardRef(
...font,
};
- const md3Elevation = isFlatMode || disabled ? 0 : 3;
-
- const newAccessibilityState = { ...accessibilityState, disabled };
+ const md3Elevation = isFlatMode ? 0 : 3;
return (
(
},
],
},
- !isV3 && styles.elevated,
- !isV3 && disabled && styles.disabled,
style,
]}
pointerEvents={visible ? 'auto' : 'none'}
testID={`${testID}-container`}
- {...(isV3 && { elevation: md3Elevation })}
+ elevation={md3Elevation}
container
>
(
onPress={onPress}
onLongPress={onLongPress}
delayLongPress={delayLongPress}
- rippleColor={rippleColor}
- disabled={disabled}
accessibilityLabel={accessibilityLabel}
accessibilityRole="button"
- accessibilityState={newAccessibilityState}
+ accessibilityState={accessibilityState}
testID={testID}
style={{ borderRadius }}
{...rest}
@@ -347,9 +328,6 @@ const FAB = forwardRef(
);
const styles = StyleSheet.create({
- elevated: {
- elevation: 6,
- },
content: {
flexDirection: 'row',
alignItems: 'center',
@@ -361,9 +339,6 @@ const styles = StyleSheet.create({
uppercaseLabel: {
textTransform: 'uppercase',
},
- disabled: {
- elevation: 0,
- },
});
export default FAB;
diff --git a/src/components/FAB/FABGroup.tsx b/src/components/FAB/FABGroup.tsx
index ca263e3499..595739b57c 100644
--- a/src/components/FAB/FABGroup.tsx
+++ b/src/components/FAB/FABGroup.tsx
@@ -1,7 +1,6 @@
import * as React from 'react';
import {
Animated,
- ColorValue,
GestureResponderEvent,
Pressable,
StyleProp,
@@ -43,7 +42,6 @@ export type Props = {
* - `toggleStackOnLongPress`: callback that is called when `FAB` is long pressed
* - `size`: size of action item. Defaults to `small`. @supported Available in v5.x
* - `testID`: testID to be used on tests
- * - `rippleColor`: color of the ripple effect.
*/
actions: Array<{
icon: IconSource;
@@ -60,7 +58,6 @@ export type Props = {
onPress: (e: GestureResponderEvent) => void;
size?: 'small' | 'medium';
testID?: string;
- rippleColor?: ColorValue;
}>;
/**
* Icon to display for the `FAB`.
@@ -79,10 +76,6 @@ export type Props = {
* Custom backdrop color for opened speed dial background.
*/
backdropColor?: string;
- /**
- * Color of the ripple effect.
- */
- rippleColor?: ColorValue;
/**
* Function to execute on pressing the `FAB`.
*/
@@ -221,7 +214,6 @@ const FABGroup = ({
variant = 'primary',
enableLongPressWhenStackOpened = false,
backdropColor: customBackdropColor,
- rippleColor,
}: Props) => {
const theme = useInternalTheme(themeOverrides);
const { top, bottom, right, left } = useSafeAreaInsets();
@@ -250,7 +242,6 @@ const FABGroup = ({
>(null);
const { scale } = theme.animation;
- const { isV3 } = theme;
React.useEffect(() => {
if (open) {
@@ -262,7 +253,7 @@ const FABGroup = ({
useNativeDriver: true,
}),
Animated.stagger(
- isV3 ? 15 : 50 * scale,
+ 15,
animations.current
.map((animation) =>
Animated.timing(animation, {
@@ -294,7 +285,7 @@ const FABGroup = ({
}
});
}
- }, [open, actions, backdrop, scale, isV3]);
+ }, [open, actions, backdrop, scale]);
const close = () => onStateChange({ open: false });
const toggle = () => onStateChange({ open: !open });
@@ -315,25 +306,21 @@ const FABGroup = ({
}
};
- const { labelColor, backdropColor, stackedFABBackgroundColor } =
- getFABGroupColors({ theme, customBackdropColor });
+ const {
+ labelColor,
+ backdropColor,
+ backdropOpacity: backdropMaxOpacity,
+ stackedFABBackgroundColor,
+ } = getFABGroupColors({ theme, customBackdropColor });
const backdropOpacity = open
? backdrop.interpolate({
inputRange: [0, 0.5, 1],
- outputRange: [0, 1, 1],
+ outputRange: [0, backdropMaxOpacity, backdropMaxOpacity],
})
- : backdrop;
+ : Animated.multiply(backdrop, backdropMaxOpacity);
const opacities = animations.current;
- const scales = opacities.map((opacity) =>
- open
- ? opacity.interpolate({
- inputRange: [0, 1],
- outputRange: [0.5, 1],
- })
- : 1
- );
const translations = opacities.map((opacity) =>
open
@@ -395,7 +382,7 @@ const FABGroup = ({
{actions.map((it, i) => {
const labelTextStyle = {
color: it.labelTextColor ?? labelColor,
- ...(isV3 ? theme.fonts.titleMedium : {}),
+ ...theme.fonts.titleMedium,
};
const marginHorizontal =
typeof it.size === 'undefined' || it.size === 'small' ? 24 : 16;
@@ -430,7 +417,7 @@ const FABGroup = ({
{it.label && (
@@ -467,11 +450,10 @@ const FABGroup = ({
color={it.color}
style={[
{
- transform: [{ scale: scales[i] }],
+ transform: [{ translateY: translations[i] }],
opacity: opacities[i],
backgroundColor: stackedFABBackgroundColor,
},
- isV3 && { transform: [{ translateY: translations[i] }] },
it.style,
]}
accessibilityElementsHidden={true}
@@ -480,7 +462,6 @@ const FABGroup = ({
importantForAccessibility="no-hide-descendants"
testID={it.testID}
visible={open}
- rippleColor={it.rippleColor}
/>
);
@@ -501,7 +482,6 @@ const FABGroup = ({
label={label}
testID={testID}
variant={variant}
- rippleColor={rippleColor}
/>
diff --git a/src/components/FAB/utils.ts b/src/components/FAB/utils.ts
index e87d24019f..ad49fa13be 100644
--- a/src/components/FAB/utils.ts
+++ b/src/components/FAB/utils.ts
@@ -7,11 +7,7 @@ import {
ViewStyle,
} from 'react-native';
-import color from 'color';
-
-import { black, white } from '../../styles/themes/v2/colors';
import type { InternalTheme } from '../../types';
-import getContrastingColor from '../../utils/getContrastingColor';
type GetCombinedStylesProps = {
isAnimatedFromRight: boolean;
@@ -31,7 +27,6 @@ type Variant = 'primary' | 'secondary' | 'tertiary' | 'surface';
type BaseProps = {
isVariant: (variant: Variant) => boolean;
theme: InternalTheme;
- disabled?: boolean;
};
export const getCombinedStyles = ({
@@ -167,117 +162,75 @@ export const getCombinedStyles = ({
const getBackgroundColor = ({
theme,
isVariant,
- disabled,
customBackgroundColor,
}: BaseProps & { customBackgroundColor?: ColorValue }) => {
- if (customBackgroundColor && !disabled) {
+ if (customBackgroundColor) {
return customBackgroundColor;
}
- if (theme.isV3) {
- if (disabled) {
- return theme.colors.surfaceDisabled;
- }
-
- if (isVariant('primary')) {
- return theme.colors.primaryContainer;
- }
-
- if (isVariant('secondary')) {
- return theme.colors.secondaryContainer;
- }
+ if (isVariant('primary')) {
+ return theme.colors.primaryContainer;
+ }
- if (isVariant('tertiary')) {
- return theme.colors.tertiaryContainer;
- }
+ if (isVariant('secondary')) {
+ return theme.colors.secondaryContainer;
+ }
- if (isVariant('surface')) {
- return theme.colors.elevation.level3;
- }
+ if (isVariant('tertiary')) {
+ return theme.colors.tertiaryContainer;
}
- if (disabled) {
- if (theme.dark) {
- return color(white).alpha(0.12).rgb().string();
- }
- return color(black).alpha(0.12).rgb().string();
+ if (isVariant('surface')) {
+ return theme.colors.surfaceContainerHigh;
}
- //@ts-ignore
- return theme.colors?.accent;
+ return theme.colors.primaryContainer;
};
const getForegroundColor = ({
theme,
isVariant,
- disabled,
- backgroundColor,
customColor,
-}: BaseProps & { backgroundColor: string; customColor?: string }) => {
- if (typeof customColor !== 'undefined' && !disabled) {
+}: BaseProps & { customColor?: string }) => {
+ if (typeof customColor !== 'undefined') {
return customColor;
}
- if (theme.isV3) {
- if (disabled) {
- return theme.colors.onSurfaceDisabled;
- }
-
- if (isVariant('primary')) {
- return theme.colors.onPrimaryContainer;
- }
-
- if (isVariant('secondary')) {
- return theme.colors.onSecondaryContainer;
- }
-
- if (isVariant('tertiary')) {
- return theme.colors.onTertiaryContainer;
- }
+ if (isVariant('primary')) {
+ return theme.colors.onPrimaryContainer;
+ }
- if (isVariant('surface')) {
- return theme.colors.primary;
- }
+ if (isVariant('secondary')) {
+ return theme.colors.onSecondaryContainer;
}
- if (disabled) {
- if (theme.dark) {
- return color(white).alpha(0.32).rgb().string();
- }
- return color(black).alpha(0.32).rgb().string();
+ if (isVariant('tertiary')) {
+ return theme.colors.onTertiaryContainer;
}
- if (backgroundColor) {
- return getContrastingColor(
- backgroundColor || white,
- white,
- 'rgba(0, 0, 0, .54)'
- );
+ if (isVariant('surface')) {
+ return theme.colors.primary;
}
- return getContrastingColor(white, white, 'rgba(0, 0, 0, .54)');
+ return theme.colors.onPrimaryContainer;
};
export const getFABColors = ({
theme,
variant,
- disabled,
customColor,
customBackgroundColor,
- customRippleColor,
}: {
theme: InternalTheme;
variant: string;
- disabled?: boolean;
customColor?: string;
customBackgroundColor?: ColorValue;
- customRippleColor?: ColorValue;
}) => {
const isVariant = (variantToCompare: Variant) => {
return variant === variantToCompare;
};
- const baseFABColorProps = { theme, isVariant, disabled };
+ const baseFABColorProps = { theme, isVariant };
const backgroundColor = getBackgroundColor({
...baseFABColorProps,
@@ -287,50 +240,20 @@ export const getFABColors = ({
const foregroundColor = getForegroundColor({
...baseFABColorProps,
customColor,
- backgroundColor,
});
return {
backgroundColor,
foregroundColor,
- rippleColor:
- customRippleColor || color(foregroundColor).alpha(0.12).rgb().string(),
};
};
const getLabelColor = ({ theme }: { theme: InternalTheme }) => {
- if (theme.isV3) {
- return theme.colors.onSurface;
- }
-
- if (theme.dark) {
- return theme.colors.text;
- }
-
- return color(theme.colors.text).fade(0.54).rgb().string();
-};
-
-const getBackdropColor = ({
- theme,
- customBackdropColor,
-}: {
- theme: InternalTheme;
- customBackdropColor?: string;
-}) => {
- if (customBackdropColor) {
- return customBackdropColor;
- }
- if (theme.isV3) {
- return color(theme.colors.background).alpha(0.95).rgb().string();
- }
- return theme.colors?.backdrop;
+ return theme.colors.onSurface;
};
const getStackedFABBackgroundColor = ({ theme }: { theme: InternalTheme }) => {
- if (theme.isV3) {
- return theme.colors.elevation.level3;
- }
- return theme.colors.surface;
+ return theme.colors.surfaceContainerHigh;
};
export const getFABGroupColors = ({
@@ -342,21 +265,12 @@ export const getFABGroupColors = ({
}) => {
return {
labelColor: getLabelColor({ theme }),
- backdropColor: getBackdropColor({ theme, customBackdropColor }),
+ backdropColor: customBackdropColor ?? theme.colors.background,
+ backdropOpacity: customBackdropColor ? 1 : 0.95,
stackedFABBackgroundColor: getStackedFABBackgroundColor({ theme }),
};
};
-const standardSize = {
- height: 56,
- width: 56,
- borderRadius: 28,
-};
-const smallSize = {
- height: 40,
- width: 40,
- borderRadius: 28,
-};
const v3SmallSize = {
height: 40,
width: 40,
@@ -385,30 +299,18 @@ export const getFabStyle = ({
size: 'small' | 'medium' | 'large';
theme: InternalTheme;
}) => {
- const { isV3, roundness } = theme;
+ const { roundness } = theme;
if (customSize) return getCustomFabSize(customSize, roundness);
- if (isV3) {
- switch (size) {
- case 'small':
- return { ...v3SmallSize, borderRadius: 3 * roundness };
- case 'medium':
- return { ...v3MediumSize, borderRadius: 4 * roundness };
- case 'large':
- return { ...v3LargeSize, borderRadius: 7 * roundness };
- }
+ switch (size) {
+ case 'small':
+ return { ...v3SmallSize, borderRadius: 3 * roundness };
+ case 'medium':
+ return { ...v3MediumSize, borderRadius: 4 * roundness };
+ case 'large':
+ return { ...v3LargeSize, borderRadius: 7 * roundness };
}
-
- if (size === 'small') {
- return smallSize;
- }
- return standardSize;
-};
-
-const extended = {
- height: 48,
- paddingHorizontal: 16,
};
const v3Extended = {
@@ -424,16 +326,14 @@ const getExtendedFabDimensions = (customSize: number) => ({
export const getExtendedFabStyle = ({
customSize,
- theme,
+ theme: _theme,
}: {
customSize?: number;
theme: InternalTheme;
}) => {
if (customSize) return getExtendedFabDimensions(customSize);
- const { isV3 } = theme;
-
- return isV3 ? v3Extended : extended;
+ return v3Extended;
};
let cachedContext: CanvasRenderingContext2D | null = null;
diff --git a/src/components/HelperText/HelperText.tsx b/src/components/HelperText/HelperText.tsx
index 8043968cff..6fc44d58a5 100644
--- a/src/components/HelperText/HelperText.tsx
+++ b/src/components/HelperText/HelperText.tsx
@@ -5,6 +5,7 @@ import {
StyleProp,
StyleSheet,
TextStyle,
+ View,
} from 'react-native';
import { getTextColor } from './utils';
@@ -122,36 +123,42 @@ const HelperText = ({
textHeight = e.nativeEvent.layout.height;
};
- const textColor = getTextColor({ theme, disabled, type });
+ const { color: textColor, opacity: textOpacity } = getTextColor({
+ theme,
+ disabled,
+ type,
+ });
return (
-
- {rest.children}
-
+
+
+ {rest.children}
+
+
);
};
diff --git a/src/components/HelperText/utils.ts b/src/components/HelperText/utils.ts
index 4134175416..767cb74ef0 100644
--- a/src/components/HelperText/utils.ts
+++ b/src/components/HelperText/utils.ts
@@ -1,7 +1,8 @@
-import color from 'color';
-
+import { tokens } from '../../styles/themes/v3/tokens';
import type { InternalTheme } from '../../types';
+const { stateOpacity } = tokens.md.ref;
+
type BaseProps = {
theme: InternalTheme;
disabled?: boolean;
@@ -9,22 +10,19 @@ type BaseProps = {
};
export function getTextColor({ theme, disabled, type }: BaseProps) {
- const { colors, dark } = theme;
-
if (type === 'error') {
- return colors?.error;
+ return { color: theme.colors.error, opacity: stateOpacity.enabled };
}
- if (theme.isV3) {
- if (disabled) {
- return theme.colors.onSurfaceDisabled;
- } else {
- return theme.colors.onSurfaceVariant;
- }
+ if (disabled) {
+ return {
+ color: theme.colors.onSurfaceVariant,
+ opacity: stateOpacity.disabled,
+ };
}
- return color(theme?.colors?.text)
- .alpha(dark ? 0.7 : 0.54)
- .rgb()
- .string();
+ return {
+ color: theme.colors.onSurfaceVariant,
+ opacity: stateOpacity.enabled,
+ };
}
diff --git a/src/components/Icon.tsx b/src/components/Icon.tsx
index b3d26c699d..b886e06fe2 100644
--- a/src/components/Icon.tsx
+++ b/src/components/Icon.tsx
@@ -122,8 +122,7 @@ const Icon = ({
typeof source === 'object' && source.direction && source.source
? source.source
: source;
- const iconColor =
- color || (theme.isV3 ? theme.colors.onSurface : theme.colors.text);
+ const iconColor = color || theme.colors.onSurface;
if (isImageSource(s)) {
return (
diff --git a/src/components/IconButton/IconButton.tsx b/src/components/IconButton/IconButton.tsx
index 47a87901ca..8cf5bff8d5 100644
--- a/src/components/IconButton/IconButton.tsx
+++ b/src/components/IconButton/IconButton.tsx
@@ -6,7 +6,6 @@ import {
ViewStyle,
View,
Animated,
- ColorValue,
} from 'react-native';
import { getIconButtonColor } from './utils';
@@ -43,11 +42,6 @@ export type Props = Omit<$RemoveChildren, 'style'> & {
*/
containerColor?: string;
/**
- * Color of the ripple effect.
- */
- rippleColor?: ColorValue;
- /**
- * @supported Available in v5.x with theme version 3
* Whether icon button is selected. A selected button receives alternative combination of icon and container colors.
*/
selected?: boolean;
@@ -120,7 +114,6 @@ const IconButton = forwardRef(
icon,
iconColor: customIconColor,
containerColor: customContainerColor,
- rippleColor: customRippleColor,
size = 24,
accessibilityLabel,
disabled,
@@ -138,25 +131,28 @@ const IconButton = forwardRef(
ref
) => {
const theme = useInternalTheme(themeOverrides);
- const { isV3 } = theme;
const IconComponent = animated ? CrossFadeIcon : Icon;
- const { iconColor, rippleColor, backgroundColor, borderColor } =
- getIconButtonColor({
- theme,
- disabled,
- selected,
- mode,
- customIconColor,
- customContainerColor,
- customRippleColor,
- });
+ const {
+ iconColor,
+ iconOpacity,
+ backgroundColor,
+ borderColor,
+ backgroundOpacity,
+ } = getIconButtonColor({
+ theme,
+ disabled,
+ selected,
+ mode,
+ customIconColor,
+ customContainerColor,
+ });
- const buttonSize = isV3 ? size + 2 * PADDING : size * 1.5;
+ const buttonSize = size + 2 * PADDING;
const {
- borderWidth = isV3 && mode === 'outlined' && !selected ? 1 : 0,
+ borderWidth = mode === 'outlined' && !selected ? 1 : 0,
borderRadius = buttonSize / 2,
} = (StyleSheet.flatten(style) || {}) as ViewStyle;
@@ -172,23 +168,31 @@ const IconButton = forwardRef(
testID={`${testID}-container`}
style={[
{
- backgroundColor,
+ backgroundColor:
+ backgroundOpacity < 1 ? undefined : backgroundColor,
width: buttonSize,
height: buttonSize,
},
styles.container,
borderStyles,
- !isV3 && disabled && styles.disabled,
style,
]}
container
- {...(isV3 && { elevation: 0 })}
+ elevation={0}
>
+ {backgroundOpacity < 1 && (
+
+ )}
(
testID={testID}
{...rest}
>
- {loading ? (
-
- ) : (
-
- )}
+
+ {loading ? (
+
+ ) : (
+
+ )}
+
);
@@ -227,9 +233,6 @@ const styles = StyleSheet.create({
justifyContent: 'center',
alignItems: 'center',
},
- disabled: {
- opacity: 0.32,
- },
});
export default IconButton;
diff --git a/src/components/IconButton/utils.ts b/src/components/IconButton/utils.ts
index e5e9d86145..653a272750 100644
--- a/src/components/IconButton/utils.ts
+++ b/src/components/IconButton/utils.ts
@@ -1,9 +1,8 @@
-import type { ColorValue } from 'react-native';
-
-import color from 'color';
-
+import { tokens } from '../../styles/themes/v3/tokens';
import type { InternalTheme } from '../../types';
+const { stateOpacity } = tokens.md.ref;
+
type IconButtonMode = 'outlined' | 'contained' | 'contained-tonal';
type BaseProps = {
@@ -13,24 +12,6 @@ type BaseProps = {
selected?: boolean;
};
-const getBorderColor = ({
- theme,
- disabled,
-}: {
- theme: InternalTheme;
- disabled?: boolean;
-}) => {
- if (theme.isV3) {
- if (disabled) {
- return theme.colors.surfaceDisabled;
- }
-
- return theme.colors.outline;
- }
-
- return undefined;
-};
-
const getBackgroundColor = ({
theme,
isMode,
@@ -38,40 +19,34 @@ const getBackgroundColor = ({
selected,
customContainerColor,
}: BaseProps & { customContainerColor?: string }) => {
- if (theme.isV3) {
- if (disabled) {
- if (isMode('contained') || isMode('contained-tonal')) {
- return theme.colors.surfaceDisabled;
- }
- }
-
- if (typeof customContainerColor !== 'undefined') {
- return customContainerColor;
+ if (disabled) {
+ if (isMode('contained') || isMode('contained-tonal')) {
+ return theme.colors.onSurface;
}
+ }
- if (isMode('contained')) {
- if (selected) {
- return theme.colors.primary;
- }
- return theme.colors.surfaceVariant;
- }
+ if (typeof customContainerColor !== 'undefined') {
+ return customContainerColor;
+ }
- if (isMode('contained-tonal')) {
- if (selected) {
- return theme.colors.secondaryContainer;
- }
- return theme.colors.surfaceVariant;
+ if (isMode('contained')) {
+ if (selected) {
+ return theme.colors.primary;
}
+ return theme.colors.surfaceVariant;
+ }
- if (isMode('outlined')) {
- if (selected) {
- return theme.colors.inverseSurface;
- }
+ if (isMode('contained-tonal')) {
+ if (selected) {
+ return theme.colors.secondaryContainer;
}
+ return theme.colors.surfaceVariant;
}
- if (typeof customContainerColor !== 'undefined') {
- return customContainerColor;
+ if (isMode('outlined')) {
+ if (selected) {
+ return theme.colors.inverseSurface;
+ }
}
return undefined;
@@ -84,65 +59,39 @@ const getIconColor = ({
selected,
customIconColor,
}: BaseProps & { customIconColor?: string }) => {
- if (theme.isV3) {
- if (disabled) {
- return theme.colors.onSurfaceDisabled;
- }
-
- if (typeof customIconColor !== 'undefined') {
- return customIconColor;
- }
-
- if (isMode('contained')) {
- if (selected) {
- return theme.colors.onPrimary;
- }
- return theme.colors.primary;
- }
+ if (disabled) {
+ return theme.colors.onSurface;
+ }
- if (isMode('contained-tonal')) {
- if (selected) {
- return theme.colors.onSecondaryContainer;
- }
- return theme.colors.onSurfaceVariant;
- }
+ if (typeof customIconColor !== 'undefined') {
+ return customIconColor;
+ }
- if (isMode('outlined')) {
- if (selected) {
- return theme.colors.inverseOnSurface;
- }
- return theme.colors.onSurfaceVariant;
+ if (isMode('contained')) {
+ if (selected) {
+ return theme.colors.onPrimary;
}
+ return theme.colors.primary;
+ }
+ if (isMode('contained-tonal')) {
if (selected) {
- return theme.colors.primary;
+ return theme.colors.onSecondaryContainer;
}
return theme.colors.onSurfaceVariant;
}
- if (typeof customIconColor !== 'undefined') {
- return customIconColor;
+ if (isMode('outlined')) {
+ if (selected) {
+ return theme.colors.inverseOnSurface;
+ }
+ return theme.colors.onSurfaceVariant;
}
- return theme.colors.text;
-};
-
-const getRippleColor = ({
- theme,
- iconColor,
- customRippleColor,
-}: {
- theme: InternalTheme;
- iconColor: string;
- customRippleColor?: ColorValue;
-}) => {
- if (customRippleColor) {
- return customRippleColor;
- }
- if (theme.isV3) {
- return color(iconColor).alpha(0.12).rgb().string();
+ if (selected) {
+ return theme.colors.primary;
}
- return color(iconColor).alpha(0.32).rgb().string();
+ return theme.colors.onSurfaceVariant;
};
export const getIconButtonColor = ({
@@ -152,7 +101,6 @@ export const getIconButtonColor = ({
selected,
customIconColor,
customContainerColor,
- customRippleColor,
}: {
theme: InternalTheme;
disabled?: boolean;
@@ -160,7 +108,6 @@ export const getIconButtonColor = ({
mode?: IconButtonMode;
customIconColor?: string;
customContainerColor?: string;
- customRippleColor?: ColorValue;
}) => {
const isMode = (modeToCompare: IconButtonMode) => {
return mode === modeToCompare;
@@ -178,13 +125,23 @@ export const getIconButtonColor = ({
customIconColor,
});
+ const iconOpacity = disabled ? stateOpacity.disabled : stateOpacity.enabled;
+
+ const backgroundColor = getBackgroundColor({
+ ...baseIconColorProps,
+ customContainerColor,
+ });
+
+ const backgroundOpacity =
+ disabled && (isMode('contained') || isMode('contained-tonal'))
+ ? stateOpacity.disabled
+ : stateOpacity.enabled;
+
return {
iconColor,
- backgroundColor: getBackgroundColor({
- ...baseIconColorProps,
- customContainerColor,
- }),
- rippleColor: getRippleColor({ theme, iconColor, customRippleColor }),
- borderColor: getBorderColor({ theme, disabled }),
+ iconOpacity,
+ backgroundColor,
+ borderColor: theme.colors.outlineVariant,
+ backgroundOpacity,
};
};
diff --git a/src/components/List/ListAccordion.tsx b/src/components/List/ListAccordion.tsx
index 75505c7367..3eaee97d61 100644
--- a/src/components/List/ListAccordion.tsx
+++ b/src/components/List/ListAccordion.tsx
@@ -1,6 +1,5 @@
import * as React from 'react';
import {
- ColorValue,
GestureResponderEvent,
I18nManager,
NativeSyntheticEvent,
@@ -93,10 +92,6 @@ export type Props = {
* Style that is passed to Description element.
*/
descriptionStyle?: StyleProp;
- /**
- * Color of the ripple effect.
- */
- rippleColor?: ColorValue;
/**
* Truncate Title text such that the total number of lines does not
* exceed this number.
@@ -186,7 +181,6 @@ const ListAccordion = ({
descriptionStyle,
titleNumberOfLines = 1,
descriptionNumberOfLines = 2,
- rippleColor: customRippleColor,
style,
containerStyle,
contentStyle,
@@ -212,9 +206,6 @@ const ListAccordion = ({
const onDescriptionTextLayout = (
event: NativeSyntheticEvent
) => {
- if (!theme.isV3) {
- return;
- }
const { nativeEvent } = event;
setAlignToTop(nativeEvent.lines.length >= 2);
};
@@ -241,12 +232,10 @@ const ListAccordion = ({
? groupContext.expandedId === id
: expandedInternal;
- const { titleColor, descriptionColor, titleTextColor, rippleColor } =
- getAccordionColors({
- theme,
- isExpanded,
- customRippleColor,
- });
+ const { descriptionColor, titleTextColor } = getAccordionColors({
+ theme,
+ isExpanded,
+ });
const handlePress =
groupContext && id !== undefined
@@ -256,11 +245,10 @@ const ListAccordion = ({
{left
? left({
color: isExpanded ? theme.colors?.primary : descriptionColor,
- style: getLeftStyles(alignToTop, description, theme.isV3),
+ style: getLeftStyles(alignToTop, description),
})
: null}
-
+
{right ? (
right({
@@ -329,7 +314,7 @@ const ListAccordion = ({
) : (
@@ -348,10 +333,7 @@ const ListAccordion = ({
!child.props.right
) {
return React.cloneElement(child, {
- style: [
- theme.isV3 ? styles.childV3 : styles.child,
- child.props.style,
- ],
+ style: [styles.child, child.props.style],
theme,
});
}
@@ -367,17 +349,10 @@ ListAccordion.displayName = 'List.Accordion';
const styles = StyleSheet.create({
container: {
- padding: 8,
- },
- containerV3: {
paddingVertical: 8,
paddingRight: 24,
},
row: {
- flexDirection: 'row',
- alignItems: 'center',
- },
- rowV3: {
flexDirection: 'row',
marginVertical: 6,
},
@@ -392,17 +367,14 @@ const styles = StyleSheet.create({
description: {
fontSize: 14,
},
- item: {
+ contentItem: {
+ paddingLeft: 16,
+ },
+ trailingItem: {
marginVertical: 6,
paddingLeft: 8,
},
- itemV3: {
- paddingLeft: 16,
- },
child: {
- paddingLeft: 64,
- },
- childV3: {
paddingLeft: 40,
},
content: {
diff --git a/src/components/List/ListIcon.tsx b/src/components/List/ListIcon.tsx
index f1c7194c43..108d642383 100644
--- a/src/components/List/ListIcon.tsx
+++ b/src/components/List/ListIcon.tsx
@@ -51,10 +51,7 @@ const ListIcon = ({
const theme = useInternalTheme(themeOverrides);
return (
-
+
);
@@ -62,13 +59,6 @@ const ListIcon = ({
const styles = StyleSheet.create({
item: {
- margin: 8,
- height: 40,
- width: 40,
- alignItems: 'center',
- justifyContent: 'center',
- },
- itemV3: {
alignItems: 'center',
justifyContent: 'center',
},
diff --git a/src/components/List/ListImage.tsx b/src/components/List/ListImage.tsx
index 9839be7b02..8eb887bddc 100644
--- a/src/components/List/ListImage.tsx
+++ b/src/components/List/ListImage.tsx
@@ -7,7 +7,6 @@ import {
ImageStyle,
} from 'react-native';
-import { useInternalTheme } from '../../core/theming';
import type { ThemeProp } from '../../types';
export type Props = {
@@ -42,16 +41,11 @@ const ListImage = ({
style,
source,
variant = 'image',
- theme: themeOverrides,
+ theme: _theme,
}: Props) => {
- const theme = useInternalTheme(themeOverrides);
const getStyles = () => {
if (variant === 'video') {
- if (!theme.isV3) {
- return [style, styles.video];
- }
-
- return [style, styles.videoV3];
+ return [style, styles.video];
}
return [style, styles.image];
@@ -73,11 +67,6 @@ const styles = StyleSheet.create({
height: 56,
},
video: {
- width: 100,
- height: 64,
- marginLeft: 0,
- },
- videoV3: {
width: 114,
height: 64,
marginLeft: 0,
diff --git a/src/components/List/ListItem.tsx b/src/components/List/ListItem.tsx
index 467eb9b67a..c50d075744 100644
--- a/src/components/List/ListItem.tsx
+++ b/src/components/List/ListItem.tsx
@@ -10,8 +10,6 @@ import {
ViewStyle,
} from 'react-native';
-import color from 'color';
-
import { Style, getLeftStyles, getRightStyles } from './utils';
import { useInternalTheme } from '../../core/theming';
import type { $RemoveChildren, EllipsizeProp, ThemeProp } from '../../types';
@@ -169,9 +167,6 @@ const ListItem = (
const onDescriptionTextLayout = (
event: NativeSyntheticEvent
) => {
- if (!theme.isV3) {
- return;
- }
const { nativeEvent } = event;
setAlignToTop(nativeEvent.lines.length >= 2);
};
@@ -206,9 +201,7 @@ const ListItem = (
};
const renderTitle = () => {
- const titleColor = theme.isV3
- ? theme.colors.onSurface
- : color(theme.colors.text).alpha(0.87).rgb().string();
+ const titleColor = theme.colors.onSurface;
return typeof title === 'function' ? (
title({
@@ -230,32 +223,26 @@ const ListItem = (
);
};
- const descriptionColor = theme.isV3
- ? theme.colors.onSurfaceVariant
- : color(theme.colors.text).alpha(0.54).rgb().string();
+ const descriptionColor = theme.colors.onSurfaceVariant;
return (
-
+
{left
? left({
color: descriptionColor,
- style: getLeftStyles(alignToTop, description, theme.isV3),
+ style: getLeftStyles(alignToTop, description),
})
: null}
{renderTitle()}
@@ -267,7 +254,7 @@ const ListItem = (
{right
? right({
color: descriptionColor,
- style: getRightStyles(alignToTop, description, theme.isV3),
+ style: getRightStyles(alignToTop, description),
})
: null}
@@ -280,19 +267,12 @@ const Component = forwardRef(ListItem);
const styles = StyleSheet.create({
container: {
- padding: 8,
- },
- containerV3: {
paddingVertical: 8,
paddingRight: 24,
},
row: {
width: '100%',
flexDirection: 'row',
- },
- rowV3: {
- width: '100%',
- flexDirection: 'row',
marginVertical: 6,
},
title: {
@@ -302,10 +282,6 @@ const styles = StyleSheet.create({
fontSize: 14,
},
item: {
- marginVertical: 6,
- paddingLeft: 8,
- },
- itemV3: {
paddingLeft: 16,
},
content: {
diff --git a/src/components/List/ListSubheader.tsx b/src/components/List/ListSubheader.tsx
index 038b86a86e..38e0a9d41f 100644
--- a/src/components/List/ListSubheader.tsx
+++ b/src/components/List/ListSubheader.tsx
@@ -1,7 +1,6 @@
import * as React from 'react';
import { StyleProp, StyleSheet, TextStyle } from 'react-native';
-import color from 'color';
import type { ThemeProp } from 'src/types';
import { useInternalTheme } from '../../core/theming';
@@ -43,11 +42,9 @@ const ListSubheader = ({
}: Props) => {
const theme = useInternalTheme(overrideTheme);
- const textColor = theme.isV3
- ? theme.colors.onSurfaceVariant
- : color(theme.colors.text).alpha(0.54).rgb().string();
+ const textColor = theme.colors.onSurfaceVariant;
- const font = theme.isV3 ? theme.fonts.bodyMedium : theme.fonts.medium;
+ const font = theme.fonts.bodyMedium;
return (
{
- const stylesV3 = {
- marginRight: 0,
- marginLeft: 16,
+ const stylesV3: Style = {
+ ...stylesV3Left,
alignSelf: alignToTop ? 'flex-start' : 'center',
};
@@ -47,14 +47,10 @@ export const getLeftStyles = (
return {
...styles.iconMarginLeft,
...styles.marginVerticalNone,
- ...(isV3 && { ...stylesV3 }),
+ ...stylesV3,
};
}
- if (!isV3) {
- return styles.iconMarginLeft;
- }
-
return {
...styles.iconMarginLeft,
...stylesV3,
@@ -63,11 +59,10 @@ export const getLeftStyles = (
export const getRightStyles = (
alignToTop: boolean,
- description: Description,
- isV3: boolean
+ description: Description
) => {
- const stylesV3 = {
- marginLeft: 16,
+ const stylesV3: Style = {
+ ...stylesV3Right,
alignSelf: alignToTop ? 'flex-start' : 'center',
};
@@ -75,14 +70,10 @@ export const getRightStyles = (
return {
...styles.iconMarginRight,
...styles.marginVerticalNone,
- ...(isV3 && { ...stylesV3 }),
+ ...stylesV3,
};
}
- if (!isV3) {
- return styles.iconMarginRight;
- }
-
return {
...styles.iconMarginRight,
...stylesV3,
@@ -98,29 +89,18 @@ const styles = StyleSheet.create({
export const getAccordionColors = ({
theme,
isExpanded,
- customRippleColor,
}: {
theme: InternalTheme;
isExpanded?: boolean;
- customRippleColor?: ColorValue;
}) => {
- const titleColor = theme.isV3
- ? theme.colors.onSurface
- : color(theme.colors.text).alpha(0.87).rgb().string();
+ const titleColor = theme.colors.onSurface;
- const descriptionColor = theme.isV3
- ? theme.colors.onSurfaceVariant
- : color(theme.colors.text).alpha(0.54).rgb().string();
+ const descriptionColor = theme.colors.onSurfaceVariant;
const titleTextColor = isExpanded ? theme.colors?.primary : titleColor;
- const rippleColor =
- customRippleColor || color(titleTextColor).alpha(0.12).rgb().string();
-
return {
- titleColor,
descriptionColor,
titleTextColor,
- rippleColor,
};
};
diff --git a/src/components/Menu/Menu.tsx b/src/components/Menu/Menu.tsx
index 956b362562..9ac794021b 100644
--- a/src/components/Menu/Menu.tsx
+++ b/src/components/Menu/Menu.tsx
@@ -23,7 +23,7 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context';
import MenuItem from './MenuItem';
import { useInternalTheme } from '../../core/theming';
-import type { MD3Elevation, ThemeProp } from '../../types';
+import type { MD3Elevation, MD3Theme, ThemeProp } from '../../types';
import { ElevationLevels } from '../../types';
import { addEventListener } from '../../utils/addEventListener';
import { BackHandler } from '../../utils/BackHandler/BackHandler';
@@ -196,6 +196,7 @@ const Menu = ({
keyboardShouldPersistTaps,
}: Props) => {
const theme = useInternalTheme(themeOverrides);
+ const { colors: md3Colors } = theme as MD3Theme;
const insets = useSafeAreaInsets();
const [rendered, setRendered] = React.useState(visible);
const [left, setLeft] = React.useState(0);
@@ -618,7 +619,6 @@ const Menu = ({
},
],
borderRadius: theme.roundness,
- ...(!theme.isV3 && { elevation: 8 }),
...(scrollableMenuHeight ? { height: scrollableMenuHeight } : {}),
};
@@ -673,13 +673,13 @@ const Menu = ({
style={[
styles.shadowMenuContainer,
shadowMenuContainerStyle,
- theme.isV3 && {
+ {
backgroundColor:
- theme.colors.elevation[ELEVATION_LEVELS_MAP[elevation]],
+ md3Colors.elevation[ELEVATION_LEVELS_MAP[elevation]],
},
contentStyle,
]}
- {...(theme.isV3 && { elevation })}
+ elevation={elevation}
testID={`${testID}-surface`}
theme={theme}
container
diff --git a/src/components/Menu/MenuItem.tsx b/src/components/Menu/MenuItem.tsx
index 4b8eb3740a..ac77147031 100644
--- a/src/components/Menu/MenuItem.tsx
+++ b/src/components/Menu/MenuItem.tsx
@@ -1,7 +1,6 @@
import * as React from 'react';
import {
AccessibilityState,
- ColorValue,
GestureResponderEvent,
PressableAndroidRippleConfig,
StyleProp,
@@ -18,7 +17,7 @@ import {
MIN_WIDTH,
} from './utils';
import { useInternalTheme } from '../../core/theming';
-import type { ThemeProp } from '../../types';
+import type { MD3Theme, ThemeProp } from '../../types';
import Icon, { IconSource } from '../Icon';
import TouchableRipple, {
Props as TouchableRippleProps,
@@ -82,10 +81,6 @@ export type Props = {
* Style that is passed to the Title element.
*/
titleStyle?: StyleProp;
- /**
- * Color of the ripple effect.
- */
- rippleColor?: ColorValue;
/**
* @optional
*/
@@ -142,7 +137,6 @@ const MenuItem = ({
containerStyle,
contentStyle,
titleStyle,
- rippleColor: customRippleColor,
testID = 'menu-item',
accessibilityLabel,
accessibilityState,
@@ -151,21 +145,17 @@ const MenuItem = ({
hitSlop,
}: Props) => {
const theme = useInternalTheme(themeOverrides);
- const { titleColor, iconColor, rippleColor } = getMenuItemColor({
+ const { titleColor, iconColor, contentOpacity } = getMenuItemColor({
theme,
disabled,
- customRippleColor,
});
- const { isV3 } = theme;
+ const containerPadding = 12;
- const containerPadding = isV3 ? 12 : 8;
+ const iconWidth = 24;
- const iconWidth = isV3 ? 24 : 40;
-
- const minWidth = MIN_WIDTH - (isV3 ? 12 : 16);
+ const minWidth = MIN_WIDTH - 12;
const maxWidth = getContentMaxWidth({
- isV3,
iconWidth,
leadingIcon,
trailingIcon,
@@ -173,7 +163,7 @@ const MenuItem = ({
const titleTextStyle = {
color: titleColor,
- ...(isV3 ? theme.fonts.bodyLarge : {}),
+ ...(theme as MD3Theme).fonts.bodyLarge,
};
const newAccessibilityState = { ...accessibilityState, disabled };
@@ -193,27 +183,19 @@ const MenuItem = ({
accessibilityLabel={accessibilityLabel}
accessibilityRole="menuitem"
accessibilityState={newAccessibilityState}
- rippleColor={rippleColor}
hitSlop={hitSlop}
>
-
+
{leadingIcon ? (
-
+
) : null}
{title}
- {isV3 && trailingIcon ? (
-
+ {trailingIcon ? (
+
) : null}
@@ -257,12 +236,6 @@ const styles = StyleSheet.create({
row: {
flexDirection: 'row',
},
- title: {
- fontSize: 16,
- },
- item: {
- marginHorizontal: 8,
- },
content: {
justifyContent: 'center',
},
diff --git a/src/components/Menu/utils.ts b/src/components/Menu/utils.ts
index c1b6189ba4..f9e3d5d9a1 100644
--- a/src/components/Menu/utils.ts
+++ b/src/components/Menu/utils.ts
@@ -1,16 +1,13 @@
-import type { ColorValue } from 'react-native';
-
-import color from 'color';
-
-import { black, white } from '../../styles/themes/v2/colors';
+import { tokens } from '../../styles/themes/v3/tokens';
import type { InternalTheme } from '../../types';
import type { IconSource } from '../Icon';
+const { stateOpacity } = tokens.md.ref;
+
export const MIN_WIDTH = 112;
export const MAX_WIDTH = 280;
type ContentProps = {
- isV3: boolean;
iconWidth: number;
leadingIcon?: IconSource;
trailingIcon?: IconSource;
@@ -19,92 +16,40 @@ type ContentProps = {
type ColorProps = {
theme: InternalTheme;
disabled?: boolean;
- customRippleColor?: ColorValue;
};
-const getDisabledColor = (theme: InternalTheme) => {
- if (theme.isV3) {
- return theme.colors.onSurfaceDisabled;
- }
-
- return color(theme.dark ? white : black)
- .alpha(0.32)
- .rgb()
- .string();
-};
-
-const getTitleColor = ({ theme, disabled }: ColorProps) => {
- if (disabled) {
- return getDisabledColor(theme);
- }
-
- if (theme.isV3) {
- return theme.colors.onSurface;
- }
-
- return color(theme.colors.text).alpha(0.87).rgb().string();
+const getTitleColor = ({ theme }: ColorProps) => {
+ return theme.colors.onSurface;
};
-const getIconColor = ({ theme, disabled }: ColorProps) => {
- if (disabled) {
- return getDisabledColor(theme);
- }
-
- if (theme.isV3) {
- return theme.colors.onSurfaceVariant;
- }
-
- return color(theme.colors.text).alpha(0.54).rgb().string();
+const getIconColor = ({ theme }: ColorProps) => {
+ return theme.colors.onSurfaceVariant;
};
-const getRippleColor = ({
- theme,
- customRippleColor,
-}: Omit) => {
- if (customRippleColor) {
- return customRippleColor;
- }
+export const getMenuItemColor = ({ theme, disabled }: ColorProps) => {
+ const contentOpacity = disabled
+ ? stateOpacity.disabled
+ : stateOpacity.enabled;
- if (theme.isV3) {
- return color(theme.colors.onSurfaceVariant).alpha(0.12).rgb().string();
- }
-
- return undefined;
-};
-
-export const getMenuItemColor = ({
- theme,
- disabled,
- customRippleColor,
-}: ColorProps) => {
return {
titleColor: getTitleColor({ theme, disabled }),
iconColor: getIconColor({ theme, disabled }),
- rippleColor: getRippleColor({ theme, customRippleColor }),
+ contentOpacity,
};
};
export const getContentMaxWidth = ({
- isV3,
iconWidth,
leadingIcon,
trailingIcon,
}: ContentProps) => {
- if (isV3) {
- if (leadingIcon && trailingIcon) {
- return MAX_WIDTH - (2 * iconWidth + 24);
- }
-
- if (leadingIcon || trailingIcon) {
- return MAX_WIDTH - (iconWidth + 24);
- }
-
- return MAX_WIDTH - 12;
+ if (leadingIcon && trailingIcon) {
+ return MAX_WIDTH - (2 * iconWidth + 24);
}
- if (leadingIcon) {
- return MAX_WIDTH - (iconWidth + 48);
+ if (leadingIcon || trailingIcon) {
+ return MAX_WIDTH - (iconWidth + 24);
}
- return MAX_WIDTH - 16;
+ return MAX_WIDTH - 12;
};
diff --git a/src/components/Modal.tsx b/src/components/Modal.tsx
index dc55c3cf7a..21b1ffd39d 100644
--- a/src/components/Modal.tsx
+++ b/src/components/Modal.tsx
@@ -14,11 +14,14 @@ import useLatestCallback from 'use-latest-callback';
import Surface from './Surface';
import { useInternalTheme } from '../core/theming';
+import { tokens } from '../styles/themes/v3/tokens';
import type { ThemeProp } from '../types';
import { addEventListener } from '../utils/addEventListener';
import { BackHandler } from '../utils/BackHandler/BackHandler';
import useAnimatedValue from '../utils/useAnimatedValue';
+const { scrimAlpha } = tokens.md.ref;
+
export type Props = {
/**
* Determines whether clicking outside the modal dismisses it.
@@ -201,8 +204,11 @@ function Modal({
style={[
styles.backdrop,
{
- backgroundColor: theme.colors?.backdrop,
- opacity,
+ backgroundColor: theme.colors.scrim,
+ opacity: opacity.interpolate({
+ inputRange: [0, 1],
+ outputRange: [0, scrimAlpha],
+ }),
},
]}
testID={`${testID}-backdrop`}
diff --git a/src/components/ProgressBar.tsx b/src/components/ProgressBar.tsx
index 790204f4f8..c307df2479 100644
--- a/src/components/ProgressBar.tsx
+++ b/src/components/ProgressBar.tsx
@@ -10,8 +10,6 @@ import {
ViewStyle,
} from 'react-native';
-import setColor from 'color';
-
import { useInternalTheme } from '../core/theming';
import type { ThemeProp } from '../types';
@@ -191,9 +189,7 @@ const ProgressBar = ({
};
const tintColor = color || theme.colors?.primary;
- const trackTintColor = theme.isV3
- ? theme.colors.surfaceVariant
- : setColor(tintColor).alpha(0.38).rgb().string();
+ const trackTintColor = theme.colors.surfaceVariant;
return (
;
}
- const textColor = theme.isV3 ? theme.colors.onSurface : theme.colors.text;
- const disabledTextColor = theme.isV3
- ? theme.colors.onSurfaceDisabled
- : theme.colors.disabled;
+ const textColor = theme.colors.onSurface;
const textAlign = isLeading ? 'right' : 'left';
const computedStyle = {
- color: disabled ? disabledTextColor : textColor,
+ color: textColor,
+ opacity: disabled
+ ? tokens.md.ref.stateOpacity.disabled
+ : tokens.md.ref.stateOpacity.enabled,
textAlign,
} as TextStyle;
@@ -225,19 +220,13 @@ const RadioButtonItem = ({
disabled={disabled}
background={background}
theme={theme}
- rippleColor={rippleColor}
hitSlop={hitSlop}
>
{isLeading && radioButton}
{label}
@@ -270,7 +259,4 @@ const styles = StyleSheet.create({
flexShrink: 1,
flexGrow: 1,
},
- font: {
- fontSize: 16,
- },
});
diff --git a/src/components/Searchbar.tsx b/src/components/Searchbar.tsx
index 891df22945..fd608740de 100644
--- a/src/components/Searchbar.tsx
+++ b/src/components/Searchbar.tsx
@@ -1,7 +1,6 @@
import * as React from 'react';
import {
Animated,
- ColorValue,
GestureResponderEvent,
I18nManager,
Platform,
@@ -14,8 +13,6 @@ import {
ViewStyle,
} from 'react-native';
-import color from 'color';
-
import ActivityIndicator from './ActivityIndicator';
import Divider from './Divider';
import type { IconSource } from './Icon';
@@ -23,7 +20,7 @@ import IconButton from './IconButton/IconButton';
import MaterialCommunityIcon from './MaterialCommunityIcon';
import Surface from './Surface';
import { useInternalTheme } from '../core/theming';
-import type { ThemeProp } from '../types';
+import type { MD3Theme, ThemeProp } from '../types';
import { forwardRef } from '../utils/forwardRef';
interface Style {
@@ -56,10 +53,6 @@ export type Props = React.ComponentPropsWithRef & {
* Custom color for icon, default will be derived from theme
*/
iconColor?: string;
- /**
- * Color of the ripple effect.
- */
- rippleColor?: ColorValue;
/**
* Callback to execute if we want the left icon to act as button.
*/
@@ -94,12 +87,6 @@ export type Props = React.ComponentPropsWithRef & {
*/
traileringIconColor?: string;
/**
- * @supported Available in v5.x with theme version 3
- * Color of the trailering icon ripple effect.
- */
- traileringRippleColor?: ColorValue;
- /**
- * @supported Available in v5.x with theme version 3
* Callback to execute on the right trailering icon button press.
*/
onTraileringIconPress?: (e: GestureResponderEvent) => void;
@@ -181,7 +168,6 @@ const Searchbar = forwardRef(
{
icon,
iconColor: customIconColor,
- rippleColor: customRippleColor,
onIconPress,
searchAccessibilityLabel = 'search',
clearIcon,
@@ -190,7 +176,6 @@ const Searchbar = forwardRef(
traileringIcon,
traileringIconColor,
traileringIconAccessibilityLabel,
- traileringRippleColor: customTraileringRippleColor,
onTraileringIconPress,
right,
mode = 'bar',
@@ -208,6 +193,7 @@ const Searchbar = forwardRef(
ref
) => {
const theme = useInternalTheme(themeOverrides);
+ const { colors, fonts } = theme as MD3Theme;
const root = React.useRef(null);
React.useImperativeHandle(ref, () => ({
@@ -227,34 +213,21 @@ const Searchbar = forwardRef(
onClearIconPress?.(e);
};
- const { roundness, dark, isV3, fonts } = theme;
+ const { roundness, dark } = theme;
- const placeholderTextColor = isV3
- ? theme.colors.onSurface
- : theme.colors?.placeholder;
- const textColor = isV3 ? theme.colors.onSurfaceVariant : theme.colors.text;
- const md2IconColor = dark
- ? textColor
- : color(textColor).alpha(0.54).rgb().string();
- const iconColor =
- customIconColor || (isV3 ? theme.colors.onSurfaceVariant : md2IconColor);
- const rippleColor =
- customRippleColor || color(textColor).alpha(0.32).rgb().string();
- const traileringRippleColor =
- customTraileringRippleColor ||
- color(textColor).alpha(0.32).rgb().string();
+ const placeholderTextColor = theme.colors.onSurface;
+ const textColor = theme.colors.onSurfaceVariant;
+ const iconColor = customIconColor || theme.colors.onSurfaceVariant;
- const font = isV3
- ? {
- ...fonts.bodyLarge,
- lineHeight: Platform.select({
- ios: 0,
- default: fonts.bodyLarge.lineHeight,
- }),
- }
- : theme.fonts.regular;
+ const font = {
+ ...fonts.bodyLarge,
+ lineHeight: Platform.select({
+ ios: 0,
+ default: fonts.bodyLarge.lineHeight,
+ }),
+ };
- const isBarMode = isV3 && mode === 'bar';
+ const isBarMode = mode === 'bar';
const shouldRenderTraileringIcon =
isBarMode &&
traileringIcon &&
@@ -265,23 +238,21 @@ const Searchbar = forwardRef(
(
...font,
...Platform.select({ web: { outline: 'none' } }),
},
- isV3 && (isBarMode ? styles.barModeInput : styles.viewModeInput),
+ isBarMode ? styles.barModeInput : styles.viewModeInput,
inputStyle,
]}
placeholder={placeholder || ''}
placeholderTextColor={placeholderTextColor}
- selectionColor={theme.colors?.primary}
+ selectionColor={colors.primary}
underlineColorAndroid="transparent"
returnKeyType="search"
keyboardAppearance={dark ? 'dark' : 'light'}
@@ -325,7 +296,7 @@ const Searchbar = forwardRef(
{loading ? (
) : (
// Clear icon should be always rendered within Searchbar – it's transparent,
@@ -336,21 +307,20 @@ const Searchbar = forwardRef(
pointerEvents={value ? 'auto' : 'none'}
testID={`${testID}-icon-wrapper`}
style={[
- isV3 && !value && styles.v3ClearIcon,
- isV3 && right !== undefined && styles.v3ClearIconHidden,
+ !value && styles.v3ClearIcon,
+ right !== undefined && styles.v3ClearIconHidden,
]}
>
(
(
borderless
onPress={onTraileringIconPress}
iconColor={traileringIconColor || theme.colors.onSurfaceVariant}
- rippleColor={traileringRippleColor}
icon={traileringIcon}
accessibilityLabel={traileringIconAccessibilityLabel}
testID={`${testID}-trailering-icon`}
@@ -377,13 +346,13 @@ const Searchbar = forwardRef(
) : null}
{isBarMode &&
right?.({ color: textColor, style: styles.rightStyle, testID })}
- {isV3 && !isBarMode && showDivider && (
+ {!isBarMode && showDivider && (
-
+
{showCheckedIcon ? (
{
if (checked) {
- if (theme.isV3) {
- return theme.colors.secondaryContainer;
- } else {
- return color(theme.colors.primary).alpha(0.12).rgb().string();
- }
+ return theme.colors.secondaryContainer;
}
return 'transparent';
};
-const getSegmentedButtonBorderColor = ({
- theme,
- disabled,
- checked,
-}: BaseProps) => {
- if (theme.isV3) {
- if (disabled) {
- return theme.colors.surfaceDisabled;
- }
- return theme.colors.outline;
- }
- if (checked) {
- return theme.colors.primary;
+const getSegmentedButtonBorderColor = ({ theme, disabled }: BaseProps) => {
+ if (disabled) {
+ return theme.colors.outlineVariant;
}
-
- return color(theme.dark ? white : black)
- .alpha(0.29)
- .rgb()
- .string();
+ return theme.colors.outline;
};
const getSegmentedButtonBorderWidth = ({
- theme,
+ theme: _t,
}: Omit) => {
- if (theme.isV3) {
- return 1;
- }
-
- return StyleSheet.hairlineWidth;
+ return 1;
};
const getSegmentedButtonTextColor = ({
@@ -133,21 +110,13 @@ const getSegmentedButtonTextColor = ({
checkedColor,
uncheckedColor,
}: SegmentedButtonProps) => {
- if (theme.isV3) {
- if (disabled) {
- return theme.colors.onSurfaceDisabled;
- }
- if (checked) {
- return checkedColor ?? theme.colors.onSecondaryContainer;
- }
- return uncheckedColor ?? theme.colors.onSurface;
- }
-
if (disabled) {
- return theme.colors.disabled;
+ return theme.colors.onSurface;
+ }
+ if (checked) {
+ return checkedColor ?? theme.colors.onSecondaryContainer;
}
- // Primary color is used for checked state too.
- return theme.colors.primary;
+ return uncheckedColor ?? theme.colors.onSurface;
};
export const getSegmentedButtonColors = ({
@@ -175,5 +144,7 @@ export const getSegmentedButtonColors = ({
});
const borderWidth = getSegmentedButtonBorderWidth({ theme });
- return { backgroundColor, borderColor, textColor, borderWidth };
+ const textOpacity = disabled ? stateOpacity.disabled : stateOpacity.enabled;
+
+ return { backgroundColor, borderColor, textColor, textOpacity, borderWidth };
};
diff --git a/src/components/Snackbar.tsx b/src/components/Snackbar.tsx
index d11bc91a62..6151e23ae2 100644
--- a/src/components/Snackbar.tsx
+++ b/src/components/Snackbar.tsx
@@ -1,7 +1,6 @@
import * as React from 'react';
import {
Animated,
- ColorValue,
Easing,
I18nManager,
StyleProp,
@@ -20,7 +19,7 @@ import MaterialCommunityIcon from './MaterialCommunityIcon';
import Surface from './Surface';
import Text from './Typography/Text';
import { useInternalTheme } from '../core/theming';
-import type { $Omit, $RemoveChildren, ThemeProp } from '../types';
+import type { $Omit, $RemoveChildren, MD3Theme, ThemeProp } from '../types';
export type Props = $Omit, 'mode'> & {
/**
@@ -41,12 +40,6 @@ export type Props = $Omit, 'mode'> & {
*/
icon?: IconSource;
/**
- * @supported Available in v5.x with theme version 3
- * Color of the ripple effect.
- */
- rippleColor?: ColorValue;
- /**
- * @supported Available in v5.x with theme version 3
* Function to execute on icon button press. The icon button appears only when this prop is specified.
*/
onIconPress?: () => void;
@@ -161,7 +154,6 @@ const Snackbar = ({
contentStyle,
theme: themeOverrides,
maxFontSizeMultiplier,
- rippleColor,
testID,
...rest
}: Props) => {
@@ -243,7 +235,7 @@ const Snackbar = ({
}
}, [visible, handleOnVisible, handleOnHidden]);
- const { colors, roundness, isV3 } = theme;
+ const { colors, roundness } = theme as MD3Theme;
if (hidden) {
return null;
@@ -253,15 +245,14 @@ const Snackbar = ({
style: actionStyle,
label: actionLabel,
onPress: onPressAction,
- rippleColor: actionRippleColor,
...actionProps
} = action || {};
- const buttonTextColor = isV3 ? colors.inversePrimary : colors.accent;
- const textColor = isV3 ? colors.inverseOnSurface : colors?.surface;
- const backgroundColor = isV3 ? colors.inverseSurface : colors?.onSurface;
+ const buttonTextColor = colors.inversePrimary;
+ const textColor = colors.inverseOnSurface;
+ const backgroundColor = colors.inverseSurface;
- const isIconButton = isV3 && onIconPress;
+ const isIconButton = Boolean(onIconPress);
const marginLeft = action ? -12 : -16;
@@ -301,7 +292,6 @@ const Snackbar = ({
accessibilityLiveRegion="polite"
theme={theme}
style={[
- !isV3 && styles.elevation,
styles.container,
{
backgroundColor,
@@ -322,7 +312,7 @@ const Snackbar = ({
]}
testID={testID}
container
- {...(isV3 && { elevation })}
+ elevation={elevation}
{...rest}
>
{renderChildrenWithWrapper()}
@@ -336,10 +326,9 @@ const Snackbar = ({
}}
style={[styles.button, actionStyle]}
textColor={buttonTextColor}
- compact={!isV3}
+ compact={false}
mode="text"
theme={theme}
- rippleColor={actionRippleColor}
{...actionProps}
>
{actionLabel}
@@ -351,7 +340,6 @@ const Snackbar = ({
borderless
onPress={onIconPress}
iconColor={theme.colors.inverseOnSurface}
- rippleColor={rippleColor}
theme={theme}
icon={
icon ||
@@ -423,9 +411,6 @@ const styles = StyleSheet.create({
marginRight: 8,
marginLeft: 4,
},
- elevation: {
- elevation: 6,
- },
icon: {
width: 40,
height: 40,
diff --git a/src/components/Surface.tsx b/src/components/Surface.tsx
index 3b46d099e1..2c8fad2461 100644
--- a/src/components/Surface.tsx
+++ b/src/components/Surface.tsx
@@ -10,9 +10,9 @@ import {
} from 'react-native';
import { useInternalTheme } from '../core/theming';
-import overlay, { isAnimatedValue } from '../styles/overlay';
+import { isAnimatedValue } from '../styles/overlay';
import shadow from '../styles/shadow';
-import type { ThemeProp, MD3Elevation } from '../types';
+import type { MD3Elevation, MD3Theme, ThemeProp } from '../types';
import { forwardRef } from '../utils/forwardRef';
import { splitStyles } from '../utils/splitStyles';
@@ -57,30 +57,6 @@ export type Props = Omit, 'style'> & {
container?: boolean;
};
-const MD2Surface = forwardRef(
- ({ style, theme: overrideTheme, ...rest }: Omit, ref) => {
- const { elevation = 4 } = (StyleSheet.flatten(style) || {}) as ViewStyle;
- const { dark: isDarkTheme, mode, colors } = useInternalTheme(overrideTheme);
-
- return (
-
- );
- }
-);
-
const outerLayerStyleProperties: (keyof ViewStyle)[] = [
'position',
'alignSelf',
@@ -277,14 +253,7 @@ const Surface = forwardRef(
) => {
const theme = useInternalTheme(overridenTheme);
- if (!theme.isV3)
- return (
-
- {children}
-
- );
-
- const { colors } = theme;
+ const { colors } = theme as MD3Theme;
const inputRange = [0, 1, 2, 3, 4, 5];
@@ -313,7 +282,7 @@ const Surface = forwardRef(
testID={testID}
style={[
{ backgroundColor },
- elevation && isElevated ? shadow(elevation, theme.isV3) : null,
+ elevation && isElevated ? shadow(elevation) : null,
style,
]}
>
diff --git a/src/components/Switch/utils.ts b/src/components/Switch/utils.ts
index 2994495af9..c0afc7c142 100644
--- a/src/components/Switch/utils.ts
+++ b/src/components/Switch/utils.ts
@@ -29,11 +29,7 @@ const getCheckedColor = ({
return color;
}
- if (theme.isV3) {
- return theme.colors.primary;
- }
-
- return theme.colors.accent;
+ return theme.colors.primary;
};
const getThumbTintColor = ({
@@ -79,16 +75,13 @@ const getOnTintColor = ({
if (disabled) {
if (theme.dark) {
- if (theme.isV3) {
- return setColor(white).alpha(0.06).rgb().string();
- }
- return setColor(white).alpha(0.1).rgb().string();
+ return setColor(white).alpha(0.06).rgb().string();
}
return setColor(black).alpha(0.12).rgb().string();
}
if (value) {
- return setColor(checkedColor).alpha(0.5).rgb().string();
+ return theme.colors.surfaceContainerHighest;
}
if (theme.dark) {
diff --git a/src/components/TextField/TextField.tsx b/src/components/TextField/TextField.tsx
new file mode 100644
index 0000000000..abab35a6f1
--- /dev/null
+++ b/src/components/TextField/TextField.tsx
@@ -0,0 +1,293 @@
+import React, { ComponentType } from 'react';
+import {
+ Animated,
+ Pressable,
+ StyleProp,
+ Text,
+ TextInput,
+ TextInputProps,
+ TextProps,
+ TextStyle,
+ View,
+ ViewStyle,
+} from 'react-native';
+
+import { useTextField } from './logic';
+import type { InternalTheme, ThemeProp } from '../../types';
+
+export type TextFieldVariant = 'filled' | 'outlined';
+
+export interface TextFieldAccessoryProps {
+ style: StyleProp;
+ status?: 'error' | 'disabled';
+ multiline: boolean;
+ editable: boolean;
+}
+
+export type TextFieldSharedApi = {
+ input: React.RefObject;
+ theme: InternalTheme;
+ isFocused: boolean;
+ disabled: boolean;
+ hasAccessory: boolean;
+ hasError: boolean;
+ $animatedLabelWrapperStyle: Animated.WithAnimatedObject;
+ $animatedLabelTextStyle: Animated.WithAnimatedObject;
+ $animatedPlaceholderStyle: Animated.WithAnimatedObject;
+ $animatedActiveOutlineStyle?: Animated.WithAnimatedObject;
+};
+
+export interface TextFieldProps extends TextInputProps {
+ /**
+ * Ref forwarded to the underlying TextInput.
+ */
+ ref?: React.Ref;
+ /**
+ * - `filled` text fields are often used in dialogs and short forms where their style draws more attention.
+ * - `outlined` text fields are often used in long forms where their reduced emphasis helps simplify the layout.
+ */
+ variant?: TextFieldVariant;
+ /**
+ * A style modifier for different input states.
+ */
+ status?: 'error' | 'disabled';
+ /**
+ * The label text to display above the input.
+ */
+ label?: string;
+ /**
+ * Pass any additional props directly to the label Text component.
+ */
+ labelProps?: TextProps;
+ /**
+ * Supporting text to display below the input (Material Design 3). When
+ * `status` is `error`, this text is styled as an error message.
+ */
+ supportingText?: string;
+ /**
+ * Pass any additional props directly to the supporting text `Text` component.
+ */
+ supportingTextProps?: TextProps;
+ /**
+ * Style overrides for the pressable root element.
+ */
+ pressableStyle?: StyleProp;
+ /**
+ * Style overrides for the field container (the bordered row that includes
+ * LeftAccessory, input content, and RightAccessory).
+ */
+ fieldStyle?: StyleProp;
+ /**
+ * Style overrides for the input content wrapper (the area containing
+ * the label and TextInput, excluding accessories).
+ */
+ containerStyle?: StyleProp;
+ theme?: ThemeProp;
+ /**
+ * An optional component to render on the right side of the input.
+ */
+ RightAccessory?: ComponentType;
+ /**
+ * An optional component to render on the left side of the input.
+ */
+ LeftAccessory?: ComponentType;
+}
+
+/**
+ * A text field lets users enter and edit text. It shows an optional floating label,
+ * supports `filled` and `outlined` variants, optional supporting text (including
+ * error state), and left/right accessories.
+ *
+ * ## Usage
+ * ```js
+ * import * as React from 'react';
+ * import { Pressable, View } from 'react-native';
+ * import { Icon, TextField } from 'react-native-paper';
+ *
+ * const MyComponent = () => {
+ * const [text, setText] = React.useState('');
+ *
+ * const LeadingAccessory = ({ style }) => (
+ *
+ *
+ *
+ * );
+ *
+ * const TrailingAccessory = ({ style, editable }) => (
+ * setText('')}
+ * accessibilityRole="button"
+ * accessibilityLabel="Clear text"
+ * >
+ *
+ *
+ * );
+ *
+ * return (
+ *
+ * );
+ * };
+ *
+ * export default MyComponent;
+ * ```
+ *
+ * @extends TextInput props https://reactnative.dev/docs/textinput#props
+ */
+function TextField(props: TextFieldProps) {
+ /* eslint-disable @typescript-eslint/no-unused-vars -- peel TextField-only props before TextInput spread */
+ const {
+ ref,
+ status,
+ label,
+ supportingText,
+ supportingTextProps,
+ labelProps,
+ variant,
+ pressableStyle,
+ fieldStyle,
+ containerStyle,
+ theme,
+ LeftAccessory,
+ RightAccessory,
+ ...textInputProps
+ } = props;
+
+ const {
+ input,
+ disabled,
+ hasError,
+ $pressableStyles,
+ $leadingAccessoryStyles,
+ $trailingAccessoryStyles,
+ $fieldStyles,
+ $disabledBackgroundStyles,
+ $outlineStyles,
+ $animatedActiveOutlineStyles,
+ $animatedLabelWrapperStyles,
+ $animatedLabelTextStyles,
+ $containerStyles,
+ $inputStyles,
+ $supportingTextStyles,
+ $selectionColor,
+ $cursorColor,
+ $animatedPlaceholderStyles,
+ LeadingAccessory,
+ TrailingAccessory,
+ focusInput,
+ onFocusHandler,
+ onBlurHandler,
+ } = useTextField(props);
+
+ return (
+
+
+ {/* Disabled tint overlay — filled variant only. A childless
+ absolutely-positioned View whose translucent fill is applied via the
+ `opacity` style, so it never affects label/input rendering and works
+ with PlatformColor on Android. */}
+ {!!$disabledBackgroundStyles && (
+
+ )}
+
+ {/* Inactive indicator — always-visible 1px bottom border (filled) or
+ full border (outlined); height and color reflect error/disabled state
+ but do not change on focus */}
+
+
+ {/* Active indicator — filled variant only; 2px bar that expands from
+ the center outward via scaleX (0 → 1) on focus and collapses on blur */}
+ {!!$animatedActiveOutlineStyles && (
+
+ )}
+
+ {!!label && (
+
+
+ {label}
+
+
+ )}
+
+ {!!LeadingAccessory && (
+
+ )}
+
+
+ {/* Animated placeholder — a custom Text node that fades in once the
+ label has floated up; rendered only when a placeholder is provided
+ and the field is empty so it never overlaps real input text */}
+ {!!textInputProps.placeholder && !textInputProps.value && (
+
+ {textInputProps.placeholder}
+
+ )}
+
+
+
+
+ {!!TrailingAccessory && (
+
+ )}
+
+
+ {!!supportingText && (
+
+ {supportingText}
+
+ )}
+
+ );
+}
+
+export default TextField;
diff --git a/src/components/TextField/constants.ts b/src/components/TextField/constants.ts
new file mode 100644
index 0000000000..38f0d107cf
--- /dev/null
+++ b/src/components/TextField/constants.ts
@@ -0,0 +1,57 @@
+import { Platform } from 'react-native';
+
+// ==================
+// PLATFORM
+// ==================
+export const isWeb = Platform.OS === 'web';
+
+// =====================
+// FIELD LAYOUT
+// =====================
+export const TEXT_FIELD_HEIGHT = 56;
+export const TEXT_FIELD_PADDING_VERTICAL = 8;
+export const TEXT_FIELD_INPUT_WRAPPER_PADDING_HORIZONTAL = 16;
+export const TEXT_FIELD_ACCESSORY_MARGIN_HORIZONTAL = 12;
+
+// ==================
+// ACCESSORY
+// ==================
+export const ACCESSORY_SIZE = 24;
+
+// ===============
+// TYPOGRAPHY
+// ===============
+export const LINE_HEIGHT_DELTA = 2;
+export const INPUT_FONT_SIZE = 16;
+export const ACTIVE_LABEL_FONT_SIZE = 12;
+export const INACTIVE_LABEL_FONT_SIZE = INPUT_FONT_SIZE;
+export const HELPER_FONT_SIZE = 12;
+
+export const INACTIVE_LABEL_TOP_POSITION =
+ (TEXT_FIELD_HEIGHT -
+ 2 * TEXT_FIELD_PADDING_VERTICAL -
+ INACTIVE_LABEL_FONT_SIZE) /
+ 2 +
+ TEXT_FIELD_PADDING_VERTICAL -
+ LINE_HEIGHT_DELTA;
+
+// =================
+// HELPER TEXT LAYOUT
+// =================
+export const HELPER_MARGIN_TOP = 4;
+
+// =========
+// ANIMATION
+// =========
+export const ANIMATION_DURATION_MS = 150;
+
+// =========
+// INDICATOR
+// =========
+export const ACTIVE_INDICATOR_SIZE = 2;
+export const INACTIVE_INDICATOR_SIZE = 1;
+
+// ============
+// SHAPE
+// ============
+export const TEXT_FIELD_BORDER_RADIUS = 4;
diff --git a/src/components/TextField/filled/constants.ts b/src/components/TextField/filled/constants.ts
new file mode 100644
index 0000000000..9b783ccd5e
--- /dev/null
+++ b/src/components/TextField/filled/constants.ts
@@ -0,0 +1,33 @@
+import {
+ ACCESSORY_SIZE,
+ ACTIVE_LABEL_FONT_SIZE,
+ TEXT_FIELD_ACCESSORY_MARGIN_HORIZONTAL,
+ TEXT_FIELD_INPUT_WRAPPER_PADDING_HORIZONTAL,
+ TEXT_FIELD_PADDING_VERTICAL,
+} from '../constants';
+
+// ==================
+// LABEL POSITIONING
+// ==================
+
+export const LABEL_LEFT_OFFSET_WITH_ACCESSORY =
+ ACCESSORY_SIZE +
+ TEXT_FIELD_ACCESSORY_MARGIN_HORIZONTAL +
+ TEXT_FIELD_INPUT_WRAPPER_PADDING_HORIZONTAL;
+
+export const LABEL_LEFT_OFFSET_WITHOUT_ACCESSORY =
+ TEXT_FIELD_INPUT_WRAPPER_PADDING_HORIZONTAL;
+
+export const ACTIVE_LABEL_TOP_POSITION = TEXT_FIELD_PADDING_VERTICAL;
+
+// ==================
+// PLACEHOLDER & MULTILINE POSITIONING
+// ==================
+
+export const PADDING_TOP = ACTIVE_LABEL_FONT_SIZE + TEXT_FIELD_PADDING_VERTICAL;
+
+// ==================
+// OPACITY
+// ==================
+
+export const FILLED_CONTAINER_ALPHA = 0.04;
diff --git a/src/components/TextField/filled/logic.ts b/src/components/TextField/filled/logic.ts
new file mode 100644
index 0000000000..4db793f4c4
--- /dev/null
+++ b/src/components/TextField/filled/logic.ts
@@ -0,0 +1,258 @@
+import {
+ Animated,
+ I18nManager,
+ StyleProp,
+ TextStyle,
+ ViewStyle,
+} from 'react-native';
+
+import {
+ ACTIVE_INDICATOR_SIZE,
+ INACTIVE_INDICATOR_SIZE,
+ INPUT_FONT_SIZE,
+ isWeb,
+ TEXT_FIELD_INPUT_WRAPPER_PADDING_HORIZONTAL,
+} from '../constants';
+import {
+ $disabledStyle,
+ $inputStyle,
+ $leadingAccessoryStyle,
+ $supportingTextStyle,
+ $trailingAccessoryStyle,
+} from '../styles';
+import type { TextFieldProps, TextFieldSharedApi } from '../TextField';
+import {
+ getFieldBackgroundColor,
+ getLabelColor,
+ getSupportingTextColor,
+} from '../utils';
+import {
+ LABEL_LEFT_OFFSET_WITH_ACCESSORY,
+ LABEL_LEFT_OFFSET_WITHOUT_ACCESSORY,
+ PADDING_TOP,
+} from './constants';
+import {
+ $containerStyle,
+ $fieldStyle,
+ $labelTextStyle,
+ $labelWrapperStyle,
+ $disabledBackgroundStyle,
+ $outlineStyle,
+} from './styles';
+import { getOutlineColor } from './utils';
+
+export const getFilledTextFieldData = (
+ api: TextFieldSharedApi,
+ props: TextFieldProps
+) => {
+ const {
+ labelProps,
+ supportingTextProps,
+ style: $inputStyleOverride,
+ fieldStyle: $fieldStyleOverride,
+ containerStyle: $containerStyleOverride,
+ ...textInputProps
+ } = props;
+
+ const {
+ input,
+ theme,
+ isFocused,
+ disabled,
+ hasAccessory,
+ hasError,
+ $animatedLabelWrapperStyle,
+ $animatedLabelTextStyle,
+ $animatedPlaceholderStyle,
+ $animatedActiveOutlineStyle,
+ } = api;
+
+ // =======================
+ // CONSTANTS
+ // =======================
+
+ const { isRTL } = I18nManager;
+
+ // =======================
+ // THEME TOKENS
+ // =======================
+
+ const {
+ colors: { onSurface },
+ } = theme;
+
+ const labelColor = getLabelColor({
+ theme,
+ status: props.status,
+ isFocused,
+ disabled,
+ });
+
+ const outlineColor = getOutlineColor({
+ theme,
+ status: props.status,
+ isFocused: false,
+ disabled,
+ });
+
+ const activeOutlineColor = getOutlineColor({
+ theme,
+ status: props.status,
+ isFocused: true,
+ disabled,
+ });
+
+ const fieldBackgroundColor = getFieldBackgroundColor({ theme, disabled });
+
+ const supportingTextColor = getSupportingTextColor({
+ theme,
+ status: props.status,
+ disabled,
+ });
+
+ // =======================
+ // STYLES
+ // =======================
+
+ const $animatedLabelWrapperStyles: StyleProp<
+ Animated.WithAnimatedObject | ViewStyle
+ > = [
+ $labelWrapperStyle,
+ {
+ left: hasAccessory
+ ? LABEL_LEFT_OFFSET_WITH_ACCESSORY
+ : LABEL_LEFT_OFFSET_WITHOUT_ACCESSORY,
+ },
+ $animatedLabelWrapperStyle,
+ ];
+
+ const $animatedLabelTextStyles: StyleProp<
+ Animated.WithAnimatedObject | TextStyle
+ > = [
+ $labelTextStyle,
+ {
+ color: labelColor,
+ },
+ $animatedLabelTextStyle,
+ disabled && $disabledStyle,
+ labelProps?.style,
+ ];
+
+ const $fieldStyles = [
+ $fieldStyle,
+ {
+ backgroundColor: fieldBackgroundColor,
+ },
+ $fieldStyleOverride,
+ ];
+
+ /* Disabled tint (`onSurface @ 0.04`) is rendered as a childless overlay so its
+ alpha can be applied via the `opacity` style without leaking onto the label
+ and input. The View accepts `PlatformColor` directly. */
+ const $disabledBackgroundStyles: StyleProp = disabled
+ ? [
+ $disabledBackgroundStyle,
+ {
+ backgroundColor: onSurface,
+ },
+ ]
+ : undefined;
+
+ const $outlineStyles = [
+ $outlineStyle,
+ {
+ height: INACTIVE_INDICATOR_SIZE,
+ backgroundColor: outlineColor,
+ },
+ disabled && $disabledStyle,
+ ];
+
+ const $animatedActiveOutlineStyles: StyleProp<
+ Animated.WithAnimatedObject | ViewStyle
+ > = [
+ $outlineStyle,
+ {
+ height: ACTIVE_INDICATOR_SIZE,
+ backgroundColor: activeOutlineColor,
+ },
+ disabled && $disabledStyle,
+ $animatedActiveOutlineStyle,
+ ];
+
+ const $containerStyles = [$containerStyle, $containerStyleOverride];
+
+ const $supportingTextStyles: StyleProp = [
+ $supportingTextStyle,
+ {
+ color: supportingTextColor,
+ writingDirection: isRTL ? 'rtl' : 'ltr',
+ },
+ disabled && $disabledStyle,
+ supportingTextProps?.style,
+ ];
+
+ const $inputStyles: StyleProp = [
+ $inputStyle,
+ {
+ color: onSurface,
+ fontSize: INPUT_FONT_SIZE,
+ textAlign: isRTL ? 'right' : 'left',
+ writingDirection: isRTL ? 'rtl' : 'ltr',
+ },
+ textInputProps.multiline && {
+ height: 'auto' as TextStyle['height'],
+ paddingTop: PADDING_TOP,
+ },
+ isWeb && {
+ outlineStyle: 'none' as TextStyle['outlineStyle'],
+ },
+ disabled && $disabledStyle,
+ $inputStyleOverride,
+ ];
+
+ const $leadingAccessoryStyles = [
+ $leadingAccessoryStyle,
+ disabled && $disabledStyle,
+ ];
+
+ const $trailingAccessoryStyles = [
+ $trailingAccessoryStyle,
+ disabled && $disabledStyle,
+ ];
+
+ const $animatedPlaceholderStyles: StyleProp<
+ Animated.WithAnimatedObject | TextStyle
+ > = [
+ $inputStyle,
+ {
+ position: 'absolute',
+ top: PADDING_TOP,
+ left: TEXT_FIELD_INPUT_WRAPPER_PADDING_HORIZONTAL,
+ fontSize: INPUT_FONT_SIZE,
+ color:
+ textInputProps.placeholderTextColor ?? theme.colors.onSurfaceVariant,
+ textAlign: isRTL ? 'right' : 'left',
+ writingDirection: isRTL ? 'rtl' : 'ltr',
+ },
+ disabled && $disabledStyle,
+ $animatedPlaceholderStyle,
+ ];
+
+ return {
+ input,
+ disabled,
+ hasError,
+ $animatedLabelWrapperStyles,
+ $animatedLabelTextStyles,
+ $animatedPlaceholderStyles,
+ $fieldStyles,
+ $disabledBackgroundStyles,
+ $outlineStyles,
+ $animatedActiveOutlineStyles,
+ $containerStyles,
+ $supportingTextStyles,
+ $inputStyles,
+ $leadingAccessoryStyles,
+ $trailingAccessoryStyles,
+ };
+};
diff --git a/src/components/TextField/filled/styles.ts b/src/components/TextField/filled/styles.ts
new file mode 100644
index 0000000000..88672cb299
--- /dev/null
+++ b/src/components/TextField/filled/styles.ts
@@ -0,0 +1,55 @@
+import { TextStyle, ViewStyle } from 'react-native';
+
+import {
+ TEXT_FIELD_BORDER_RADIUS,
+ TEXT_FIELD_HEIGHT,
+ TEXT_FIELD_INPUT_WRAPPER_PADDING_HORIZONTAL,
+ TEXT_FIELD_PADDING_VERTICAL,
+} from '../constants';
+import { FILLED_CONTAINER_ALPHA } from './constants';
+
+export const $fieldStyle: ViewStyle = {
+ minHeight: TEXT_FIELD_HEIGHT,
+ flexDirection: 'row',
+ paddingVertical: TEXT_FIELD_PADDING_VERTICAL,
+ borderTopStartRadius: TEXT_FIELD_BORDER_RADIUS,
+ borderTopEndRadius: TEXT_FIELD_BORDER_RADIUS,
+};
+
+export const $outlineStyle: ViewStyle = {
+ position: 'absolute',
+ left: 0,
+ right: 0,
+ bottom: 0,
+};
+
+export const $containerStyle: ViewStyle = {
+ flex: 1,
+ paddingHorizontal: TEXT_FIELD_INPUT_WRAPPER_PADDING_HORIZONTAL,
+ justifyContent: 'flex-end',
+};
+
+export const $labelWrapperStyle: ViewStyle = {
+ position: 'absolute',
+};
+
+export const $labelTextStyle: TextStyle = {
+ fontWeight: '400',
+ includeFontPadding: false,
+ paddingVertical: 0,
+ paddingHorizontal: 0,
+};
+
+/* Disabled tint (`onSurface @ 0.04`) is rendered as a childless overlay so its
+ alpha can be applied via the `opacity` style without leaking onto the label
+ and input. The View accepts `PlatformColor` directly. */
+export const $disabledBackgroundStyle: ViewStyle = {
+ position: 'absolute',
+ top: 0,
+ left: 0,
+ right: 0,
+ bottom: 0,
+ opacity: FILLED_CONTAINER_ALPHA,
+ borderTopStartRadius: TEXT_FIELD_BORDER_RADIUS,
+ borderTopEndRadius: TEXT_FIELD_BORDER_RADIUS,
+};
diff --git a/src/components/TextField/filled/utils.ts b/src/components/TextField/filled/utils.ts
new file mode 100644
index 0000000000..3a055b8bf9
--- /dev/null
+++ b/src/components/TextField/filled/utils.ts
@@ -0,0 +1,34 @@
+import type { InternalTheme } from '../../../types';
+
+/**
+ * Returns the raw outline color for a filled field. The disabled state's
+ * alpha is intentionally NOT baked in here — it is applied via the `opacity`
+ * style on the (childless) outline View so the value can be a `PlatformColor`
+ * on Android, which the `color` library cannot parse at runtime.
+ */
+export const getOutlineColor = ({
+ theme,
+ status,
+ isFocused,
+ disabled,
+}: {
+ theme: InternalTheme;
+ isFocused: boolean;
+ status?: 'error' | 'disabled';
+ disabled: boolean;
+}) => {
+ const {
+ colors: { error, onSurface, primary, outline },
+ } = theme;
+
+ if (disabled) {
+ return onSurface;
+ }
+ if (status === 'error') {
+ return error;
+ }
+ if (isFocused) {
+ return primary;
+ }
+ return outline;
+};
diff --git a/src/components/TextField/logic.ts b/src/components/TextField/logic.ts
new file mode 100644
index 0000000000..9697dfe6fb
--- /dev/null
+++ b/src/components/TextField/logic.ts
@@ -0,0 +1,261 @@
+import {
+ useEffect,
+ useImperativeHandle,
+ useMemo,
+ useRef,
+ useState,
+} from 'react';
+import {
+ Animated,
+ BlurEvent,
+ FocusEvent,
+ I18nManager,
+ TextInput,
+ TextStyle,
+ ViewStyle,
+} from 'react-native';
+
+import {
+ ACTIVE_LABEL_FONT_SIZE,
+ ANIMATION_DURATION_MS,
+ INACTIVE_LABEL_FONT_SIZE,
+ INACTIVE_LABEL_TOP_POSITION,
+} from './constants';
+import { ACTIVE_LABEL_TOP_POSITION as FILLED_ACTIVE_LABEL_TOP } from './filled/constants';
+import { getFilledTextFieldData } from './filled/logic';
+import {
+ LABEL_TRANSLATE_X_WITHOUT_ACCESSORY,
+ LABEL_TRANSLATE_X_WITH_ACCESSORY,
+ ACTIVE_LABEL_TOP_POSITION as OUTLINED_ACTIVE_LABEL_TOP,
+} from './outlined/constants';
+import { getOutlinedTextFieldData } from './outlined/logic';
+import { $pressableStyle } from './styles';
+import type { TextFieldProps, TextFieldSharedApi } from './TextField';
+import { getAccentColors } from './utils';
+import { useInternalTheme } from '../../core/theming';
+
+export const useTextField = (props: TextFieldProps) => {
+ const {
+ ref,
+ variant = 'filled',
+ pressableStyle: $pressableStyleOverride,
+ theme: themeOverride,
+ onFocus,
+ onBlur,
+ } = props;
+
+ // =======================
+ // HOOKS
+ // =======================
+
+ const input = useRef(null);
+
+ const theme = useInternalTheme(themeOverride);
+
+ const [isFocused, setIsFocused] = useState(false);
+
+ useImperativeHandle(ref, () => input.current as TextInput);
+
+ // =======================
+ // CONSTANTS
+ // =======================
+
+ const { isRTL } = I18nManager;
+ const disabled = props.editable === false || props.status === 'disabled';
+ const isFloating = isFocused || !!props.value;
+ const hasAccessory = isRTL ? !!props.RightAccessory : !!props.LeftAccessory;
+ const hasError = props.status === 'error';
+
+ // =======================
+ // THEME TOKENS
+ // =======================
+
+ const { selectionColor: $selectionColor, cursorColor: $cursorColor } =
+ getAccentColors({ theme, hasError });
+
+ // =======================
+ // LABEL ANIMATION
+ // =======================
+
+ const {
+ $animatedLabelWrapperStyle,
+ $animatedLabelTextStyle,
+ $animatedPlaceholderStyle,
+ $animatedActiveOutlineStyle,
+ } = useTextFieldAnimation({
+ variant,
+ isFloating,
+ isFocused,
+ hasAccessory,
+ });
+
+ // =======================
+ // HANDLERS
+ // =======================
+
+ const onFocusHandler = (e: FocusEvent) => {
+ onFocus?.(e);
+ setIsFocused(true);
+ };
+
+ const onBlurHandler = (e: BlurEvent) => {
+ onBlur?.(e);
+ setIsFocused(false);
+ };
+
+ const focusInput = () => {
+ if (disabled) return;
+ input.current?.focus();
+ };
+
+ // =======================
+ // SHARED API
+ // =======================
+
+ const api: TextFieldSharedApi = {
+ input,
+ theme,
+ isFocused,
+ disabled,
+ hasAccessory,
+ hasError,
+ $animatedLabelWrapperStyle,
+ $animatedLabelTextStyle,
+ $animatedPlaceholderStyle,
+ $animatedActiveOutlineStyle,
+ };
+
+ const LeadingAccessory = isRTL ? props.RightAccessory : props.LeftAccessory;
+ const TrailingAccessory = isRTL ? props.LeftAccessory : props.RightAccessory;
+
+ // =======================
+ // STYLES
+ // =======================
+
+ const $pressableStyles = [$pressableStyle, $pressableStyleOverride];
+
+ const data = {
+ isFocused,
+ $pressableStyles,
+ $selectionColor,
+ $cursorColor,
+ $animatedActiveOutlineStyles: undefined,
+ LeadingAccessory,
+ TrailingAccessory,
+ onFocusHandler,
+ onBlurHandler,
+ focusInput,
+ };
+
+ if (variant === 'filled') {
+ return {
+ ...data,
+ ...getFilledTextFieldData(api, props),
+ };
+ }
+
+ return {
+ ...data,
+ ...getOutlinedTextFieldData(api, props),
+ };
+};
+
+const useTextFieldAnimation = ({
+ variant,
+ isFloating,
+ isFocused,
+ hasAccessory,
+}: {
+ variant: 'filled' | 'outlined';
+ isFloating: boolean;
+ isFocused: boolean;
+ hasAccessory: boolean;
+}): {
+ $animatedLabelWrapperStyle: Animated.WithAnimatedObject;
+ $animatedLabelTextStyle: Animated.WithAnimatedObject;
+ $animatedPlaceholderStyle: Animated.WithAnimatedObject;
+ $animatedActiveOutlineStyle?: Animated.WithAnimatedObject;
+} => {
+ const focusProgress = useRef(new Animated.Value(isFocused ? 1 : 0)).current;
+
+ const floatingProgress = useRef(
+ new Animated.Value(isFloating ? 1 : 0)
+ ).current;
+
+ useEffect(() => {
+ Animated.timing(focusProgress, {
+ toValue: isFocused ? 1 : 0,
+ duration: ANIMATION_DURATION_MS,
+ useNativeDriver: true,
+ }).start();
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [isFocused]);
+
+ useEffect(() => {
+ Animated.timing(floatingProgress, {
+ toValue: isFloating ? 1 : 0,
+ duration: ANIMATION_DURATION_MS,
+ useNativeDriver: false,
+ }).start();
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [isFloating]);
+
+ return useMemo(() => {
+ const activeTop =
+ variant === 'filled'
+ ? FILLED_ACTIVE_LABEL_TOP
+ : OUTLINED_ACTIVE_LABEL_TOP;
+
+ const fontSize = floatingProgress.interpolate({
+ inputRange: [0, 1],
+ outputRange: [INACTIVE_LABEL_FONT_SIZE, ACTIVE_LABEL_FONT_SIZE],
+ });
+
+ const top = floatingProgress.interpolate({
+ inputRange: [0, 1],
+ outputRange: [INACTIVE_LABEL_TOP_POSITION, activeTop],
+ });
+
+ const opacity = floatingProgress.interpolate({
+ inputRange: [0, 1],
+ outputRange: [0, 1],
+ });
+
+ if (variant === 'filled') {
+ const scaleX = focusProgress.interpolate({
+ inputRange: [0, 1],
+ outputRange: [0, 1],
+ });
+
+ return {
+ $animatedLabelWrapperStyle: { top },
+ $animatedLabelTextStyle: { fontSize },
+ $animatedPlaceholderStyle: { opacity },
+ $animatedActiveOutlineStyle: {
+ transform: [{ scaleX }],
+ },
+ };
+ }
+
+ const translateXEnd = hasAccessory
+ ? LABEL_TRANSLATE_X_WITH_ACCESSORY
+ : LABEL_TRANSLATE_X_WITHOUT_ACCESSORY;
+
+ return {
+ $animatedLabelWrapperStyle: {
+ top,
+ transform: [
+ {
+ translateX: floatingProgress.interpolate({
+ inputRange: [0, 1],
+ outputRange: [0, translateXEnd],
+ }),
+ },
+ ],
+ },
+ $animatedLabelTextStyle: { fontSize },
+ $animatedPlaceholderStyle: { opacity },
+ };
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [variant, hasAccessory]);
+};
diff --git a/src/components/TextField/outlined/constants.ts b/src/components/TextField/outlined/constants.ts
new file mode 100644
index 0000000000..e0ea1cf98c
--- /dev/null
+++ b/src/components/TextField/outlined/constants.ts
@@ -0,0 +1,55 @@
+import { I18nManager } from 'react-native';
+
+import {
+ ACCESSORY_SIZE,
+ LINE_HEIGHT_DELTA,
+ TEXT_FIELD_ACCESSORY_MARGIN_HORIZONTAL,
+ TEXT_FIELD_INPUT_WRAPPER_PADDING_HORIZONTAL,
+ TEXT_FIELD_PADDING_VERTICAL,
+} from '../constants';
+
+// ==================
+// LAYOUT SUPPORT
+// ==================
+
+const isRTL = I18nManager.isRTL;
+const layoutSupportMultiplier = isRTL ? -1 : 1;
+
+// ==================
+// LABEL POSITIONING
+// ==================
+export const LABEL_PADDING_HORIZONTAL = 4;
+
+export const LABEL_LEFT_OFFSET_WITH_ACCESSORY =
+ ACCESSORY_SIZE +
+ TEXT_FIELD_ACCESSORY_MARGIN_HORIZONTAL +
+ TEXT_FIELD_INPUT_WRAPPER_PADDING_HORIZONTAL -
+ LABEL_PADDING_HORIZONTAL;
+
+export const LABEL_LEFT_OFFSET_WITHOUT_ACCESSORY =
+ TEXT_FIELD_INPUT_WRAPPER_PADDING_HORIZONTAL;
+
+export const ACTIVE_LABEL_TOP_POSITION =
+ -TEXT_FIELD_PADDING_VERTICAL + LINE_HEIGHT_DELTA;
+
+export const LABEL_TRANSLATE_X_WITH_ACCESSORY =
+ -layoutSupportMultiplier *
+ (ACCESSORY_SIZE +
+ TEXT_FIELD_INPUT_WRAPPER_PADDING_HORIZONTAL -
+ LABEL_PADDING_HORIZONTAL);
+
+export const LABEL_TRANSLATE_X_WITHOUT_ACCESSORY =
+ -layoutSupportMultiplier * LABEL_PADDING_HORIZONTAL;
+
+// ==================
+// PLACEHOLDER POSITIONING
+// ==================
+
+export const PLACEHOLDER_TOP_POSITION =
+ TEXT_FIELD_PADDING_VERTICAL + LINE_HEIGHT_DELTA;
+
+// ============
+// OPACITY
+// ============
+
+export const OUTLINE_ALPHA = 0.12;
diff --git a/src/components/TextField/outlined/logic.ts b/src/components/TextField/outlined/logic.ts
new file mode 100644
index 0000000000..c13db1391e
--- /dev/null
+++ b/src/components/TextField/outlined/logic.ts
@@ -0,0 +1,215 @@
+import {
+ Animated,
+ I18nManager,
+ StyleProp,
+ TextStyle,
+ ViewStyle,
+} from 'react-native';
+
+import {
+ INPUT_FONT_SIZE,
+ isWeb,
+ TEXT_FIELD_INPUT_WRAPPER_PADDING_HORIZONTAL,
+} from '../constants';
+import {
+ $disabledStyle,
+ $supportingTextStyle,
+ $inputStyle,
+ $leadingAccessoryStyle,
+ $trailingAccessoryStyle,
+} from '../styles';
+import type { TextFieldProps, TextFieldSharedApi } from '../TextField';
+import { getSupportingTextColor, getLabelColor } from '../utils';
+import {
+ LABEL_LEFT_OFFSET_WITH_ACCESSORY,
+ LABEL_LEFT_OFFSET_WITHOUT_ACCESSORY,
+ OUTLINE_ALPHA,
+ PLACEHOLDER_TOP_POSITION,
+} from './constants';
+import {
+ $containerStyle,
+ $fieldStyle,
+ $labelTextStyle,
+ $labelWrapperStyle,
+ $outlineStyle,
+} from './styles';
+import { getOutlineColor } from './utils';
+
+export const getOutlinedTextFieldData = (
+ api: TextFieldSharedApi,
+ props: TextFieldProps
+) => {
+ const {
+ labelProps,
+ supportingTextProps,
+ style: $inputStyleOverride,
+ fieldStyle: $fieldStyleOverride,
+ containerStyle: $containerStyleOverride,
+ ...textInputProps
+ } = props;
+
+ const {
+ input,
+ theme,
+ isFocused,
+ disabled,
+ hasAccessory,
+ hasError,
+ $animatedLabelWrapperStyle,
+ $animatedLabelTextStyle,
+ $animatedPlaceholderStyle,
+ } = api;
+
+ // =======================
+ // CONSTANTS
+ // =======================
+
+ const { isRTL } = I18nManager;
+
+ // =======================
+ // THEME TOKENS
+ // =======================
+
+ const {
+ colors: { background: labelBackgroundColor, onSurface },
+ } = theme;
+
+ const labelColor = getLabelColor({
+ theme,
+ status: props.status,
+ isFocused,
+ disabled,
+ });
+
+ const outlineColor = getOutlineColor({
+ theme,
+ disabled,
+ isFocused,
+ hasError,
+ });
+
+ const supportingTextColor = getSupportingTextColor({
+ theme,
+ status: props.status,
+ disabled,
+ });
+
+ // =======================
+ // STYLES
+ // =======================
+
+ const $fieldStyles = [$fieldStyle, $fieldStyleOverride];
+
+ /* The outline is a childless absolutely-positioned View, so applying
+ `opacity` here is safe and lets us pass `outlineColor` through unchanged
+ (including PlatformColor values on Android). */
+ const $outlineStyles = [
+ $outlineStyle,
+ {
+ borderWidth: isFocused ? 2 : 1,
+ borderColor: outlineColor,
+ },
+ disabled && { opacity: OUTLINE_ALPHA },
+ $fieldStyleOverride,
+ ];
+
+ const $containerStyles = [$containerStyle, $containerStyleOverride];
+
+ const $supportingTextStyles: StyleProp = [
+ $supportingTextStyle,
+ {
+ color: supportingTextColor,
+ writingDirection: isRTL ? 'rtl' : 'ltr',
+ },
+ disabled && $disabledStyle,
+ supportingTextProps?.style,
+ ];
+
+ const $animatedLabelWrapperStyles: StyleProp<
+ Animated.WithAnimatedObject | ViewStyle
+ > = [
+ $labelWrapperStyle,
+ {
+ left: hasAccessory
+ ? LABEL_LEFT_OFFSET_WITH_ACCESSORY
+ : LABEL_LEFT_OFFSET_WITHOUT_ACCESSORY,
+ backgroundColor: labelBackgroundColor,
+ },
+ $animatedLabelWrapperStyle,
+ ];
+
+ const $animatedLabelTextStyles: StyleProp<
+ Animated.WithAnimatedObject | TextStyle
+ > = [
+ $labelTextStyle,
+ {
+ color: labelColor,
+ },
+ $animatedLabelTextStyle,
+ disabled && $disabledStyle,
+ labelProps?.style,
+ ];
+
+ const $inputStyles: StyleProp = [
+ $inputStyle,
+ {
+ color: onSurface,
+ fontSize: INPUT_FONT_SIZE,
+ textAlign: isRTL ? 'right' : 'left',
+ writingDirection: isRTL ? 'rtl' : 'ltr',
+ },
+ textInputProps.multiline && {
+ height: 'auto' as TextStyle['height'],
+ },
+ isWeb && {
+ outlineStyle: 'none' as TextStyle['outlineStyle'],
+ },
+ disabled && $disabledStyle,
+ $inputStyleOverride,
+ ];
+
+ const $leadingAccessoryStyles = [
+ $leadingAccessoryStyle,
+ disabled && $disabledStyle,
+ ];
+
+ const $trailingAccessoryStyles = [
+ $trailingAccessoryStyle,
+ disabled && $disabledStyle,
+ ];
+
+ const $animatedPlaceholderStyles: StyleProp<
+ Animated.WithAnimatedObject | TextStyle
+ > = [
+ $inputStyle,
+ {
+ position: 'absolute',
+ top: PLACEHOLDER_TOP_POSITION,
+ left: TEXT_FIELD_INPUT_WRAPPER_PADDING_HORIZONTAL,
+ fontSize: INPUT_FONT_SIZE,
+ color:
+ textInputProps.placeholderTextColor ?? theme.colors.onSurfaceVariant,
+ textAlign: isRTL ? 'right' : 'left',
+ writingDirection: isRTL ? 'rtl' : 'ltr',
+ },
+ disabled && $disabledStyle,
+ $animatedPlaceholderStyle,
+ ];
+
+ return {
+ input,
+ disabled,
+ hasError,
+ $animatedLabelWrapperStyles,
+ $animatedLabelTextStyles,
+ $animatedPlaceholderStyles,
+ $fieldStyles,
+ $disabledBackgroundStyles: undefined,
+ $outlineStyles,
+ $containerStyles,
+ $supportingTextStyles,
+ $inputStyles,
+ $leadingAccessoryStyles,
+ $trailingAccessoryStyles,
+ };
+};
diff --git a/src/components/TextField/outlined/styles.ts b/src/components/TextField/outlined/styles.ts
new file mode 100644
index 0000000000..5790d15296
--- /dev/null
+++ b/src/components/TextField/outlined/styles.ts
@@ -0,0 +1,43 @@
+import { TextStyle, ViewStyle } from 'react-native';
+
+import {
+ TEXT_FIELD_BORDER_RADIUS,
+ TEXT_FIELD_HEIGHT,
+ TEXT_FIELD_INPUT_WRAPPER_PADDING_HORIZONTAL,
+ TEXT_FIELD_PADDING_VERTICAL,
+} from '../constants';
+import { LABEL_PADDING_HORIZONTAL } from './constants';
+
+export const $fieldStyle: ViewStyle = {
+ minHeight: TEXT_FIELD_HEIGHT,
+ flexDirection: 'row',
+ paddingVertical: TEXT_FIELD_PADDING_VERTICAL,
+ borderRadius: TEXT_FIELD_BORDER_RADIUS,
+};
+
+export const $outlineStyle: ViewStyle = {
+ position: 'absolute',
+ left: 0,
+ right: 0,
+ top: 0,
+ bottom: 0,
+ borderRadius: TEXT_FIELD_BORDER_RADIUS,
+};
+
+export const $containerStyle: ViewStyle = {
+ flex: 1,
+ paddingHorizontal: TEXT_FIELD_INPUT_WRAPPER_PADDING_HORIZONTAL,
+ justifyContent: 'center',
+};
+
+export const $labelWrapperStyle: ViewStyle = {
+ position: 'absolute',
+ paddingHorizontal: LABEL_PADDING_HORIZONTAL,
+};
+
+export const $labelTextStyle: TextStyle = {
+ fontWeight: '400',
+ includeFontPadding: false,
+ paddingVertical: 0,
+ paddingHorizontal: 0,
+};
diff --git a/src/components/TextField/outlined/utils.ts b/src/components/TextField/outlined/utils.ts
new file mode 100644
index 0000000000..6cf25b1a60
--- /dev/null
+++ b/src/components/TextField/outlined/utils.ts
@@ -0,0 +1,39 @@
+import type { InternalTheme } from '../../../types';
+
+/**
+ * Returns the raw outline color for an outlined field. The disabled state's
+ * alpha is intentionally NOT baked in here — it is applied via the `opacity`
+ * style on the (childless) outline View so the value can be a `PlatformColor`
+ * on Android, which the `color` library cannot parse at runtime.
+ */
+export const getOutlineColor = ({
+ theme,
+ isFocused,
+ disabled,
+ hasError,
+}: {
+ theme: InternalTheme;
+ isFocused: boolean;
+ disabled: boolean;
+ hasError: boolean;
+}) => {
+ const {
+ colors: { outline, onSurface, primary, error },
+ } = theme;
+
+ let outlineColor = outline;
+
+ if (isFocused) {
+ outlineColor = primary;
+ }
+
+ if (disabled) {
+ outlineColor = onSurface;
+ }
+
+ if (hasError) {
+ outlineColor = error;
+ }
+
+ return outlineColor;
+};
diff --git a/src/components/TextField/styles.ts b/src/components/TextField/styles.ts
new file mode 100644
index 0000000000..dc0473bfec
--- /dev/null
+++ b/src/components/TextField/styles.ts
@@ -0,0 +1,45 @@
+import { StyleProp, TextStyle, ViewStyle } from 'react-native';
+
+import {
+ ACCESSORY_SIZE,
+ HELPER_FONT_SIZE,
+ HELPER_MARGIN_TOP,
+ TEXT_FIELD_ACCESSORY_MARGIN_HORIZONTAL,
+ TEXT_FIELD_INPUT_WRAPPER_PADDING_HORIZONTAL,
+} from './constants';
+import { tokens } from '../../styles/themes/v3/tokens';
+
+export const $pressableStyle: ViewStyle = {};
+
+export const $inputStyle: StyleProp = {
+ fontWeight: '400',
+ includeFontPadding: false,
+ paddingVertical: 0,
+ paddingHorizontal: 0,
+};
+
+export const $supportingTextStyle: TextStyle = {
+ marginTop: HELPER_MARGIN_TOP,
+ paddingHorizontal: TEXT_FIELD_INPUT_WRAPPER_PADDING_HORIZONTAL,
+ fontSize: HELPER_FONT_SIZE,
+ fontWeight: '400',
+ textAlign: 'left',
+};
+
+export const $trailingAccessoryStyle: ViewStyle = {
+ width: ACCESSORY_SIZE,
+ marginEnd: TEXT_FIELD_ACCESSORY_MARGIN_HORIZONTAL,
+ justifyContent: 'center',
+ alignItems: 'center',
+};
+
+export const $leadingAccessoryStyle: ViewStyle = {
+ width: ACCESSORY_SIZE,
+ marginStart: TEXT_FIELD_ACCESSORY_MARGIN_HORIZONTAL,
+ justifyContent: 'center',
+ alignItems: 'center',
+};
+
+export const $disabledStyle: ViewStyle = {
+ opacity: tokens.md.ref.stateOpacity.disabled,
+};
diff --git a/src/components/TextField/utils.ts b/src/components/TextField/utils.ts
new file mode 100644
index 0000000000..2c186af77f
--- /dev/null
+++ b/src/components/TextField/utils.ts
@@ -0,0 +1,88 @@
+import type { InternalTheme } from '../../types';
+
+export const getAccentColors = ({
+ theme,
+ hasError,
+}: {
+ theme: InternalTheme;
+ hasError: boolean;
+}) => {
+ const color = hasError ? theme.colors.error : theme.colors.primary;
+
+ return {
+ selectionColor: color,
+ cursorColor: color,
+ };
+};
+
+export const getLabelColor = ({
+ theme,
+ status,
+ isFocused,
+ disabled,
+}: {
+ theme: InternalTheme;
+ isFocused: boolean;
+ status?: 'error' | 'disabled';
+ disabled: boolean;
+}) => {
+ const {
+ colors: { error, primary, onSurface, onSurfaceVariant },
+ } = theme;
+
+ if (disabled) {
+ return onSurface;
+ }
+
+ if (status === 'error') {
+ return error;
+ }
+ if (isFocused) {
+ return primary;
+ }
+ return onSurfaceVariant;
+};
+
+export const getSupportingTextColor = ({
+ theme,
+ status,
+ disabled,
+}: {
+ theme: InternalTheme;
+ status?: 'error' | 'disabled';
+ disabled: boolean;
+}) => {
+ const {
+ colors: { error, onSurface, onSurfaceVariant },
+ } = theme;
+
+ if (disabled) {
+ return onSurface;
+ }
+
+ if (status === 'error') {
+ return error;
+ }
+ return onSurfaceVariant;
+};
+
+/**
+ * Returns the solid background color for the filled field container, or
+ * `undefined` when disabled. The disabled tint (`onSurface @ 0.04`) is rendered
+ * as a separate overlay View whose alpha is applied via the `opacity` style;
+ * keeping the alpha out of the color string is what makes the component safe
+ * to use with `PlatformColor` values on Android.
+ */
+export const getFieldBackgroundColor = ({
+ theme,
+ disabled,
+}: {
+ theme: InternalTheme;
+ disabled: boolean;
+}): string | undefined => {
+ if (disabled) {
+ return undefined;
+ }
+
+ return theme.colors.surfaceContainerHighest;
+};
diff --git a/src/components/TextInput/Addons/Outline.tsx b/src/components/TextInput/Addons/Outline.tsx
index 45b675fd8b..39ffa48b56 100644
--- a/src/components/TextInput/Addons/Outline.tsx
+++ b/src/components/TextInput/Addons/Outline.tsx
@@ -10,11 +10,9 @@ import {
import { TextInputLabelProp } from '../types';
type OutlineProps = {
- isV3: boolean;
activeColor: string;
backgroundColor: ColorValue;
hasActiveOutline?: boolean;
- focused?: boolean;
outlineColor?: string;
roundness?: number;
label?: TextInputLabelProp;
@@ -22,12 +20,10 @@ type OutlineProps = {
};
export const Outline = ({
- isV3,
label,
activeColor,
backgroundColor,
hasActiveOutline,
- focused,
outlineColor,
roundness,
style,
@@ -42,7 +38,7 @@ export const Outline = ({
{
backgroundColor,
borderRadius: roundness,
- borderWidth: (isV3 ? hasActiveOutline : focused) ? 2 : 1,
+ borderWidth: hasActiveOutline ? 2 : 1,
borderColor: hasActiveOutline ? activeColor : outlineColor,
},
style,
diff --git a/src/components/TextInput/Addons/Underline.tsx b/src/components/TextInput/Addons/Underline.tsx
index 184cbe63b5..22a8e419cc 100644
--- a/src/components/TextInput/Addons/Underline.tsx
+++ b/src/components/TextInput/Addons/Underline.tsx
@@ -3,8 +3,6 @@ import { Animated, StyleSheet, StyleProp, ViewStyle } from 'react-native';
import type { ThemeProp } from 'src/types';
-import { useInternalTheme } from '../../../core/theming';
-
type UnderlineProps = {
parentState: {
focused: boolean;
@@ -16,6 +14,7 @@ type UnderlineProps = {
activeColor: string;
underlineColorCustom?: string;
hasActiveOutline?: boolean;
+ disabledOpacity?: number;
style?: StyleProp;
theme?: ThemeProp;
};
@@ -27,33 +26,31 @@ export const Underline = ({
activeColor,
underlineColorCustom,
hasActiveOutline,
+ disabledOpacity,
style,
- theme: themeOverrides,
+ theme: _themeOverrides,
}: UnderlineProps) => {
- const { isV3 } = useInternalTheme(themeOverrides);
-
let backgroundColor = parentState.focused
? activeColor
: underlineColorCustom;
if (error) backgroundColor = colors?.error;
- const activeScale = isV3 ? 2 : 1;
+ const activeScale = 2;
return (
= ({
forceFocus,
paddingHorizontal,
maxFontSizeMultiplier,
- theme,
disabled,
}) => {
if (adornmentConfig.length) {
@@ -174,7 +168,6 @@ const TextInputAdornment: React.FunctionComponent = ({
return (
{
const theme = useInternalTheme(themeOverrides);
- const { AFFIX_OFFSET } = getConstants(theme.isV3);
+ const { AFFIX_OFFSET } = getConstants();
const {
textStyle,
@@ -152,12 +152,19 @@ const TextInputAffix = ({
[side]: offset,
} as ViewStyle;
- const textColor = getTextColor({ theme, disabled });
+ const { color: textColor, opacity: textOpacity } = getTextColor({
+ theme,
+ disabled,
+ });
const content = (
diff --git a/src/components/TextInput/Adornment/TextInputIcon.tsx b/src/components/TextInput/Adornment/TextInputIcon.tsx
index bd38ca64ab..0fc2c7c906 100644
--- a/src/components/TextInput/Adornment/TextInputIcon.tsx
+++ b/src/components/TextInput/Adornment/TextInputIcon.tsx
@@ -1,6 +1,5 @@
import React from 'react';
import {
- ColorValue,
GestureResponderEvent,
StyleProp,
StyleSheet,
@@ -37,10 +36,6 @@ export type Props = $Omit<
* Color of the icon or a function receiving a boolean indicating whether the TextInput is focused and returning the color.
*/
color?: ((isTextInputFocused: boolean) => string | undefined) | string;
- /**
- * Color of the ripple effect.
- */
- rippleColor?: ColorValue;
style?: StyleProp;
/**
* @optional
@@ -69,7 +64,6 @@ const IconAdornment: React.FunctionComponent<
icon: React.ReactNode;
topPosition: number;
side: 'left' | 'right';
- theme?: ThemeProp;
disabled?: boolean;
} & Omit
> = ({
@@ -79,11 +73,9 @@ const IconAdornment: React.FunctionComponent<
isTextInputFocused,
forceFocus,
testID,
- theme: themeOverrides,
disabled,
}) => {
- const { isV3 } = useInternalTheme(themeOverrides);
- const { ICON_OFFSET } = getConstants(isV3);
+ const { ICON_OFFSET } = getConstants();
const style = {
top: topPosition,
@@ -132,7 +124,6 @@ const TextInputIcon = ({
forceTextInputFocus = true,
color: customColor,
theme: themeOverrides,
- rippleColor,
...rest
}: Props) => {
const { style, isTextInputFocused, forceFocus, testID, disabled } =
@@ -151,7 +142,7 @@ const TextInputIcon = ({
const theme = useInternalTheme(themeOverrides);
- const iconColor = getIconColor({
+ const { color: iconColor, opacity: iconOpacity } = getIconColor({
theme,
disabled,
isTextInputFocused,
@@ -159,7 +150,7 @@ const TextInputIcon = ({
});
return (
-
+
diff --git a/src/components/TextInput/Adornment/utils.ts b/src/components/TextInput/Adornment/utils.ts
index e7dae2b487..e7d57985d6 100644
--- a/src/components/TextInput/Adornment/utils.ts
+++ b/src/components/TextInput/Adornment/utils.ts
@@ -1,23 +1,18 @@
-import color from 'color';
-
+import { tokens } from '../../../styles/themes/v3/tokens';
import type { InternalTheme } from '../../../types';
+const { stateOpacity } = tokens.md.ref;
+
type BaseProps = {
theme: InternalTheme;
disabled?: boolean;
};
export function getTextColor({ theme, disabled }: BaseProps) {
- if (theme.isV3) {
- if (disabled) {
- return theme.colors.onSurfaceDisabled;
- }
- return theme.colors.onSurfaceVariant;
- }
- return color(theme.colors?.text)
- .alpha(theme.dark ? 0.7 : 0.54)
- .rgb()
- .string();
+ return {
+ color: theme.colors.onSurfaceVariant,
+ opacity: disabled ? stateOpacity.disabled : stateOpacity.enabled,
+ };
}
export function getIconColor({
@@ -29,20 +24,13 @@ export function getIconColor({
isTextInputFocused: boolean;
customColor?: ((isTextInputFocused: boolean) => string | undefined) | string;
}) {
- if (typeof customColor === 'function') {
- return customColor(isTextInputFocused);
- }
- if (customColor) {
- return customColor;
- }
-
- if (!theme.isV3) {
- return theme.colors.text;
- }
+ const color =
+ typeof customColor === 'function'
+ ? customColor(isTextInputFocused)
+ : customColor ?? theme.colors.onSurfaceVariant;
- if (disabled) {
- return theme.colors.onSurfaceDisabled;
- }
+ const opacity =
+ disabled && !customColor ? stateOpacity.disabled : stateOpacity.enabled;
- return theme.colors.onSurfaceVariant;
+ return { color, opacity };
}
diff --git a/src/components/TextInput/Label/InputLabel.tsx b/src/components/TextInput/Label/InputLabel.tsx
index f0818f98f0..6fd869a1c3 100644
--- a/src/components/TextInput/Label/InputLabel.tsx
+++ b/src/components/TextInput/Label/InputLabel.tsx
@@ -18,7 +18,6 @@ const InputLabel = (props: InputLabelProps) => {
wiggle,
error,
focused,
- opacity,
labelLayoutWidth,
labelLayoutHeight,
labelBackground,
@@ -44,16 +43,17 @@ const InputLabel = (props: InputLabelProps) => {
backgroundColor,
roundness,
placeholderColor,
+ disabledOpacity,
+ opacity,
errorColor,
labelTranslationXOffset,
maxFontSizeMultiplier,
testID,
- isV3,
inputContainerLayout,
scaledLabel,
} = props;
- const { INPUT_PADDING_HORIZONTAL } = getConstants(isV3);
+ const { INPUT_PADDING_HORIZONTAL } = getConstants();
const { width } = useWindowDimensions();
const isWeb = Platform.OS === 'web';
@@ -140,7 +140,12 @@ const InputLabel = (props: InputLabelProps) => {
// This gives the effect of animating the color, but allows us to use native driver
{
const isAndroid = Platform.OS === 'android';
- const { colors, isV3, roundness } = theme;
- const font = isV3 ? theme.fonts.bodyLarge : theme.fonts.regular;
+ const { colors, roundness } = theme;
+ const font = theme.fonts.bodyLarge;
const hasActiveOutline = parentState.focused || error;
const { LABEL_PADDING_TOP, FLAT_INPUT_OFFSET, MIN_HEIGHT, MIN_WIDTH } =
- getConstants(isV3);
+ getConstants();
const {
fontSize: fontSizeStyle,
@@ -108,7 +108,6 @@ const TextInputFlat = ({
let { paddingLeft, paddingRight } = calculateFlatInputHorizontalPadding({
adornmentConfig,
- isV3,
});
if (isPaddingHorizontalPassed) {
@@ -134,12 +133,12 @@ const TextInputFlat = ({
paddingHorizontal,
inputOffset: FLAT_INPUT_OFFSET,
mode: InputMode.Flat,
- isV3,
});
const {
inputTextColor,
activeColor,
+ disabledOpacity,
underlineColorCustom,
placeholderColor,
errorColor,
@@ -291,6 +290,7 @@ const TextInputFlat = ({
hasActiveOutline,
activeColor,
placeholderColor,
+ disabledOpacity,
errorColor,
roundness,
maxFontSizeMultiplier: rest.maxFontSizeMultiplier,
@@ -304,7 +304,6 @@ const TextInputFlat = ({
? 1
: 0
: 1,
- isV3,
};
const affixTopPosition = {
@@ -350,6 +349,7 @@ const TextInputFlat = ({
colors={colors}
activeColor={activeColor}
theme={theme}
+ disabledOpacity={disabledOpacity}
/>
{
const adornmentConfig = getAdornmentConfig({ left, right });
- const { colors, isV3, roundness } = theme;
- const font = isV3 ? theme.fonts.bodyLarge : theme.fonts.regular;
+ const { colors, roundness } = theme;
+ const font = theme.fonts.bodyLarge;
const hasActiveOutline = parentState.focused || error;
const { INPUT_PADDING_HORIZONTAL, MIN_HEIGHT, ADORNMENT_OFFSET, MIN_WIDTH } =
- getConstants(isV3);
+ getConstants();
const {
fontSize: fontSizeStyle,
@@ -104,6 +104,7 @@ const TextInputOutlined = ({
const {
inputTextColor,
activeColor,
+ disabledOpacity,
outlineColor,
placeholderColor,
errorColor,
@@ -148,8 +149,8 @@ const TextInputOutlined = ({
if (isAdornmentLeftIcon) {
labelTranslationXOffset =
- (I18nManager.getConstants().isRTL ? -1 : 1) *
- (ADORNMENT_SIZE + ADORNMENT_OFFSET - (isV3 ? 0 : 8));
+ (I18nManager.getConstants().isRTL ? -1 : 1) * ADORNMENT_SIZE +
+ ADORNMENT_OFFSET;
}
const minInputHeight =
@@ -234,6 +235,7 @@ const TextInputOutlined = ({
hasActiveOutline,
activeColor,
placeholderColor,
+ disabledOpacity,
backgroundColor: labelBackgroundColor,
errorColor,
labelTranslationXOffset,
@@ -254,7 +256,6 @@ const TextInputOutlined = ({
? 1
: 0
: 1,
- isV3,
};
const onLayoutChange = React.useCallback(
@@ -303,7 +304,6 @@ const TextInputOutlined = ({
rightAffixWidth,
leftAffixWidth,
mode: 'outlined',
- isV3,
});
const affixTopPosition = {
[AdornmentSide.Left]: leftAffixTopPosition,
@@ -344,12 +344,10 @@ const TextInputOutlined = ({
Otherwise the border will cut off the label on Android
*/}
{
const { LABEL_PADDING_HORIZONTAL, ADORNMENT_OFFSET, FLAT_INPUT_OFFSET } =
- getConstants(isV3);
+ getConstants();
let paddingLeft = LABEL_PADDING_HORIZONTAL;
let paddingRight = LABEL_PADDING_HORIZONTAL;
@@ -314,30 +302,16 @@ type Mode = 'flat' | 'outlined';
const getInputTextColor = ({
theme,
textColor,
- disabled,
}: BaseProps & { textColor?: string }) => {
if (textColor) {
return textColor;
}
- if (theme.isV3) {
- if (disabled) {
- return theme.colors.onSurfaceDisabled;
- }
-
- return theme.colors.onSurface;
- }
-
- if (disabled) {
- return color(theme.colors.text).alpha(0.54).rgb().string();
- }
-
- return theme.colors.text;
+ return theme.colors.onSurface;
};
const getActiveColor = ({
theme,
- disabled,
error,
activeUnderlineColor,
activeOutlineColor,
@@ -359,31 +333,11 @@ const getActiveColor = ({
return modeColor;
}
- if (disabled) {
- if (theme.isV3) {
- return theme.colors.onSurfaceDisabled;
- }
-
- return color(theme.colors.text).alpha(0.54).rgb().string();
- }
-
return theme.colors.primary;
};
-const getPlaceholderColor = ({ theme, disabled }: BaseProps) => {
- if (theme.isV3) {
- if (disabled) {
- return theme.colors.onSurfaceDisabled;
- }
-
- return theme.colors.onSurfaceVariant;
- }
-
- if (disabled) {
- return theme.colors.disabled;
- }
-
- return theme.colors.placeholder;
+const getPlaceholderColor = ({ theme }: BaseProps) => {
+ return theme.colors.onSurfaceVariant;
};
const getSelectionColor = ({
@@ -396,30 +350,15 @@ const getSelectionColor = ({
if (typeof customSelectionColor !== 'undefined') {
return customSelectionColor;
}
-
- if (Platform.OS === 'android') {
- return color(activeColor).alpha(0.54).rgb().string();
- }
-
return activeColor;
};
const getFlatBackgroundColor = ({ theme, disabled }: BaseProps) => {
- if (theme.isV3) {
- if (disabled) {
- return color(theme.colors.onSurface).alpha(0.04).rgb().string();
- } else {
- return theme.colors.surfaceVariant;
- }
- }
-
if (disabled) {
- return undefined;
+ return theme.colors.surfaceContainerHighest;
}
- return theme.dark
- ? color(theme.colors?.background).lighten(0.24).rgb().string()
- : color(theme.colors?.background).darken(0.06).rgb().string();
+ return theme.colors.surfaceVariant;
};
const getFlatUnderlineColor = ({
@@ -431,19 +370,7 @@ const getFlatUnderlineColor = ({
return underlineColor;
}
- if (theme.isV3) {
- if (disabled) {
- return theme.colors.onSurfaceDisabled;
- }
-
- return theme.colors.onSurfaceVariant;
- }
-
- if (disabled) {
- return 'transparent';
- }
-
- return theme.colors.disabled;
+ return theme.colors.onSurfaceVariant;
};
const getOutlinedOutlineInputColor = ({
@@ -451,30 +378,18 @@ const getOutlinedOutlineInputColor = ({
disabled,
customOutlineColor,
}: BaseProps & { customOutlineColor?: string }) => {
- const isTransparent = color(customOutlineColor).alpha() === 0;
-
if (!disabled && customOutlineColor) {
return customOutlineColor;
}
- if (theme.isV3) {
- if (disabled) {
- if (theme.dark) {
- return 'transparent';
- }
- return theme.colors.surfaceDisabled;
- }
-
- return theme.colors.outline;
- }
-
if (disabled) {
- if (isTransparent) {
- return customOutlineColor;
+ if (theme.dark) {
+ return 'transparent';
}
- return theme.colors.disabled;
+ return theme.colors.outlineVariant;
}
- return theme.colors.placeholder;
+
+ return theme.colors.outline;
};
export const getFlatInputColors = ({
@@ -502,12 +417,17 @@ export const getFlatInputColors = ({
mode: 'flat',
});
+ const disabledOpacity = disabled
+ ? stateOpacity.disabled
+ : stateOpacity.enabled;
+
return {
inputTextColor: getInputTextColor({
...baseFlatColorProps,
textColor,
}),
activeColor,
+ disabledOpacity,
underlineColorCustom: getFlatUnderlineColor({
...baseFlatColorProps,
underlineColor,
@@ -544,12 +464,17 @@ export const getOutlinedInputColors = ({
mode: 'outlined',
});
+ const disabledOpacity = disabled
+ ? stateOpacity.disabled
+ : stateOpacity.enabled;
+
return {
inputTextColor: getInputTextColor({
...baseOutlinedColorProps,
textColor,
}),
activeColor,
+ disabledOpacity,
outlineColor: getOutlinedOutlineInputColor({
...baseOutlinedColorProps,
customOutlineColor,
@@ -560,53 +485,17 @@ export const getOutlinedInputColors = ({
};
};
-export const getConstants = (isV3?: boolean) => {
- // Text input affix
- let AFFIX_OFFSET;
- // Text input icon
- let ICON_OFFSET;
- //Text input flat
- let LABEL_PADDING_TOP;
- let LABEL_PADDING_HORIZONTAL;
- let FLAT_INPUT_OFFSET;
- let MIN_HEIGHT;
- // Text input outlined;
- let INPUT_PADDING_HORIZONTAL;
- let ADORNMENT_OFFSET;
- let OUTLINED_INPUT_OFFSET;
-
- if (isV3) {
- AFFIX_OFFSET = MD3_AFFIX_OFFSET;
- ICON_OFFSET = MD3_ICON_OFFSET;
- LABEL_PADDING_TOP = MD3_LABEL_PADDING_TOP;
- LABEL_PADDING_HORIZONTAL = MD3_LABEL_PADDING_HORIZONTAL;
- FLAT_INPUT_OFFSET = MD3_FLAT_INPUT_OFFSET;
- MIN_HEIGHT = MD3_MIN_HEIGHT;
- INPUT_PADDING_HORIZONTAL = MD3_INPUT_PADDING_HORIZONTAL;
- ADORNMENT_OFFSET = MD3_ADORNMENT_OFFSET;
- OUTLINED_INPUT_OFFSET = MD3_OUTLINED_INPUT_OFFSET;
- } else {
- AFFIX_OFFSET = MD2_AFFIX_OFFSET;
- ICON_OFFSET = MD2_ICON_OFFSET;
- LABEL_PADDING_TOP = MD2_LABEL_PADDING_TOP;
- LABEL_PADDING_HORIZONTAL = MD2_LABEL_PADDING_HORIZONTAL;
- FLAT_INPUT_OFFSET = MD2_FLAT_INPUT_OFFSET;
- MIN_HEIGHT = MD2_MIN_HEIGHT;
- INPUT_PADDING_HORIZONTAL = MD2_INPUT_PADDING_HORIZONTAL;
- ADORNMENT_OFFSET = MD2_ADORNMENT_OFFSET;
- OUTLINED_INPUT_OFFSET = MD2_OUTLINED_INPUT_OFFSET;
- }
-
+export const getConstants = () => {
return {
- AFFIX_OFFSET,
- ICON_OFFSET,
- LABEL_PADDING_TOP,
- LABEL_PADDING_HORIZONTAL,
- FLAT_INPUT_OFFSET,
- MIN_HEIGHT,
- INPUT_PADDING_HORIZONTAL,
- ADORNMENT_OFFSET,
- OUTLINED_INPUT_OFFSET,
+ AFFIX_OFFSET: MD3_AFFIX_OFFSET,
+ ICON_OFFSET: MD3_ICON_OFFSET,
+ LABEL_PADDING_TOP: MD3_LABEL_PADDING_TOP,
+ LABEL_PADDING_HORIZONTAL: MD3_LABEL_PADDING_HORIZONTAL,
+ FLAT_INPUT_OFFSET: MD3_FLAT_INPUT_OFFSET,
+ MIN_HEIGHT: MD3_MIN_HEIGHT,
+ INPUT_PADDING_HORIZONTAL: MD3_INPUT_PADDING_HORIZONTAL,
+ ADORNMENT_OFFSET: MD3_ADORNMENT_OFFSET,
+ OUTLINED_INPUT_OFFSET: MD3_OUTLINED_INPUT_OFFSET,
MIN_WIDTH,
};
};
diff --git a/src/components/TextInput/types.tsx b/src/components/TextInput/types.tsx
index 4ec2952366..49bc46e121 100644
--- a/src/components/TextInput/types.tsx
+++ b/src/components/TextInput/types.tsx
@@ -115,6 +115,7 @@ export type LabelProps = {
paddingRight?: number;
labelTranslationXOffset?: number;
placeholderColor: string | null;
+ disabledOpacity?: number;
backgroundColor?: ColorValue;
label?: TextInputLabelProp | null;
hasActiveOutline?: boolean | null;
@@ -141,7 +142,6 @@ export type InputLabelProps = {
inputContainerLayout: { width: number };
labelBackground?: any;
maxFontSizeMultiplier?: number | undefined | null;
- isV3?: boolean;
scaledLabel?: boolean;
} & LabelProps;
diff --git a/src/components/ToggleButton/ToggleButton.tsx b/src/components/ToggleButton/ToggleButton.tsx
index bfdd3fca5c..ba4bd138a3 100644
--- a/src/components/ToggleButton/ToggleButton.tsx
+++ b/src/components/ToggleButton/ToggleButton.tsx
@@ -6,15 +6,11 @@ import {
ViewStyle,
View,
Animated,
- ColorValue,
} from 'react-native';
-import color from 'color';
-
import { ToggleButtonGroupContext } from './ToggleButtonGroup';
import { getToggleButtonColor } from './utils';
import { useInternalTheme } from '../../core/theming';
-import { black, white } from '../../styles/themes/v2/colors';
import type { ThemeProp } from '../../types';
import { forwardRef } from '../../utils/forwardRef';
import type { IconSource } from '../Icon';
@@ -33,10 +29,6 @@ export type Props = {
* Custom text color for button.
*/
iconColor?: string;
- /**
- * Color of the ripple effect.
- */
- rippleColor?: ColorValue;
/**
* Whether the button is disabled.
*/
@@ -111,7 +103,6 @@ const ToggleButton = forwardRef(
value,
status,
onPress,
- rippleColor,
...rest
}: Props,
ref
@@ -128,12 +119,7 @@ const ToggleButton = forwardRef(
(context && context.value === value) || status === 'checked';
const backgroundColor = getToggleButtonColor({ theme, checked });
- const borderColor = theme.isV3
- ? theme.colors.outline
- : color(theme.dark ? white : black)
- .alpha(0.29)
- .rgb()
- .string();
+ const borderColor = theme.colors.outline;
return (
(
]}
ref={ref}
theme={theme}
- rippleColor={rippleColor}
{...rest}
/>
);
diff --git a/src/components/ToggleButton/utils.ts b/src/components/ToggleButton/utils.ts
index 79c22665ad..e471a5b4b6 100644
--- a/src/components/ToggleButton/utils.ts
+++ b/src/components/ToggleButton/utils.ts
@@ -1,6 +1,3 @@
-import color from 'color';
-
-import { tokens } from '../../styles/themes/v3/tokens';
import type { InternalTheme } from '../../types';
export const getToggleButtonColor = ({
@@ -11,16 +8,7 @@ export const getToggleButtonColor = ({
checked: boolean | null;
}) => {
if (checked) {
- if (theme.isV3) {
- return color(theme.colors.onSecondaryContainer)
- .alpha(tokens.md.ref.opacity.level2)
- .rgb()
- .string();
- }
- if (theme.dark) {
- return 'rgba(255, 255, 255, .12)';
- }
- return 'rgba(0, 0, 0, .08)';
+ return theme.colors.surfaceContainerHighest;
}
- return 'transparent';
+ return theme.colors.surfaceContainer;
};
diff --git a/src/components/Tooltip/Tooltip.tsx b/src/components/Tooltip/Tooltip.tsx
index f5a483db5a..fdfef8571f 100644
--- a/src/components/Tooltip/Tooltip.tsx
+++ b/src/components/Tooltip/Tooltip.tsx
@@ -204,9 +204,7 @@ const Tooltip = ({
style={[
styles.tooltip,
{
- backgroundColor: theme.isV3
- ? theme.colors.onSurface
- : theme.colors.tooltip,
+ backgroundColor: theme.colors.onSurface,
...getTooltipPosition(
measurement as Measurement,
children as React.ReactElement
diff --git a/src/components/TouchableRipple/TouchableRipple.native.tsx b/src/components/TouchableRipple/TouchableRipple.native.tsx
index 1cb17b4068..3f8c791c33 100644
--- a/src/components/TouchableRipple/TouchableRipple.native.tsx
+++ b/src/components/TouchableRipple/TouchableRipple.native.tsx
@@ -73,12 +73,13 @@ const TouchableRipple = (
underlayColor,
});
- // A workaround for ripple on Android P is to use useForeground + overflow: 'hidden'
+ // Use foreground ripple on Android P+ to ensure visibility.
+ // Background ripple requires the view to have a background drawable,
+ // which isn't always present. Foreground ripple needs overflow: 'hidden'
+ // to stay within bounds.
// https://github.com/facebook/react-native/issues/6480
const useForeground =
- Platform.OS === 'android' &&
- Platform.Version >= ANDROID_VERSION_PIE &&
- borderless;
+ Platform.OS === 'android' && Platform.Version >= ANDROID_VERSION_PIE;
if (TouchableRipple.supported) {
const androidRipple = rippleEffectEnabled
@@ -94,7 +95,7 @@ const TouchableRipple = (
{...rest}
ref={ref}
disabled={disabled}
- style={[borderless && styles.overflowHidden, style]}
+ style={[useForeground && styles.overflowHidden, style]}
android_ripple={androidRipple}
>
{React.Children.only(children)}
diff --git a/src/components/TouchableRipple/utils.ts b/src/components/TouchableRipple/utils.ts
index 29c2b18e25..10dcef6703 100644
--- a/src/components/TouchableRipple/utils.ts
+++ b/src/components/TouchableRipple/utils.ts
@@ -5,11 +5,9 @@ import color from 'color';
import type { InternalTheme } from '../../types';
const getUnderlayColor = ({
- theme,
calculatedRippleColor,
underlayColor,
}: {
- theme: InternalTheme;
calculatedRippleColor: ColorValue;
underlayColor?: string;
}) => {
@@ -17,11 +15,7 @@ const getUnderlayColor = ({
return underlayColor;
}
- if (theme.isV3) {
- return color(calculatedRippleColor).rgb().string();
- }
-
- return color(calculatedRippleColor).fade(0.5).rgb().string();
+ return color(calculatedRippleColor).rgb().string();
};
const getRippleColor = ({
@@ -35,14 +29,7 @@ const getRippleColor = ({
return rippleColor;
}
- if (theme.isV3) {
- return color(theme.colors.onSurface).alpha(0.12).rgb().string();
- }
-
- if (theme.dark) {
- return color(theme.colors.text).alpha(0.32).rgb().string();
- }
- return color(theme.colors.text).alpha(0.2).rgb().string();
+ return theme.colors.stateLayerPressed;
};
export const getTouchableRippleColors = ({
@@ -58,7 +45,6 @@ export const getTouchableRippleColors = ({
return {
calculatedRippleColor,
calculatedUnderlayColor: getUnderlayColor({
- theme,
calculatedRippleColor,
underlayColor,
}),
diff --git a/src/components/Typography/AnimatedText.tsx b/src/components/Typography/AnimatedText.tsx
index 6504ad4b92..19872e2d93 100644
--- a/src/components/Typography/AnimatedText.tsx
+++ b/src/components/Typography/AnimatedText.tsx
@@ -50,7 +50,7 @@ const AnimatedText = forwardRef>(
const theme = useInternalTheme(themeOverrides);
const writingDirection = I18nManager.getConstants().isRTL ? 'rtl' : 'ltr';
- if (theme.isV3 && variant) {
+ if (variant) {
const font = theme.fonts[variant];
if (typeof font !== 'object') {
throw new Error(
@@ -73,10 +73,10 @@ const AnimatedText = forwardRef>(
/>
);
} else {
- const font = !theme.isV3 ? theme.fonts.regular : theme.fonts.bodyMedium;
+ const font = theme.fonts.bodyMedium;
const textStyle = {
...font,
- color: theme.isV3 ? theme.colors.onSurface : theme.colors.text,
+ color: theme.colors.onSurface,
};
return (
root.current?.setNativeProps(args),
}));
- if (theme.isV3 && variant) {
+ if (variant) {
let font = theme.fonts[variant];
let textStyle = [font, style];
@@ -155,10 +155,10 @@ const Text = (
/>
);
} else {
- const font = theme.isV3 ? theme.fonts.default : theme.fonts?.regular;
+ const font = theme.fonts.default;
const textStyle = {
...font,
- color: theme.isV3 ? theme.colors?.onSurface : theme.colors.text,
+ color: theme.colors?.onSurface,
};
return (
& {
const StyledText = ({
alpha = 1,
- family,
+ family: _family,
style,
theme: themeOverrides,
...rest
}: Props) => {
const theme = useInternalTheme(themeOverrides);
- const textColor = color(
- theme.isV3 ? theme.colors.onSurface : theme.colors?.text
- )
- .alpha(alpha)
- .rgb()
- .string();
+ const textColor = color(theme.colors.onSurface).alpha(alpha).rgb().string();
const writingDirection = I18nManager.getConstants().isRTL ? 'rtl' : 'ltr';
return (
@@ -38,7 +33,6 @@ const StyledText = ({
styles.text,
{
color: textColor,
- ...(!theme.isV3 && theme.fonts?.[family]),
writingDirection,
},
style,
diff --git a/src/components/Typography/v2/Text.tsx b/src/components/Typography/v2/Text.tsx
index 8114915189..4e10eecf54 100644
--- a/src/components/Typography/v2/Text.tsx
+++ b/src/components/Typography/v2/Text.tsx
@@ -6,7 +6,7 @@ import {
TextStyle,
} from 'react-native';
-import type { MD2Theme } from 'src/types';
+import type { ThemeProp } from 'src/types';
import { useInternalTheme } from '../../../core/theming';
import { forwardRef } from '../../../utils/forwardRef';
@@ -16,7 +16,7 @@ type Props = React.ComponentProps & {
/**
* @optional
*/
- theme?: MD2Theme;
+ theme?: ThemeProp;
};
// @component-group Typography
@@ -43,8 +43,7 @@ const Text: React.ForwardRefRenderFunction<{}, Props> = (
ref={root}
style={[
{
- ...(!theme.isV3 && theme.fonts?.regular),
- color: theme.isV3 ? theme.colors?.onSurface : theme.colors.text,
+ color: theme.colors?.onSurface,
},
styles.text,
style,
diff --git a/src/components/__tests__/Appbar/Appbar.test.tsx b/src/components/__tests__/Appbar/Appbar.test.tsx
index 6f76dab75b..e1c55fa8c8 100644
--- a/src/components/__tests__/Appbar/Appbar.test.tsx
+++ b/src/components/__tests__/Appbar/Appbar.test.tsx
@@ -1,12 +1,10 @@
import React from 'react';
-import { Animated, Platform } from 'react-native';
+import { Animated } from 'react-native';
import { act, render } from '@testing-library/react-native';
import mockSafeAreaContext from 'react-native-safe-area-context/jest/mock';
-import PaperProvider from '../../../core/PaperProvider';
import { getTheme } from '../../../core/theming';
-import overlay from '../../../styles/overlay';
import { tokens } from '../../../styles/themes/v3/tokens';
import Appbar from '../../Appbar';
import {
@@ -17,7 +15,6 @@ import {
} from '../../Appbar/utils';
import Menu from '../../Menu/Menu';
import Searchbar from '../../Searchbar';
-import Tooltip from '../../Tooltip/Tooltip';
import Text from '../../Typography/Text';
const renderAppbarContent = utilRenderAppbarContent as (
@@ -58,7 +55,6 @@ describe('renderAppbarContent', () => {
it('should render all children types if renderOnly is not specified', () => {
const result = renderAppbarContent({
- isV3: false,
children,
isDark: false,
});
@@ -68,7 +64,6 @@ describe('renderAppbarContent', () => {
it('should render all children types except specified in renderExcept', () => {
const result = renderAppbarContent({
- isV3: false,
children: [
...children,
@@ -217,7 +225,7 @@ exports[`Appbar does not pass any additional props to Searchbar 1`] = `
accessibilityRole="search"
keyboardAppearance="light"
placeholder="Search"
- placeholderTextColor="rgba(28, 27, 31, 1)"
+ placeholderTextColor="rgba(29, 27, 32, 1)"
returnKeyType="search"
selectionColor="rgba(103, 80, 164, 1)"
style={
@@ -288,7 +296,7 @@ exports[`Appbar does not pass any additional props to Searchbar 1`] = `
style={
{
"backgroundColor": "transparent",
- "borderColor": "rgba(121, 116, 126, 1)",
+ "borderColor": "rgba(202, 196, 208, 1)",
"borderRadius": 20,
"borderWidth": 0,
"elevation": 0,
@@ -365,35 +373,43 @@ exports[`Appbar does not pass any additional props to Searchbar 1`] = `
}
testID="search-bar-clear-icon"
>
-
+
- close
-
+ [
+ {
+ "lineHeight": 24,
+ "transform": [
+ {
+ "scaleX": 1,
+ },
+ ],
+ },
+ {
+ "backgroundColor": "transparent",
+ },
+ ],
+ ]
+ }
+ >
+ close
+
+
@@ -409,7 +425,7 @@ exports[`Appbar passes additional props to AppbarBackAction, AppbarContent and A
collapsable={false}
style={
{
- "backgroundColor": "rgba(255, 251, 254, 1)",
+ "backgroundColor": "rgba(254, 247, 255, 1)",
"height": 64,
"shadowColor": "#000",
"shadowOffset": {
@@ -427,7 +443,7 @@ exports[`Appbar passes additional props to AppbarBackAction, AppbarContent and A
style={
{
"alignItems": "center",
- "backgroundColor": "rgba(255, 251, 254, 1)",
+ "backgroundColor": "rgba(254, 247, 255, 1)",
"flex": 1,
"flexDirection": "row",
"paddingBottom": undefined,
@@ -471,7 +487,7 @@ exports[`Appbar passes additional props to AppbarBackAction, AppbarContent and A
style={
{
"backgroundColor": "transparent",
- "borderColor": "rgba(121, 116, 126, 1)",
+ "borderColor": "rgba(202, 196, 208, 1)",
"borderRadius": 20,
"borderWidth": 0,
"elevation": 0,
@@ -550,76 +566,84 @@ exports[`Appbar passes additional props to AppbarBackAction, AppbarContent and A
>
-
+ >
+
+
@@ -659,7 +683,7 @@ exports[`Appbar passes additional props to AppbarBackAction, AppbarContent and A
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -672,14 +696,13 @@ exports[`Appbar passes additional props to AppbarBackAction, AppbarContent and A
},
[
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontSize": 22,
"fontWeight": "400",
"letterSpacing": 0,
"lineHeight": 28,
},
- false,
undefined,
],
],
@@ -715,7 +738,7 @@ exports[`Appbar passes additional props to AppbarBackAction, AppbarContent and A
style={
{
"backgroundColor": "transparent",
- "borderColor": "rgba(121, 116, 126, 1)",
+ "borderColor": "rgba(202, 196, 208, 1)",
"borderRadius": 20,
"borderWidth": 0,
"elevation": 0,
@@ -793,66 +816,74 @@ exports[`Appbar passes additional props to AppbarBackAction, AppbarContent and A
>
-
- menu
-
+
+ menu
+
+
diff --git a/src/components/__tests__/Banner.test.tsx b/src/components/__tests__/Banner.test.tsx
index 8e0d8c90d1..048bfa7275 100644
--- a/src/components/__tests__/Banner.test.tsx
+++ b/src/components/__tests__/Banner.test.tsx
@@ -91,7 +91,7 @@ it('render visible banner, with custom theme', () => {
visible
theme={{
colors: {
- text: '#00f',
+ onSurface: '#00f',
surface: '#ccc',
primary: '#043',
},
diff --git a/src/components/__tests__/BottomNavigation.test.tsx b/src/components/__tests__/BottomNavigation.test.tsx
index 43c1e9383b..f5bdeced00 100644
--- a/src/components/__tests__/BottomNavigation.test.tsx
+++ b/src/components/__tests__/BottomNavigation.test.tsx
@@ -2,10 +2,8 @@ import * as React from 'react';
import { Animated, Easing, Platform, StyleSheet } from 'react-native';
import { act, fireEvent, render } from '@testing-library/react-native';
-import color from 'color';
import { getTheme } from '../../core/theming';
-import { red300 } from '../../styles/themes/v2/colors';
import { MD3Colors } from '../../styles/themes/v3/tokens';
import BottomNavigation from '../BottomNavigation/BottomNavigation';
import BottomNavigationRouteScreen from '../BottomNavigation/BottomNavigationRouteScreen';
@@ -18,7 +16,7 @@ import Icon from '../Icon';
const styles = StyleSheet.create({
backgroundColor: {
- backgroundColor: red300,
+ backgroundColor: MD3Colors.error60,
},
});
@@ -378,7 +376,7 @@ it('renders custom background color passed to barStyle property', () => {
);
const wrapper = getByTestId('bottom-navigation-bar-content');
- expect(wrapper).toHaveStyle({ backgroundColor: red300 });
+ expect(wrapper).toHaveStyle({ backgroundColor: MD3Colors.error60 });
});
it('renders a single tab', () => {
@@ -446,7 +444,7 @@ it('does not apply maxTabBarWidth styling if compact prop is falsy', () => {
});
});
-it('displays ripple animation view if shifting is truthy', () => {
+it('renders bar content when shifting is enabled', () => {
const { getByTestId } = render(
{
renderScene={({ route }) => route.title}
getLazy={({ route }) => route.key === 'key-2'}
testID="bottom-navigation"
- theme={{ isV3: false }}
shifting
/>
);
- expect(getByTestId('bottom-navigation-bar-content-ripple')).toBeDefined();
+ expect(getByTestId('bottom-navigation-bar-content')).toBeDefined();
});
-it('does not display ripple animation view if shifting is falsy', () => {
+it('does not render legacy ripple overlay when shifting is disabled', () => {
const { queryByTestId } = render(
{
describe('getActiveTintColor', () => {
it.each`
- activeColor | defaultColor | useV3 | expected
- ${'#FBF7DB'} | ${'#fff'} | ${true} | ${'#FBF7DB'}
- ${undefined} | ${'#fff'} | ${true} | ${MD3Colors.secondary10}
- ${undefined} | ${'#fff'} | ${false} | ${'#fff'}
+ activeColor | expected
+ ${'#FBF7DB'} | ${'#FBF7DB'}
+ ${undefined} | ${MD3Colors.secondary10}
`(
- 'returns $expected when activeColor: $activeColor and useV3: $useV3',
- ({ activeColor, defaultColor, useV3, expected }) => {
- const theme = getTheme(false, useV3);
- const color = getActiveTintColor({ activeColor, defaultColor, theme });
- expect(color).toBe(expected);
+ 'returns $expected when activeColor: $activeColor',
+ ({ activeColor, expected }) => {
+ const theme = getTheme(false);
+ const result = getActiveTintColor({ activeColor, theme });
+ expect(result).toBe(expected);
}
);
});
describe('getInactiveTintColor', () => {
it.each`
- inactiveColor | defaultColor | useV3 | expected
- ${'#853D4B'} | ${'#fff'} | ${true} | ${'#853D4B'}
- ${undefined} | ${'#fff'} | ${true} | ${MD3Colors.neutralVariant30}
- ${undefined} | ${'#fff'} | ${false} | ${color('#fff').alpha(0.5).rgb().string()}
+ inactiveColor | expected
+ ${'#853D4B'} | ${'#853D4B'}
+ ${undefined} | ${MD3Colors.neutralVariant30}
`(
- 'returns $expected when inactiveColor: $inactiveColor and useV3: $useV3',
- ({ inactiveColor, defaultColor, useV3, expected }) => {
- const theme = getTheme(false, useV3);
- const color = getInactiveTintColor({
+ 'returns $expected when inactiveColor: $inactiveColor',
+ ({ inactiveColor, expected }) => {
+ const theme = getTheme(false);
+ const result = getInactiveTintColor({
inactiveColor,
- defaultColor,
theme,
});
- expect(color).toBe(expected);
+ expect(result).toBe(expected);
}
);
});
describe('getLabelColor', () => {
it.each`
- tintColor | focused | defaultColor | useV3 | expected
- ${'#FBF7DB'} | ${true} | ${'#fff'} | ${true} | ${'#FBF7DB'}
- ${'#853D4B'} | ${true} | ${'#fff'} | ${true} | ${'#853D4B'}
- ${undefined} | ${true} | ${'#fff'} | ${true} | ${MD3Colors.neutral10}
- ${undefined} | ${false} | ${'#fff'} | ${true} | ${MD3Colors.neutralVariant30}
- ${undefined} | ${false} | ${'#fff'} | ${false} | ${'#fff'}
- ${undefined} | ${true} | ${'#fff'} | ${false} | ${'#fff'}
+ tintColor | focused | expected
+ ${'#FBF7DB'} | ${true} | ${'#FBF7DB'}
+ ${'#853D4B'} | ${true} | ${'#853D4B'}
+ ${undefined} | ${true} | ${MD3Colors.neutral10}
+ ${undefined} | ${false} | ${MD3Colors.neutralVariant30}
`(
- 'returns $expected when tintColor: $tintColor, focused: $focused useV3: $useV3',
- ({ tintColor, focused, defaultColor, useV3, expected }) => {
- const theme = getTheme(false, useV3);
- const color = getLabelColor({
- tintColor,
+ 'returns $expected when tintColor: $tintColor, focused: $focused',
+ ({ tintColor, focused, expected }) => {
+ const theme = getTheme(false);
+ const result = getLabelColor({
+ tintColor: tintColor ?? '',
hasColor: Boolean(tintColor),
focused,
- defaultColor,
theme,
});
- expect(color).toBe(expected);
+ expect(result).toBe(expected);
}
);
});
diff --git a/src/components/__tests__/Button.test.tsx b/src/components/__tests__/Button.test.tsx
index 8917eaca92..b47be8c53e 100644
--- a/src/components/__tests__/Button.test.tsx
+++ b/src/components/__tests__/Button.test.tsx
@@ -2,13 +2,15 @@ import * as React from 'react';
import { Animated, StyleSheet } from 'react-native';
import { act, fireEvent, render } from '@testing-library/react-native';
-import color from 'color';
import { getTheme } from '../../core/theming';
-import { black, pink500, white } from '../../styles/themes/v2/colors';
+import { pink500, white } from '../../styles/themes/v2/colors';
+import { tokens } from '../../styles/themes/v3/tokens';
import Button from '../Button/Button';
import { getButtonColors } from '../Button/utils';
+const { stateOpacity } = tokens.md.ref;
+
const styles = StyleSheet.create({
flexing: {
flexDirection: 'row-reverse',
@@ -350,7 +352,8 @@ describe('getButtonColors - background color', () => {
disabled: true,
})
).toMatchObject({
- backgroundColor: getTheme().colors.surfaceDisabled,
+ backgroundColor: getTheme().colors.onSurface,
+ backgroundOpacity: stateOpacity.pressed,
});
})
);
@@ -365,7 +368,8 @@ describe('getButtonColors - background color', () => {
disabled: true,
})
).toMatchObject({
- backgroundColor: getTheme(true).colors.surfaceDisabled,
+ backgroundColor: getTheme(true).colors.onSurface,
+ backgroundOpacity: stateOpacity.pressed,
});
})
);
@@ -377,7 +381,7 @@ describe('getButtonColors - background color', () => {
mode: 'elevated',
})
).toMatchObject({
- backgroundColor: getTheme().colors.elevation.level1,
+ backgroundColor: getTheme().colors.surfaceContainerLow,
});
});
@@ -388,7 +392,7 @@ describe('getButtonColors - background color', () => {
mode: 'elevated',
})
).toMatchObject({
- backgroundColor: getTheme(true).colors.elevation.level1,
+ backgroundColor: getTheme(true).colors.surfaceContainerLow,
});
});
@@ -461,95 +465,6 @@ describe('getButtonColors - background color', () => {
});
})
);
-
- it('should return correct theme color, for theme version 2, contained mode', () => {
- expect(
- getButtonColors({
- theme: getTheme(false, false),
- mode: 'contained',
- })
- ).toMatchObject({
- backgroundColor: getTheme(false, false).colors.primary,
- });
- });
-
- it('should return correct theme color, for theme version 2, when disabled, contained mode', () => {
- expect(
- getButtonColors({
- theme: getTheme(false, false),
- mode: 'contained',
- disabled: true,
- })
- ).toMatchObject({
- backgroundColor: color(black).alpha(0.12).rgb().string(),
- });
- });
-
- it('should return correct theme color, for theme version 2, when disabled, dark theme, contained mode', () => {
- expect(
- getButtonColors({
- theme: getTheme(true, false),
- mode: 'contained',
- disabled: true,
- })
- ).toMatchObject({
- backgroundColor: color(white).alpha(0.12).rgb().string(),
- });
- });
-
- (['text', 'outlined'] as const).forEach((mode) =>
- it(`should return correct theme color, for theme version 2, ${mode} mode`, () => {
- expect(
- getButtonColors({
- theme: getTheme(false, false),
- mode,
- })
- ).toMatchObject({
- backgroundColor: 'transparent',
- });
- })
- );
-
- (['text', 'outlined'] as const).forEach((mode) =>
- it(`should return correct theme color, for theme version 2, dark theme, ${mode} mode`, () => {
- expect(
- getButtonColors({
- theme: getTheme(true, false),
- mode,
- })
- ).toMatchObject({
- backgroundColor: 'transparent',
- });
- })
- );
-
- (['text', 'outlined'] as const).forEach((mode) =>
- it(`should return correct theme color, for theme version 2, when disabled, ${mode} mode`, () => {
- expect(
- getButtonColors({
- theme: getTheme(false, false),
- mode,
- disabled: true,
- })
- ).toMatchObject({
- backgroundColor: 'transparent',
- });
- })
- );
-
- (['text', 'outlined'] as const).forEach((mode) =>
- it(`should return correct theme color, for theme version 2, when disabled, dark theme, ${mode} mode`, () => {
- expect(
- getButtonColors({
- theme: getTheme(true, false),
- mode,
- disabled: true,
- })
- ).toMatchObject({
- backgroundColor: 'transparent',
- });
- })
- );
});
describe('getButtonColors - text color', () => {
@@ -575,7 +490,8 @@ describe('getButtonColors - text color', () => {
mode: 'text',
})
).toMatchObject({
- textColor: getTheme().colors.onSurfaceDisabled,
+ textColor: getTheme().colors.onSurface,
+ textOpacity: stateOpacity.disabled,
});
});
@@ -588,7 +504,8 @@ describe('getButtonColors - text color', () => {
mode: 'text',
})
).toMatchObject({
- textColor: getTheme(true).colors.onSurfaceDisabled,
+ textColor: getTheme(true).colors.onSurface,
+ textOpacity: stateOpacity.disabled,
});
});
@@ -675,68 +592,6 @@ describe('getButtonColors - text color', () => {
textColor: getTheme(true).colors.onSecondaryContainer,
});
});
-
- it('should return correct theme text color, for theme version 2, when disabled, no matter what the mode is', () => {
- expect(
- getButtonColors({
- theme: getTheme(false, false),
- disabled: true,
- mode: 'text',
- })
- ).toMatchObject({
- textColor: color(black).alpha(0.32).rgb().string(),
- });
- });
-
- it('should return correct theme text color, for theme version 2, when disabled, dark theme, no matter what the mode is', () => {
- expect(
- getButtonColors({
- theme: getTheme(true, false),
- disabled: true,
- mode: 'text',
- })
- ).toMatchObject({
- textColor: color(white).alpha(0.32).rgb().string(),
- });
- });
-
- it('should return correct theme text color, for theme version 2, contained mode', () => {
- expect(
- getButtonColors({
- theme: getTheme(false, false),
- mode: 'contained',
- dark: true,
- })
- ).toMatchObject({
- textColor: '#ffffff',
- });
- });
-
- (['text', 'outlined'] as const).forEach((mode) =>
- it(`should return correct theme text color, for theme version 2, ${mode} mode`, () => {
- expect(
- getButtonColors({
- theme: getTheme(false, false),
- mode,
- })
- ).toMatchObject({
- textColor: getTheme(false, false).colors.primary,
- });
- })
- );
-
- (['text', 'outlined'] as const).forEach((mode) =>
- it(`should return correct theme text color, for theme version 2, dark theme, ${mode} mode`, () => {
- expect(
- getButtonColors({
- theme: getTheme(true, false),
- mode,
- })
- ).toMatchObject({
- textColor: getTheme(true, false).colors.primary,
- });
- })
- );
});
describe('getButtonColors - border color', () => {
@@ -748,7 +603,7 @@ describe('getButtonColors - border color', () => {
mode: 'outlined',
})
).toMatchObject({
- borderColor: getTheme().colors.surfaceDisabled,
+ borderColor: getTheme().colors.outlineVariant,
});
});
@@ -760,7 +615,7 @@ describe('getButtonColors - border color', () => {
mode: 'outlined',
})
).toMatchObject({
- borderColor: getTheme(true).colors.surfaceDisabled,
+ borderColor: getTheme(true).colors.outlineVariant,
});
});
@@ -771,7 +626,7 @@ describe('getButtonColors - border color', () => {
mode: 'outlined',
})
).toMatchObject({
- borderColor: getTheme().colors.outline,
+ borderColor: getTheme().colors.outlineVariant,
});
});
@@ -782,7 +637,7 @@ describe('getButtonColors - border color', () => {
mode: 'outlined',
})
).toMatchObject({
- borderColor: getTheme(true).colors.outline,
+ borderColor: getTheme(true).colors.outlineVariant,
});
});
@@ -813,56 +668,6 @@ describe('getButtonColors - border color', () => {
});
})
);
-
- it('should return correct border color, for theme version 2, outlined mode', () => {
- expect(
- getButtonColors({
- theme: getTheme(false, false),
- mode: 'outlined',
- })
- ).toMatchObject({
- borderColor: color(black).alpha(0.29).rgb().string(),
- });
- });
-
- it('should return correct border color, for theme version 2, dark theme, outlined mode', () => {
- expect(
- getButtonColors({
- theme: getTheme(true, false),
- mode: 'outlined',
- })
- ).toMatchObject({
- borderColor: color(white).alpha(0.29).rgb().string(),
- });
- });
-
- (['text', 'contained', 'contained-tonal', 'elevated'] as const).forEach(
- (mode) =>
- it(`should return transparent border, for theme version 2, ${mode} mode`, () => {
- expect(
- getButtonColors({
- theme: getTheme(false, false),
- mode,
- })
- ).toMatchObject({
- borderColor: 'transparent',
- });
- })
- );
-
- (['text', 'contained', 'contained-tonal', 'elevated'] as const).forEach(
- (mode) =>
- it(`should return transparent border, for theme version 2, dark theme, ${mode} mode`, () => {
- expect(
- getButtonColors({
- theme: getTheme(false, false),
- mode,
- })
- ).toMatchObject({
- borderColor: 'transparent',
- });
- })
- );
});
describe('getButtonColors - border width', () => {
@@ -877,17 +682,6 @@ describe('getButtonColors - border width', () => {
});
});
- it('should return correct border width, for theme version 2, outlined mode', () => {
- expect(
- getButtonColors({
- theme: getTheme(false, false),
- mode: 'outlined',
- })
- ).toMatchObject({
- borderWidth: StyleSheet.hairlineWidth,
- });
- });
-
(['text', 'contained', 'contained-tonal', 'elevated'] as const).forEach(
(mode) =>
it(`should return correct border width, for ${mode} mode`, () => {
diff --git a/src/components/__tests__/Card/Card.test.tsx b/src/components/__tests__/Card/Card.test.tsx
index 3da4aa2c51..a7dc736c62 100644
--- a/src/components/__tests__/Card/Card.test.tsx
+++ b/src/components/__tests__/Card/Card.test.tsx
@@ -2,10 +2,8 @@ import React from 'react';
import { Animated, StyleSheet, Text } from 'react-native';
import { act, render } from '@testing-library/react-native';
-import color from 'color';
import { getTheme } from '../../../core/theming';
-import { black, white } from '../../../styles/themes/v2/colors';
import { MD3Colors } from '../../../styles/themes/v3/tokens';
import Button from '../../Button/Button';
import Card from '../../Card/Card';
@@ -193,15 +191,6 @@ describe('getCardColors - background color', () => {
})
).toMatchObject({ backgroundColor: undefined });
});
-
- it('should return undefined, for theme version 2', () => {
- expect(
- getCardColors({
- theme: getTheme(false, false),
- mode: undefined as any,
- })
- ).toMatchObject({ backgroundColor: undefined });
- });
});
describe('getCardColors - border color', () => {
@@ -213,28 +202,6 @@ describe('getCardColors - border color', () => {
})
).toMatchObject({ borderColor: getTheme().colors.outline });
});
-
- it('should return correct color, for theme version 2, dark mode', () => {
- expect(
- getCardColors({
- theme: getTheme(true, false),
- mode: undefined as any,
- })
- ).toMatchObject({
- borderColor: color(white).alpha(0.12).rgb().string(),
- });
- });
-
- it('should return correct color, for theme version 2, light mode', () => {
- expect(
- getCardColors({
- theme: getTheme(false, false),
- mode: undefined as any,
- })
- ).toMatchObject({
- borderColor: color(black).alpha(0.12).rgb().string(),
- });
- });
});
describe('getCardCoverStyle - border radius', () => {
@@ -255,44 +222,6 @@ describe('getCardCoverStyle - border radius', () => {
})
).toMatchObject({ borderRadius: 3 * getTheme().roundness });
});
-
- it('should return correct border radius based on roundness, for theme version 2, when index is 0 and total is 1', () => {
- expect(
- getCardCoverStyle({
- theme: getTheme(false, false),
- borderRadiusStyles: {},
- index: 0,
- total: 1,
- })
- ).toMatchObject({ borderRadius: getTheme(false, false).roundness });
- });
-
- it('should return correct border radius based on roundness, for theme version 2, when index is 0 and total is other than 1', () => {
- expect(
- getCardCoverStyle({
- theme: getTheme(false, false),
- borderRadiusStyles: {},
- index: 0,
- total: 2,
- })
- ).toMatchObject({
- borderTopLeftRadius: getTheme(false, false).roundness,
- borderTopRightRadius: getTheme(false, false).roundness,
- });
- });
-
- it('should return correct border radius based on roundness, for theme version 2, when index is equal to total - 1', () => {
- expect(
- getCardCoverStyle({
- theme: getTheme(false, false),
- borderRadiusStyles: {},
- index: 1,
- total: 2,
- })
- ).toMatchObject({
- borderBottomLeftRadius: getTheme(false, false).roundness,
- });
- });
});
it('animated value changes correctly', () => {
diff --git a/src/components/__tests__/Card/__snapshots__/Card.test.tsx.snap b/src/components/__tests__/Card/__snapshots__/Card.test.tsx.snap
index 301eea942c..a5a8abd1ac 100644
--- a/src/components/__tests__/Card/__snapshots__/Card.test.tsx.snap
+++ b/src/components/__tests__/Card/__snapshots__/Card.test.tsx.snap
@@ -5,7 +5,7 @@ exports[`Card renders an outlined card 1`] = `
collapsable={false}
style={
{
- "backgroundColor": "rgba(255, 251, 254, 1)",
+ "backgroundColor": "rgba(254, 247, 255, 1)",
"borderRadius": 12,
"shadowColor": "#000",
"shadowOffset": {
@@ -22,7 +22,7 @@ exports[`Card renders an outlined card 1`] = `
collapsable={false}
style={
{
- "backgroundColor": "rgba(255, 251, 254, 1)",
+ "backgroundColor": "rgba(254, 247, 255, 1)",
"borderRadius": 12,
"flex": undefined,
"shadowColor": "#000",
diff --git a/src/components/__tests__/Checkbox/__snapshots__/CheckboxItem.test.tsx.snap b/src/components/__tests__/Checkbox/__snapshots__/CheckboxItem.test.tsx.snap
index b5f1d87e77..5c416c9720 100644
--- a/src/components/__tests__/Checkbox/__snapshots__/CheckboxItem.test.tsx.snap
+++ b/src/components/__tests__/Checkbox/__snapshots__/CheckboxItem.test.tsx.snap
@@ -147,7 +147,7 @@ exports[`can render leading checkbox control 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -163,9 +163,9 @@ exports[`can render leading checkbox control 1`] = `
"flexGrow": 1,
"flexShrink": 1,
},
- false,
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
+ "opacity": 1,
"textAlign": "right",
},
undefined,
@@ -245,7 +245,7 @@ exports[`can render the Android checkbox on different platforms 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -261,9 +261,9 @@ exports[`can render the Android checkbox on different platforms 1`] = `
"flexGrow": 1,
"flexShrink": 1,
},
- false,
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
+ "opacity": 1,
"textAlign": "left",
},
undefined,
@@ -325,6 +325,7 @@ exports[`can render the Android checkbox on different platforms 1`] = `
collapsable={false}
style={
{
+ "opacity": 1,
"transform": [
{
"scale": 1,
@@ -462,7 +463,7 @@ exports[`can render the iOS checkbox on different platforms 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -478,9 +479,9 @@ exports[`can render the iOS checkbox on different platforms 1`] = `
"flexGrow": 1,
"flexShrink": 1,
},
- false,
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
+ "opacity": 1,
"textAlign": "left",
},
undefined,
@@ -643,7 +644,7 @@ exports[`renders unchecked 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -659,9 +660,9 @@ exports[`renders unchecked 1`] = `
"flexGrow": 1,
"flexShrink": 1,
},
- false,
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
+ "opacity": 1,
"textAlign": "left",
},
undefined,
diff --git a/src/components/__tests__/Checkbox/utils.test.tsx b/src/components/__tests__/Checkbox/utils.test.tsx
index 580e3dbedf..799a343768 100644
--- a/src/components/__tests__/Checkbox/utils.test.tsx
+++ b/src/components/__tests__/Checkbox/utils.test.tsx
@@ -1,79 +1,10 @@
-import color from 'color';
-
import { getTheme } from '../../../core/theming';
+import { tokens } from '../../../styles/themes/v3/tokens';
import {
getAndroidSelectionControlColor,
getSelectionControlIOSColor,
} from '../../Checkbox/utils';
-
-describe('getAndroidSelectionControlColor - ripple color', () => {
- it('should return correct disabled color, for theme version 3', () => {
- expect(
- getAndroidSelectionControlColor({
- theme: getTheme(),
- disabled: true,
- checked: false,
- })
- ).toMatchObject({
- rippleColor: color(getTheme().colors.onSurface)
- .alpha(0.16)
- .rgb()
- .string(),
- });
- });
-
- it('should return correct disabled color, for theme version 2', () => {
- expect(
- getAndroidSelectionControlColor({
- theme: getTheme(false, false),
- disabled: true,
- checked: false,
- })
- ).toMatchObject({
- rippleColor: color(getTheme(false, false).colors.text)
- .alpha(0.16)
- .rgb()
- .string(),
- });
- });
-
- it('should return custom color', () => {
- expect(
- getAndroidSelectionControlColor({
- theme: getTheme(),
- customColor: 'purple',
- checked: false,
- })
- ).toMatchObject({
- rippleColor: color('purple').fade(0.32).rgb().string(),
- });
- });
-
- it('should return theme color, for theme version 3', () => {
- expect(
- getAndroidSelectionControlColor({
- theme: getTheme(),
- checked: false,
- })
- ).toMatchObject({
- rippleColor: color(getTheme().colors.primary).fade(0.32).rgb().string(),
- });
- });
-
- it('should return theme color, for theme version 2', () => {
- expect(
- getAndroidSelectionControlColor({
- theme: getTheme(false, false),
- checked: false,
- })
- ).toMatchObject({
- rippleColor: color(getTheme(false, false).colors.accent)
- .fade(0.32)
- .rgb()
- .string(),
- });
- });
-});
+const { stateOpacity } = tokens.md.ref;
describe('getAndroidSelectionControlColor - checkbox color', () => {
it('should return correct disabled color, for theme version 3', () => {
@@ -84,19 +15,8 @@ describe('getAndroidSelectionControlColor - checkbox color', () => {
checked: false,
})
).toMatchObject({
- selectionControlColor: getTheme().colors.onSurfaceDisabled,
- });
- });
-
- it('should return correct disabled color, for theme version 2', () => {
- expect(
- getAndroidSelectionControlColor({
- theme: getTheme(false, false),
- disabled: true,
- checked: false,
- })
- ).toMatchObject({
- selectionControlColor: getTheme(false, false).colors.disabled,
+ selectionControlColor: getTheme().colors.onSurface,
+ selectionControlOpacity: stateOpacity.disabled,
});
});
@@ -123,17 +43,6 @@ describe('getAndroidSelectionControlColor - checkbox color', () => {
});
});
- it('should return theme color, for theme version 2, checked', () => {
- expect(
- getAndroidSelectionControlColor({
- theme: getTheme(false, false),
- checked: true,
- })
- ).toMatchObject({
- selectionControlColor: getTheme(false, false).colors.accent,
- });
- });
-
it('should return custom color, unchecked', () => {
expect(
getAndroidSelectionControlColor({
@@ -157,95 +66,25 @@ describe('getAndroidSelectionControlColor - checkbox color', () => {
});
});
- it('should return theme color, for theme version 2, unchecked, dark mode', () => {
+ it('should return theme color, unchecked, dark mode', () => {
expect(
getAndroidSelectionControlColor({
- theme: getTheme(true, false),
+ theme: getTheme(true),
checked: false,
})
).toMatchObject({
- selectionControlColor: color(getTheme(true, false).colors.text)
- .alpha(0.7)
- .rgb()
- .string(),
+ selectionControlColor: getTheme(true).colors.onSurfaceVariant,
});
});
- it('should return theme color, for theme version 2, unchecked, light mode', () => {
+ it('should return theme color, unchecked, light mode', () => {
expect(
getAndroidSelectionControlColor({
- theme: getTheme(false, false),
+ theme: getTheme(false),
checked: false,
})
).toMatchObject({
- selectionControlColor: color(getTheme(false, false).colors.text)
- .alpha(0.54)
- .rgb()
- .string(),
- });
- });
-});
-
-describe('getSelectionControlIOSColor - ripple color', () => {
- it('should return correct disabled color, for theme version 3', () => {
- expect(
- getSelectionControlIOSColor({
- theme: getTheme(),
- disabled: true,
- })
- ).toMatchObject({
- rippleColor: color(getTheme().colors.onSurface)
- .alpha(0.16)
- .rgb()
- .string(),
- });
- });
-
- it('should return correct disabled color, for theme version 2', () => {
- expect(
- getSelectionControlIOSColor({
- theme: getTheme(false, false),
- disabled: true,
- })
- ).toMatchObject({
- rippleColor: color(getTheme(false, false).colors.text)
- .alpha(0.16)
- .rgb()
- .string(),
- });
- });
-
- it('should return custom color', () => {
- expect(
- getSelectionControlIOSColor({
- theme: getTheme(),
- customColor: 'purple',
- })
- ).toMatchObject({
- rippleColor: color('purple').fade(0.32).rgb().string(),
- });
- });
-
- it('should return theme color, for theme version 3', () => {
- expect(
- getSelectionControlIOSColor({
- theme: getTheme(),
- })
- ).toMatchObject({
- rippleColor: color(getTheme().colors.primary).fade(0.32).rgb().string(),
- });
- });
-
- it('should return theme color, for theme version 2', () => {
- expect(
- getSelectionControlIOSColor({
- theme: getTheme(false, false),
- })
- ).toMatchObject({
- rippleColor: color(getTheme(false, false).colors.accent)
- .fade(0.32)
- .rgb()
- .string(),
+ selectionControlColor: getTheme(false).colors.onSurfaceVariant,
});
});
});
@@ -258,18 +97,8 @@ describe('getSelectionControlIOSColor - checked color', () => {
disabled: true,
})
).toMatchObject({
- checkedColor: getTheme().colors.onSurfaceDisabled,
- });
- });
-
- it('should return correct disabled color, for theme version 2', () => {
- expect(
- getSelectionControlIOSColor({
- theme: getTheme(false, false),
- disabled: true,
- })
- ).toMatchObject({
- checkedColor: getTheme(false, false).colors.disabled,
+ checkedColor: getTheme().colors.primary,
+ checkedColorOpacity: stateOpacity.disabled,
});
});
@@ -293,14 +122,4 @@ describe('getSelectionControlIOSColor - checked color', () => {
checkedColor: getTheme().colors.primary,
});
});
-
- it('should return theme color, for theme version 2, checked', () => {
- expect(
- getSelectionControlIOSColor({
- theme: getTheme(false, false),
- })
- ).toMatchObject({
- checkedColor: getTheme(false, false).colors.accent,
- });
- });
});
diff --git a/src/components/__tests__/Chip.test.tsx b/src/components/__tests__/Chip.test.tsx
index ca3055e35b..76044715b2 100644
--- a/src/components/__tests__/Chip.test.tsx
+++ b/src/components/__tests__/Chip.test.tsx
@@ -5,10 +5,12 @@ import { act, render } from '@testing-library/react-native';
import color from 'color';
import { getTheme } from '../../core/theming';
-import { black, white } from '../../styles/themes/v2/colors';
+import { tokens } from '../../styles/themes/v3/tokens';
import Chip from '../Chip/Chip';
import { getChipColors } from '../Chip/helpers';
+const { stateOpacity } = tokens.md.ref;
+
it('renders chip with onPress', () => {
const tree = render( {}}>Example Chip).toJSON();
@@ -100,19 +102,8 @@ describe('getChipColors - text color', () => {
isOutlined: false,
})
).toMatchObject({
- textColor: getTheme().colors.onSurfaceDisabled,
- });
- });
-
- it('should return correct disabled color, for theme version 2', () => {
- expect(
- getChipColors({
- disabled: true,
- theme: getTheme(false, false),
- isOutlined: false,
- })
- ).toMatchObject({
- textColor: getTheme(false, false).colors.disabled,
+ textColor: getTheme().colors.onSurface,
+ contentOpacity: stateOpacity.disabled,
});
});
@@ -138,20 +129,6 @@ describe('getChipColors - text color', () => {
});
});
- it('should return correct theme color, for theme version 2', () => {
- expect(
- getChipColors({
- theme: getTheme(false, false),
- isOutlined: false,
- })
- ).toMatchObject({
- textColor: color(getTheme(false, false).colors.text)
- .alpha(0.87)
- .rgb()
- .string(),
- });
- });
-
it('should return custom color, for theme version 3', () => {
expect(
getChipColors({
@@ -163,18 +140,6 @@ describe('getChipColors - text color', () => {
textColor: 'purple',
});
});
-
- it('should return custom color, for theme version 2', () => {
- expect(
- getChipColors({
- theme: getTheme(false, false),
- selectedColor: 'purple',
- isOutlined: false,
- })
- ).toMatchObject({
- textColor: color('purple').alpha(0.87).rgb().string(),
- });
- });
});
describe('getChipColors - icon color', () => {
@@ -186,19 +151,8 @@ describe('getChipColors - icon color', () => {
isOutlined: false,
})
).toMatchObject({
- iconColor: getTheme().colors.onSurfaceDisabled,
- });
- });
-
- it('should return correct disabled color, for theme version 2', () => {
- expect(
- getChipColors({
- disabled: true,
- theme: getTheme(false, false),
- isOutlined: false,
- })
- ).toMatchObject({
- iconColor: getTheme(false, false).colors.disabled,
+ iconColor: getTheme().colors.onSurface,
+ contentOpacity: stateOpacity.disabled,
});
});
@@ -224,20 +178,6 @@ describe('getChipColors - icon color', () => {
});
});
- it('should return correct theme color, for theme version 2', () => {
- expect(
- getChipColors({
- theme: getTheme(false, false),
- isOutlined: false,
- })
- ).toMatchObject({
- iconColor: color(getTheme(false, false).colors.text)
- .alpha(0.54)
- .rgb()
- .string(),
- });
- });
-
it('should return custom color, for theme version 3', () => {
expect(
getChipColors({
@@ -249,246 +189,30 @@ describe('getChipColors - icon color', () => {
iconColor: 'purple',
});
});
-
- it('should return custom color, for theme version 2', () => {
- expect(
- getChipColors({
- theme: getTheme(false, false),
- selectedColor: 'purple',
- isOutlined: false,
- })
- ).toMatchObject({
- iconColor: color('purple').alpha(0.54).rgb().string(),
- });
- });
-});
-
-describe('getChipColors - ripple color', () => {
- it('should return theme color, for theme version 3, flat mode', () => {
- expect(
- getChipColors({
- theme: getTheme(),
- isOutlined: false,
- })
- ).toMatchObject({
- rippleColor: color(getTheme().colors.onSecondaryContainer)
- .alpha(0.12)
- .rgb()
- .string(),
- });
- });
-
- it('should return theme color, for theme version 3, outline mode', () => {
- expect(
- getChipColors({
- theme: getTheme(),
- isOutlined: true,
- })
- ).toMatchObject({
- rippleColor: color(getTheme().colors.onSurfaceVariant)
- .alpha(0.12)
- .rgb()
- .string(),
- });
- });
-
- it('should return custom color, for theme version 3', () => {
- expect(
- getChipColors({
- theme: getTheme(),
- selectedColor: 'purple',
- isOutlined: false,
- })
- ).toMatchObject({
- rippleColor: color('purple').alpha(0.12).rgb().string(),
- });
- });
-
- it('should return custom color, for theme version 2', () => {
- expect(
- getChipColors({
- theme: getTheme(false, false),
- selectedColor: 'purple',
- isOutlined: false,
- })
- ).toMatchObject({
- rippleColor: color('purple').fade(0.5).rgb().string(),
- });
- });
-
- it('should return custom color, for theme version 2, dark mode, outline mode, customBackgroundColor', () => {
- expect(
- getChipColors({
- theme: getTheme(true, false),
- customBackgroundColor: 'purple',
- isOutlined: true,
- })
- ).toMatchObject({
- rippleColor: color('purple').lighten(0.2).rgb().string(),
- });
- });
-
- it('should return custom color, for theme version 2, dark mode, flat mode, customBackgroundColor', () => {
- expect(
- getChipColors({
- theme: getTheme(true, false),
- customBackgroundColor: 'purple',
- isOutlined: false,
- })
- ).toMatchObject({
- rippleColor: color('purple').lighten(0.4).rgb().string(),
- });
- });
-
- it('should return custom color, for theme version 2, light mode, outline mode, customBackgroundColor', () => {
- expect(
- getChipColors({
- theme: getTheme(false, false),
- customBackgroundColor: 'purple',
- isOutlined: true,
- })
- ).toMatchObject({
- rippleColor: color('purple').darken(0.08).rgb().string(),
- });
- });
-
- it('should return custom color, for theme version 2, light mode, flat mode, customBackgroundColor', () => {
- expect(
- getChipColors({
- theme: getTheme(false, false),
- customBackgroundColor: 'purple',
- isOutlined: false,
- })
- ).toMatchObject({
- rippleColor: color('purple').darken(0.2).rgb().string(),
- });
- });
-
- it('should return theme color, for theme version 2, light mode, outline mode', () => {
- expect(
- getChipColors({
- theme: getTheme(false, false),
- isOutlined: true,
- })
- ).toMatchObject({
- rippleColor: color(getTheme(false, false).colors.surface)
- .darken(0.08)
- .rgb()
- .string(),
- });
- });
-
- it('should return theme color, for theme version 2, light mode, flat mode', () => {
- expect(
- getChipColors({
- theme: getTheme(false, false),
- isOutlined: false,
- })
- ).toMatchObject({
- rippleColor: color('#ebebeb').darken(0.2).rgb().string(),
- });
- });
-
- it('should return theme color, for theme version 2, dark mode, outline mode', () => {
- expect(
- getChipColors({
- theme: getTheme(true, false),
- isOutlined: true,
- })
- ).toMatchObject({
- rippleColor: color(getTheme(true, false).colors.surface)
- .lighten(0.2)
- .rgb()
- .string(),
- });
- });
-
- it('should return theme color, for theme version 2, dark mode, flat mode', () => {
- expect(
- getChipColors({
- theme: getTheme(true, false),
- isOutlined: false,
- })
- ).toMatchObject({
- rippleColor: color('#383838').lighten(0.4).rgb().string(),
- });
- });
});
describe('getChipColor - selected background color', () => {
- it('should return custom color, for theme version 3, outlined mode', () => {
- expect(
- getChipColors({
- theme: getTheme(),
- customBackgroundColor: 'purple',
- isOutlined: true,
- })
- ).toMatchObject({
- selectedBackgroundColor: color('purple')
- .mix(color(getTheme().colors.onSurfaceVariant), 0)
- .rgb()
- .string(),
- });
- });
-
- it('should return custom color, for theme version 3, flat mode', () => {
- expect(
- getChipColors({
- theme: getTheme(),
- customBackgroundColor: 'purple',
- isOutlined: false,
- })
- ).toMatchObject({
- selectedBackgroundColor: color('purple')
- .mix(color(getTheme().colors.onSecondaryContainer), 0)
- .rgb()
- .string(),
- });
- });
-
- it('should return custom color, for theme version 3, outlined mode, show selected overlay', () => {
+ it('should return custom color, outlined mode', () => {
expect(
getChipColors({
theme: getTheme(),
customBackgroundColor: 'purple',
- showSelectedOverlay: true,
isOutlined: true,
})
).toMatchObject({
- selectedBackgroundColor: color('purple')
- .mix(color(getTheme().colors.onSurfaceVariant), 0.12)
- .rgb()
- .string(),
+ selectedBackgroundColor: 'purple',
});
});
- it('should return custom color, for theme version 3, flat mode, show selected overlay', () => {
+ it('should return custom color, flat mode', () => {
expect(
getChipColors({
theme: getTheme(),
customBackgroundColor: 'purple',
- showSelectedOverlay: true,
isOutlined: false,
})
).toMatchObject({
- selectedBackgroundColor: color('purple')
- .mix(color(getTheme().colors.onSecondaryContainer), 0.12)
- .rgb()
- .string(),
- });
- });
-
- it('should return theme color, for theme version 3, outlined mode', () => {
- expect(
- getChipColors({
- theme: getTheme(),
- isOutlined: true,
- })
- ).toMatchObject({
- selectedBackgroundColor: color(getTheme().colors.surface)
- .mix(color(getTheme().colors.onSurfaceVariant), 0)
- .rgb()
- .string(),
+ selectedBackgroundColor: 'purple',
});
});
@@ -499,94 +223,7 @@ describe('getChipColor - selected background color', () => {
isOutlined: false,
})
).toMatchObject({
- selectedBackgroundColor: color(getTheme().colors.secondaryContainer)
- .mix(color(getTheme().colors.onSecondaryContainer), 0)
- .rgb()
- .string(),
- });
- });
-
- it('should return custom color, for theme version 2, light mode, outlined mode', () => {
- expect(
- getChipColors({
- theme: getTheme(false, false),
- customBackgroundColor: 'purple',
- isOutlined: true,
- })
- ).toMatchObject({
- selectedBackgroundColor: color('purple').darken(0.08).rgb().string(),
- });
- });
-
- it('should return custom color, for theme version 2, light mode, flat mode', () => {
- expect(
- getChipColors({
- theme: getTheme(false, false),
- customBackgroundColor: 'purple',
- isOutlined: false,
- })
- ).toMatchObject({
- selectedBackgroundColor: color('purple').darken(0.2).rgb().string(),
- });
- });
-
- it('should return custom color, for theme version 2, dark mode, outlined mode', () => {
- expect(
- getChipColors({
- theme: getTheme(true, false),
- customBackgroundColor: 'purple',
- isOutlined: true,
- })
- ).toMatchObject({
- selectedBackgroundColor: color('purple').lighten(0.2).rgb().string(),
- });
- });
-
- it('should return custom color, for theme version 2, dark mode, flat mode', () => {
- expect(
- getChipColors({
- theme: getTheme(true, false),
- customBackgroundColor: 'purple',
- isOutlined: false,
- })
- ).toMatchObject({
- selectedBackgroundColor: color('purple').lighten(0.4).rgb().string(),
- });
- });
-
- it('should return theme color, for theme version 2, outlined mode', () => {
- expect(
- getChipColors({
- theme: getTheme(false, false),
- isOutlined: true,
- })
- ).toMatchObject({
- selectedBackgroundColor: color(getTheme(false, false).colors.surface)
- .darken(0.08)
- .rgb()
- .string(),
- });
- });
-
- it('should return theme color, for theme version 2, light mode, flat mode', () => {
- expect(
- getChipColors({
- theme: getTheme(false, false),
- isOutlined: false,
- })
- ).toMatchObject({
- selectedBackgroundColor: color('#ebebeb').darken(0.2).rgb().string(),
- });
- });
-
- it('should return theme color, for theme version 2, dark mode, flat mode', () => {
- expect(
- getChipColors({
- theme: getTheme(true, false),
- isOutlined: false,
- })
- ).toMatchObject({
- selectedBackgroundColor: color('#383838').lighten(0.4).rgb().string(),
+ selectedBackgroundColor: getTheme().colors.secondaryContainer,
});
});
});
@@ -625,39 +262,6 @@ describe('getChipColor - background color', () => {
backgroundColor: getTheme().colors.secondaryContainer,
});
});
-
- it('should return theme color, for theme version 2, outlined mode', () => {
- expect(
- getChipColors({
- theme: getTheme(false, false),
- isOutlined: true,
- })
- ).toMatchObject({
- backgroundColor: getTheme(false, false).colors.surface,
- });
- });
-
- it('should return theme color, for theme version 2, light mode, flat mode', () => {
- expect(
- getChipColors({
- theme: getTheme(false, false),
- isOutlined: false,
- })
- ).toMatchObject({
- backgroundColor: '#ebebeb',
- });
- });
-
- it('should return theme color, for theme version 2, dark mode, flat mode', () => {
- expect(
- getChipColors({
- theme: getTheme(true, false),
- isOutlined: false,
- })
- ).toMatchObject({
- backgroundColor: '#383838',
- });
- });
});
describe('getChipColor - border color', () => {
@@ -696,10 +300,10 @@ describe('getChipColor - border color', () => {
});
});
- it('should return custom color, for theme version 2, outlined mode', () => {
+ it('should return custom color, outlined mode', () => {
expect(
getChipColors({
- theme: getTheme(false, false),
+ theme: getTheme(false),
selectedColor: 'purple',
isOutlined: true,
})
@@ -708,59 +312,59 @@ describe('getChipColor - border color', () => {
});
});
- it('should return custom color, for theme version 2, flat mode', () => {
+ it('should return custom color, flat mode', () => {
expect(
getChipColors({
- theme: getTheme(true, false),
+ theme: getTheme(true),
customBackgroundColor: 'purple',
isOutlined: false,
})
).toMatchObject({
- borderColor: 'purple',
+ borderColor: 'transparent',
});
});
- it('should return theme color, for theme version 2, light mode, outlined mode', () => {
+ it('should return theme color, light mode, outlined mode', () => {
expect(
getChipColors({
- theme: getTheme(false, false),
+ theme: getTheme(false),
isOutlined: true,
})
).toMatchObject({
- borderColor: color(black).alpha(0.29).rgb().string(),
+ borderColor: getTheme(false).colors.outlineVariant,
});
});
- it('should return theme color, for theme version 2, dark mode, outlined mode', () => {
+ it('should return theme color, dark mode, outlined mode', () => {
expect(
getChipColors({
- theme: getTheme(true, false),
+ theme: getTheme(true),
isOutlined: true,
})
).toMatchObject({
- borderColor: color(white).alpha(0.29).rgb().string(),
+ borderColor: getTheme(true).colors.outlineVariant,
});
});
- it('should return theme background color, for theme version 2, light mode, flat mode', () => {
+ it('should return theme background color, light mode, flat mode', () => {
expect(
getChipColors({
- theme: getTheme(false, false),
+ theme: getTheme(false),
isOutlined: false,
})
).toMatchObject({
- borderColor: '#ebebeb',
+ borderColor: 'transparent',
});
});
- it('should return theme background color, for theme version 2, dark mode, flat mode', () => {
+ it('should return theme background color, dark mode, flat mode', () => {
expect(
getChipColors({
- theme: getTheme(true, false),
+ theme: getTheme(true),
isOutlined: false,
})
).toMatchObject({
- borderColor: '#383838',
+ borderColor: 'transparent',
});
});
});
diff --git a/src/components/__tests__/FAB.test.tsx b/src/components/__tests__/FAB.test.tsx
index d59639efc1..9fc9c12e98 100644
--- a/src/components/__tests__/FAB.test.tsx
+++ b/src/components/__tests__/FAB.test.tsx
@@ -2,12 +2,9 @@ import * as React from 'react';
import { Animated, StyleSheet } from 'react-native';
import { fireEvent, render } from '@testing-library/react-native';
-import color from 'color';
import { act } from 'react-test-renderer';
import { getTheme } from '../../core/theming';
-import { black, white } from '../../styles/themes/v2/colors';
-import getContrastingColor from '../../utils/getContrastingColor';
import FAB from '../FAB';
import { getFABColors } from '../FAB/utils';
@@ -94,12 +91,6 @@ it('renders loading FAB with custom size prop', () => {
expect(tree).toMatchSnapshot();
});
-it('renders disabled FAB', () => {
- const tree = render( {}} icon="plus" disabled />).toJSON();
-
- expect(tree).toMatchSnapshot();
-});
-
it('renders custom color for the icon and label of the FAB', () => {
const tree = render(
{}} icon="plus" color="#AA0114" />
@@ -199,43 +190,7 @@ describe('getFABColors - background color', () => {
});
});
- it('should return correct disabled color, for theme version 3', () => {
- expect(
- getFABColors({
- theme: getTheme(),
- disabled: true,
- variant: 'primary',
- })
- ).toMatchObject({
- backgroundColor: getTheme().colors.surfaceDisabled,
- });
- });
-
- it('should return correct disabled color, for theme version 2, light mode', () => {
- expect(
- getFABColors({
- theme: getTheme(false, false),
- disabled: true,
- variant: 'primary',
- })
- ).toMatchObject({
- backgroundColor: color(black).alpha(0.12).rgb().string(),
- });
- });
-
- it('should return correct disabled color, for theme version 2, dark mode', () => {
- expect(
- getFABColors({
- theme: getTheme(true, false),
- disabled: true,
- variant: 'primary',
- })
- ).toMatchObject({
- backgroundColor: color(white).alpha(0.12).rgb().string(),
- });
- });
-
- it('should return correct theme color, for theme version 3, primary variant', () => {
+ it('should return correct theme color, primary variant', () => {
expect(
getFABColors({
theme: getTheme(),
@@ -275,18 +230,7 @@ describe('getFABColors - background color', () => {
variant: 'surface',
})
).toMatchObject({
- backgroundColor: getTheme().colors.elevation.level3,
- });
- });
-
- it('should return correct theme color, for theme version 2', () => {
- expect(
- getFABColors({
- theme: getTheme(false, false),
- variant: 'primary',
- })
- ).toMatchObject({
- backgroundColor: getTheme(false, false).colors.accent,
+ backgroundColor: getTheme().colors.surfaceContainerHigh,
});
});
});
@@ -304,43 +248,7 @@ describe('getFABColors - foreground color', () => {
});
});
- it('should return correct disabled color, for theme version 3', () => {
- expect(
- getFABColors({
- theme: getTheme(),
- variant: 'primary',
- disabled: true,
- })
- ).toMatchObject({
- foregroundColor: getTheme().colors.onSurfaceDisabled,
- });
- });
-
- it('should return correct disabled color, for theme version 2, light mode', () => {
- expect(
- getFABColors({
- theme: getTheme(false, false),
- disabled: true,
- variant: 'primary',
- })
- ).toMatchObject({
- foregroundColor: color(black).alpha(0.32).rgb().string(),
- });
- });
-
- it('should return correct disabled color, for theme version 2, dark mode', () => {
- expect(
- getFABColors({
- theme: getTheme(true, false),
- disabled: true,
- variant: 'primary',
- })
- ).toMatchObject({
- foregroundColor: color(white).alpha(0.32).rgb().string(),
- });
- });
-
- it('should return correct theme color, for theme version 3, primary variant', () => {
+ it('should return correct theme color, primary variant', () => {
expect(
getFABColors({
theme: getTheme(),
@@ -383,21 +291,6 @@ describe('getFABColors - foreground color', () => {
foregroundColor: getTheme().colors.primary,
});
});
-
- it('should return correct theme color, for theme version 2', () => {
- expect(
- getFABColors({
- theme: getTheme(false, false),
- variant: 'primary',
- })
- ).toMatchObject({
- foregroundColor: getContrastingColor(
- getTheme(false, false).colors.accent,
- white,
- 'rgba(0, 0, 0, .54)'
- ),
- });
- });
});
it('animated value changes correctly', () => {
diff --git a/src/components/__tests__/FABGroup.test.tsx b/src/components/__tests__/FABGroup.test.tsx
index 50cc0a7173..5f25e46c6f 100644
--- a/src/components/__tests__/FABGroup.test.tsx
+++ b/src/components/__tests__/FABGroup.test.tsx
@@ -2,7 +2,6 @@ import * as React from 'react';
import { Animated } from 'react-native';
import { act, fireEvent, render } from '@testing-library/react-native';
-import color from 'color';
import { getTheme } from '../../core/theming';
import FAB from '../FAB';
@@ -26,55 +25,42 @@ describe('getFABGroupColors - backdrop color', () => {
theme: getTheme(),
})
).toMatchObject({
- backdropColor: color(getTheme().colors.background)
- .alpha(0.95)
- .rgb()
- .string(),
- });
- });
-
- it('should return correct backdrop color, for theme version 2', () => {
- expect(
- getFABGroupColors({
- theme: getTheme(false, false),
- })
- ).toMatchObject({
- backdropColor: getTheme(false, false).colors.backdrop,
+ backdropColor: getTheme().colors.background,
});
});
});
-describe('getFABGroupColors - label color', () => {
- it('should return correct theme color, for theme version 3', () => {
+describe('getFABGroupColors - backdrop opacity', () => {
+ it('should return scrimAlpha when no custom backdrop color', () => {
expect(
getFABGroupColors({
theme: getTheme(),
})
).toMatchObject({
- labelColor: getTheme().colors.onSurface,
+ backdropOpacity: 0.95,
});
});
- it('should return correct theme color, dark mode, for theme version 2', () => {
+ it('should return 1 when custom backdrop color is provided', () => {
expect(
getFABGroupColors({
- theme: getTheme(true, false),
+ theme: getTheme(),
+ customBackdropColor: 'transparent',
})
).toMatchObject({
- labelColor: getTheme(true, false).colors.text,
+ backdropOpacity: 1,
});
});
+});
- it('should return correct theme color, light mode, for theme version 2', () => {
+describe('getFABGroupColors - label color', () => {
+ it('should return correct theme color, for theme version 3', () => {
expect(
getFABGroupColors({
- theme: getTheme(false, false),
+ theme: getTheme(),
})
).toMatchObject({
- labelColor: color(getTheme(false, false).colors.text)
- .fade(0.54)
- .rgb()
- .string(),
+ labelColor: getTheme().colors.onSurface,
});
});
});
@@ -86,17 +72,7 @@ describe('getFABGroupColors - stacked FAB background color', () => {
theme: getTheme(),
})
).toMatchObject({
- stackedFABBackgroundColor: getTheme().colors.elevation.level3,
- });
- });
-
- it('should return correct theme color, dark mode, for theme version 2', () => {
- expect(
- getFABGroupColors({
- theme: getTheme(false, false),
- })
- ).toMatchObject({
- stackedFABBackgroundColor: getTheme(false, false).colors.surface,
+ stackedFABBackgroundColor: getTheme().colors.surfaceContainerHigh,
});
});
});
@@ -180,37 +156,6 @@ it('correctly adds label prop', () => {
expect(getByText('Label test')).toBeTruthy();
});
-it('correct renders custom ripple color passed to FAB.Group and its item', () => {
- const { getByTestId } = render(
- {}}
- actions={[
- {
- label: 'testing',
- onPress() {},
- icon: '',
- rippleColor: 'yellow',
- testID: 'fab-group-item',
- },
- ]}
- />
- );
-
- expect(
- getByTestId('fab-group-container').props.children.props.rippleColor
- ).toBe('orange');
-
- expect(
- getByTestId('fab-group-item-container').props.children.props.rippleColor
- ).toBe('yellow');
-});
-
it('animated value changes correctly', () => {
const value = new Animated.Value(1);
const { getByTestId } = render(
diff --git a/src/components/__tests__/IconButton.test.tsx b/src/components/__tests__/IconButton.test.tsx
index 381ea5ae24..fdd3316850 100644
--- a/src/components/__tests__/IconButton.test.tsx
+++ b/src/components/__tests__/IconButton.test.tsx
@@ -2,13 +2,15 @@ import * as React from 'react';
import { Animated, StyleSheet } from 'react-native';
import { act, render } from '@testing-library/react-native';
-import color from 'color';
import { getTheme } from '../../core/theming';
import { pink500 } from '../../styles/themes/v2/colors';
+import { tokens } from '../../styles/themes/v3/tokens';
import IconButton from '../IconButton/IconButton';
import { getIconButtonColor } from '../IconButton/utils';
+const { stateOpacity } = tokens.md.ref;
+
const styles = StyleSheet.create({
square: {
borderRadius: 0,
@@ -97,7 +99,8 @@ describe('getIconButtonColor - icon color', () => {
disabled: true,
})
).toMatchObject({
- iconColor: getTheme().colors.onSurfaceDisabled,
+ iconColor: getTheme().colors.onSurface,
+ iconOpacity: stateOpacity.disabled,
});
});
@@ -190,16 +193,6 @@ describe('getIconButtonColor - icon color', () => {
iconColor: getTheme().colors.primary,
});
});
-
- it('should return theme icon color, for theme version 2', () => {
- expect(
- getIconButtonColor({
- theme: getTheme(false, false),
- })
- ).toMatchObject({
- iconColor: getTheme(false, false).colors.text,
- });
- });
});
describe('getIconButtonColor - background color', () => {
@@ -222,7 +215,10 @@ describe('getIconButtonColor - background color', () => {
mode,
disabled: true,
})
- ).toMatchObject({ backgroundColor: getTheme().colors.surfaceDisabled });
+ ).toMatchObject({
+ backgroundColor: getTheme().colors.onSurface,
+ backgroundOpacity: stateOpacity.disabled,
+ });
})
);
@@ -303,55 +299,17 @@ describe('getIconButtonColor - border color', () => {
disabled: true,
})
).toMatchObject({
- borderColor: getTheme().colors.surfaceDisabled,
- });
- });
-
- it('should return theme color, for theme version 3', () => {
- expect(
- getIconButtonColor({
- theme: getTheme(),
- })
- ).toMatchObject({
- borderColor: getTheme().colors.outline,
- });
- });
-
- it('should return undefined, for theme version 2', () => {
- expect(
- getIconButtonColor({
- theme: getTheme(false, false),
- })
- ).toMatchObject({
- borderColor: undefined,
+ borderColor: getTheme().colors.outlineVariant,
});
});
-});
-describe('getIconButtonColor - ripple color', () => {
it('should return theme color, for theme version 3', () => {
expect(
getIconButtonColor({
theme: getTheme(),
})
).toMatchObject({
- rippleColor: color(getTheme().colors.onSurfaceVariant)
- .alpha(0.12)
- .rgb()
- .string(),
- });
- });
-
- it('should return theme color, for theme version 2', () => {
- expect(
- getIconButtonColor({
- theme: getTheme(false, false),
- })
- ).toMatchObject({
- rippleColor: color(getTheme(false, false).colors.text)
- .alpha(0.32)
- .rgb()
- .string(),
+ borderColor: getTheme().colors.outlineVariant,
});
});
});
diff --git a/src/components/__tests__/ListAccordion.test.tsx b/src/components/__tests__/ListAccordion.test.tsx
index 0c24538348..65a6a9d4de 100644
--- a/src/components/__tests__/ListAccordion.test.tsx
+++ b/src/components/__tests__/ListAccordion.test.tsx
@@ -2,7 +2,6 @@ import * as React from 'react';
import { StyleSheet, View } from 'react-native';
import { render } from '@testing-library/react-native';
-import color from 'color';
import { getTheme } from '../../core/theming';
import { red500 } from '../../styles/themes/v2/colors';
@@ -115,31 +114,6 @@ describe('ListAccordion', () => {
});
});
-describe('getAccordionColors - title color', () => {
- it('should return theme color, for theme version 3', () => {
- expect(
- getAccordionColors({
- theme: getTheme(),
- })
- ).toMatchObject({
- titleColor: getTheme().colors.onSurface,
- });
- });
-
- it('should return theme color, for theme version 2', () => {
- expect(
- getAccordionColors({
- theme: getTheme(false, false),
- })
- ).toMatchObject({
- titleColor: color(getTheme(false, false).colors.text)
- .alpha(0.87)
- .rgb()
- .string(),
- });
- });
-});
-
describe('getAccordionColors - description color', () => {
it('should return theme color, for theme version 3', () => {
expect(
@@ -150,19 +124,6 @@ describe('getAccordionColors - description color', () => {
descriptionColor: getTheme().colors.onSurfaceVariant,
});
});
-
- it('should return theme color, for theme version 2', () => {
- expect(
- getAccordionColors({
- theme: getTheme(false, false),
- })
- ).toMatchObject({
- descriptionColor: color(getTheme(false, false).colors.text)
- .alpha(0.54)
- .rgb()
- .string(),
- });
- });
});
describe('getAccordionColors - title text color', () => {
@@ -176,19 +137,6 @@ describe('getAccordionColors - title text color', () => {
});
});
- it('should return theme color, for theme version 2', () => {
- expect(
- getAccordionColors({
- theme: getTheme(false, false),
- })
- ).toMatchObject({
- titleTextColor: color(getTheme(false, false).colors.text)
- .alpha(0.87)
- .rgb()
- .string(),
- });
- });
-
it('should return primary color if it is expanded', () => {
expect(
getAccordionColors({
@@ -200,44 +148,3 @@ describe('getAccordionColors - title text color', () => {
});
});
});
-
-describe('getAccordionColors - ripple color', () => {
- it('should return theme color, for theme version 3', () => {
- expect(
- getAccordionColors({
- theme: getTheme(),
- })
- ).toMatchObject({
- rippleColor: color(getTheme().colors.onSurface)
- .alpha(0.12)
- .rgb()
- .string(),
- });
- });
-
- it('should return theme color, for theme version 2', () => {
- const v2TextColor = color(getTheme(false, false).colors.text)
- .alpha(0.87)
- .rgb()
- .string();
-
- expect(
- getAccordionColors({
- theme: getTheme(false, false),
- })
- ).toMatchObject({
- rippleColor: color(v2TextColor).alpha(0.12).rgb().string(),
- });
- });
-
- it('should return primary color if it is expanded', () => {
- expect(
- getAccordionColors({
- theme: getTheme(),
- isExpanded: true,
- })
- ).toMatchObject({
- rippleColor: color(getTheme().colors.primary).alpha(0.12).rgb().string(),
- });
- });
-});
diff --git a/src/components/__tests__/ListUtils.test.tsx b/src/components/__tests__/ListUtils.test.tsx
index 4aeefb6ca9..a9889834d8 100644
--- a/src/components/__tests__/ListUtils.test.tsx
+++ b/src/components/__tests__/ListUtils.test.tsx
@@ -5,18 +5,11 @@ import { getLeftStyles, getRightStyles } from '../List/utils';
import Text from '../Typography/Text';
const styles = StyleSheet.create({
- leftItem: {
- marginLeft: 0,
- marginRight: 16,
- },
leftItemV3: {
marginLeft: 16,
marginRight: 0,
alignSelf: 'center',
},
- rightItem: {
- marginRight: 0,
- },
rightItemV3: {
marginLeft: 16,
marginRight: 0,
@@ -30,23 +23,13 @@ const description = Test;
* ********************** getLeftStyles ********************** *
*/
-it('returns styles for left item without description for V2', () => {
- const style = getLeftStyles(false, null, false);
- expect(style).toStrictEqual({ ...styles.leftItem, marginVertical: 0 });
-});
-
-it('returns styles for left item w/ desctiption for V2', () => {
- const style = getLeftStyles(false, description, false);
- expect(style).toStrictEqual(styles.leftItem);
-});
-
-it('returns styles for left item without description for V3', () => {
- const style = getLeftStyles(false, null, true);
+it('returns styles for left item without description', () => {
+ const style = getLeftStyles(false, null);
expect(style).toStrictEqual({ ...styles.leftItemV3, marginVertical: 0 });
});
-it('returns styles for left item w/ desctiption for V3', () => {
- const style = getLeftStyles(true, description, true);
+it('returns styles for left item w/ desctiption', () => {
+ const style = getLeftStyles(true, description);
expect(style).toStrictEqual({
...styles.leftItemV3,
alignSelf: 'flex-start',
@@ -57,23 +40,13 @@ it('returns styles for left item w/ desctiption for V3', () => {
* ********************** getRightStyles ********************** *
*/
-it('returns styles for right item without description for V2', () => {
- const style = getRightStyles(false, null, false);
- expect(style).toStrictEqual({ ...styles.rightItem, marginVertical: 0 });
-});
-
-it('returns styles for right item w/ desctiption for V2', () => {
- const style = getRightStyles(false, description, false);
- expect(style).toStrictEqual(styles.rightItem);
-});
-
-it('returns styles for right item without description for V3', () => {
- const style = getRightStyles(false, null, true);
+it('returns styles for right item without description', () => {
+ const style = getRightStyles(false, null);
expect(style).toStrictEqual({ ...styles.rightItemV3, marginVertical: 0 });
});
-it('returns styles for right item w/ desctiption for V3', () => {
- const style = getRightStyles(true, description, true);
+it('returns styles for right item w/ desctiption', () => {
+ const style = getRightStyles(true, description);
expect(style).toStrictEqual({
...styles.rightItemV3,
alignSelf: 'flex-start',
diff --git a/src/components/__tests__/Menu.test.tsx b/src/components/__tests__/Menu.test.tsx
index 29397d1262..21ed4d0802 100644
--- a/src/components/__tests__/Menu.test.tsx
+++ b/src/components/__tests__/Menu.test.tsx
@@ -70,7 +70,7 @@ it('renders menu with content styles', () => {
([0, 1, 2, 3, 4, 5] as MD3Elevation[]).forEach((elevation) =>
it(`renders menu with background color based on elevation value = ${elevation}`, () => {
- const theme = getTheme(false, true);
+ const theme = getTheme();
const { getByTestId } = render(
diff --git a/src/components/__tests__/MenuItem.test.tsx b/src/components/__tests__/MenuItem.test.tsx
index 7413f43622..dead127da1 100644
--- a/src/components/__tests__/MenuItem.test.tsx
+++ b/src/components/__tests__/MenuItem.test.tsx
@@ -1,13 +1,14 @@
import * as React from 'react';
import { render } from '@testing-library/react-native';
-import color from 'color';
import { getTheme } from '../../core/theming';
-import { black, white } from '../../styles/themes/v2/colors';
+import { tokens } from '../../styles/themes/v3/tokens';
import Menu from '../Menu/Menu';
import { getMenuItemColor } from '../Menu/utils';
+const { stateOpacity } = tokens.md.ref;
+
describe('Menu Item', () => {
it('renders menu item', () => {
const tree = render(
@@ -72,28 +73,9 @@ describe('getMenuItemColor - title color', () => {
theme: getTheme(),
disabled: true,
})
- ).toMatchObject({ titleColor: getTheme().colors.onSurfaceDisabled });
- });
-
- it('should return disabled color if disabled, for theme version 2, light theme', () => {
- expect(
- getMenuItemColor({
- theme: getTheme(false, false),
- disabled: true,
- })
- ).toMatchObject({
- titleColor: color(black).alpha(0.32).rgb().string(),
- });
- });
-
- it('should return disabled color if disabled, for theme version 2, dark theme', () => {
- expect(
- getMenuItemColor({
- theme: getTheme(true, false),
- disabled: true,
- })
).toMatchObject({
- titleColor: color(white).alpha(0.32).rgb().string(),
+ titleColor: getTheme().colors.onSurface,
+ contentOpacity: stateOpacity.disabled,
});
});
@@ -106,19 +88,6 @@ describe('getMenuItemColor - title color', () => {
titleColor: getTheme().colors.onSurface,
});
});
-
- it('should return correct theme color, for theme version 2', () => {
- expect(
- getMenuItemColor({
- theme: getTheme(false, false),
- })
- ).toMatchObject({
- titleColor: color(getTheme(false, false).colors.text)
- .alpha(0.87)
- .rgb()
- .string(),
- });
- });
});
describe('getMenuItemColor - icon color', () => {
@@ -128,76 +97,19 @@ describe('getMenuItemColor - icon color', () => {
theme: getTheme(),
disabled: true,
})
- ).toMatchObject({ iconColor: getTheme().colors.onSurfaceDisabled });
- });
-
- it('should return disabled color if disabled, for theme version 2, light theme', () => {
- expect(
- getMenuItemColor({
- theme: getTheme(false, false),
- disabled: true,
- })
- ).toMatchObject({
- iconColor: color(black).alpha(0.32).rgb().string(),
- });
- });
-
- it('should return disabled color if disabled, for theme version 2, dark theme', () => {
- expect(
- getMenuItemColor({
- theme: getTheme(true, false),
- disabled: true,
- })
- ).toMatchObject({
- iconColor: color(white).alpha(0.32).rgb().string(),
- });
- });
-
- it('should return correct theme color, for theme version 3', () => {
- expect(
- getMenuItemColor({
- theme: getTheme(),
- })
).toMatchObject({
iconColor: getTheme().colors.onSurfaceVariant,
+ contentOpacity: stateOpacity.disabled,
});
});
- it('should return correct theme color, for theme version 2', () => {
- expect(
- getMenuItemColor({
- theme: getTheme(false, false),
- })
- ).toMatchObject({
- iconColor: color(getTheme(false, false).colors.text)
- .alpha(0.54)
- .rgb()
- .string(),
- });
- });
-});
-
-describe('getMenuItemColor - ripple color', () => {
it('should return correct theme color, for theme version 3', () => {
expect(
getMenuItemColor({
theme: getTheme(),
})
).toMatchObject({
- rippleColor: color(getTheme().colors.onSurfaceVariant)
- .alpha(0.12)
- .rgb()
- .string(),
- });
- });
-
- it('should return undefined, for theme version 2', () => {
- expect(
- getMenuItemColor({
- theme: getTheme(false, false),
- })
- ).toMatchObject({
- rippleColor: undefined,
+ iconColor: getTheme().colors.onSurfaceVariant,
});
});
});
diff --git a/src/components/__tests__/Modal.test.tsx b/src/components/__tests__/Modal.test.tsx
index 32161d5b84..d040cc62de 100644
--- a/src/components/__tests__/Modal.test.tsx
+++ b/src/components/__tests__/Modal.test.tsx
@@ -9,8 +9,11 @@ import {
import { act, fireEvent, render } from '@testing-library/react-native';
import { MD3LightTheme } from '../../styles/themes';
+import { tokens } from '../../styles/themes/v3/tokens';
import Modal from '../Modal';
+const { scrimAlpha } = tokens.md.ref;
+
jest.mock('react-native-safe-area-context', () => ({
useSafeAreaInsets: () => ({ bottom: 44, left: 0, right: 0, top: 37 }),
}));
@@ -55,7 +58,7 @@ describe('Modal', () => {
);
expect(getByTestId('modal-backdrop')).toHaveStyle({
- backgroundColor: MD3LightTheme.colors.backdrop,
+ backgroundColor: MD3LightTheme.colors.scrim,
});
});
@@ -66,7 +69,7 @@ describe('Modal', () => {
testID="modal"
theme={{
colors: {
- backdrop: 'transparent',
+ scrim: 'transparent',
},
}}
>
@@ -119,7 +122,7 @@ describe('Modal', () => {
});
expect(getByTestId('modal-backdrop')).toHaveStyle({
- opacity: 1,
+ opacity: scrimAlpha,
});
expect(getByTestId('modal-surface-outer-layer')).toHaveStyle({
@@ -156,7 +159,7 @@ describe('Modal', () => {
});
expect(getByTestId('modal-backdrop')).toHaveStyle({
- opacity: 1,
+ opacity: scrimAlpha,
});
expect(getByTestId('modal-surface-outer-layer')).toHaveStyle({
@@ -198,7 +201,7 @@ describe('Modal', () => {
});
expect(getByTestId('modal-backdrop')).toHaveStyle({
- opacity: 1,
+ opacity: scrimAlpha,
});
expect(getByTestId('modal-surface-outer-layer')).toHaveStyle({
@@ -241,7 +244,7 @@ describe('Modal', () => {
});
expect(getByTestId('modal-backdrop')).toHaveStyle({
- opacity: 1,
+ opacity: scrimAlpha,
});
expect(getByTestId('modal-surface-outer-layer')).toHaveStyle({
@@ -308,7 +311,7 @@ describe('Modal', () => {
});
expect(getByTestId('modal-backdrop')).toHaveStyle({
- opacity: 1,
+ opacity: scrimAlpha,
});
expect(getByTestId('modal-surface-outer-layer')).toHaveStyle({
@@ -376,7 +379,7 @@ describe('Modal', () => {
});
expect(getByTestId('modal-backdrop')).toHaveStyle({
- opacity: 1,
+ opacity: scrimAlpha,
});
expect(getByTestId('modal-surface-outer-layer')).toHaveStyle({
opacity: 1,
@@ -393,7 +396,7 @@ describe('Modal', () => {
);
expect(getByTestId('modal-backdrop')).toHaveStyle({
- opacity: 1,
+ opacity: scrimAlpha,
});
expect(getByTestId('modal-surface-outer-layer')).toHaveStyle({
opacity: 1,
@@ -406,7 +409,7 @@ describe('Modal', () => {
);
expect(getByTestId('modal-backdrop')).toHaveStyle({
- opacity: 1,
+ opacity: scrimAlpha,
});
expect(getByTestId('modal-surface-outer-layer')).toHaveStyle({
opacity: 1,
@@ -453,7 +456,7 @@ describe('Modal', () => {
);
expect(getByTestId('modal-backdrop')).toHaveStyle({
- opacity: 1,
+ opacity: scrimAlpha,
});
expect(getByTestId('modal-surface-outer-layer')).toHaveStyle({
opacity: 1,
@@ -466,7 +469,7 @@ describe('Modal', () => {
);
expect(getByTestId('modal-backdrop')).toHaveStyle({
- opacity: 1,
+ opacity: scrimAlpha,
});
expect(getByTestId('modal-surface-outer-layer')).toHaveStyle({
opacity: 1,
@@ -491,7 +494,7 @@ describe('Modal', () => {
);
expect(getByTestId('modal-backdrop')).toHaveStyle({
- opacity: 1,
+ opacity: scrimAlpha,
});
expect(getByTestId('modal-surface-outer-layer')).toHaveStyle({
opacity: 1,
@@ -504,7 +507,7 @@ describe('Modal', () => {
);
expect(getByTestId('modal-backdrop')).toHaveStyle({
- opacity: 1,
+ opacity: scrimAlpha,
});
expect(getByTestId('modal-surface-outer-layer')).toHaveStyle({
opacity: 1,
@@ -527,7 +530,7 @@ describe('Modal', () => {
});
expect(getByTestId('modal-backdrop')).toHaveStyle({
- opacity: 1,
+ opacity: scrimAlpha,
});
expect(getByTestId('modal-surface-outer-layer')).toHaveStyle({
opacity: 1,
diff --git a/src/components/__tests__/RadioButton/__snapshots__/RadioButtonItem.test.tsx.snap b/src/components/__tests__/RadioButton/__snapshots__/RadioButtonItem.test.tsx.snap
index dfbe5fa131..f44e395c55 100644
--- a/src/components/__tests__/RadioButton/__snapshots__/RadioButtonItem.test.tsx.snap
+++ b/src/components/__tests__/RadioButton/__snapshots__/RadioButtonItem.test.tsx.snap
@@ -145,7 +145,7 @@ exports[`can render leading radio button control 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -161,9 +161,9 @@ exports[`can render leading radio button control 1`] = `
"flexGrow": 1,
"flexShrink": 1,
},
- false,
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
+ "opacity": 1,
"textAlign": "right",
},
undefined,
@@ -240,7 +240,7 @@ exports[`can render the Android radio button on different platforms 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -256,9 +256,9 @@ exports[`can render the Android radio button on different platforms 1`] = `
"flexGrow": 1,
"flexShrink": 1,
},
- false,
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
+ "opacity": 1,
"textAlign": "left",
},
undefined,
@@ -392,7 +392,7 @@ exports[`can render the iOS radio button on different platforms 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -408,9 +408,9 @@ exports[`can render the iOS radio button on different platforms 1`] = `
"flexGrow": 1,
"flexShrink": 1,
},
- false,
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
+ "opacity": 1,
"textAlign": "left",
},
undefined,
@@ -570,7 +570,7 @@ exports[`renders unchecked 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -586,9 +586,9 @@ exports[`renders unchecked 1`] = `
"flexGrow": 1,
"flexShrink": 1,
},
- false,
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
+ "opacity": 1,
"textAlign": "left",
},
undefined,
diff --git a/src/components/__tests__/Searchbar.test.tsx b/src/components/__tests__/Searchbar.test.tsx
index 59ade128e4..eb44e85481 100644
--- a/src/components/__tests__/Searchbar.test.tsx
+++ b/src/components/__tests__/Searchbar.test.tsx
@@ -38,15 +38,6 @@ it('renders without ActivityIndicator', () => {
expect(() => getByTestId('activity-indicator')).toThrow();
});
-it('render icon with custom ripple color', () => {
- const { getByTestId } = render(
-
- );
-
- const iconContainer = getByTestId('search-bar-icon-container').props.children;
- expect(iconContainer.props.rippleColor).toBe('purple');
-});
-
it('renders clear icon with custom color', () => {
const { getByTestId } = render(
@@ -141,16 +132,6 @@ it('renders clear icon wrapper, with appropriate style for v3', () => {
});
});
-it('render clear icon with custom ripple color', () => {
- const { getByTestId } = render(
-
- );
-
- const clearIconContainer = getByTestId('search-bar-clear-icon-container')
- .props.children;
- expect(clearIconContainer.props.rippleColor).toBe('purple');
-});
-
it('renders trailering icon when mode is set to "bar"', () => {
const { getByTestId } = render(
{
expect(onTraileringIconPressMock).toHaveBeenCalledTimes(1);
});
-it('renders trailering icon with custom ripple colors', () => {
- const { getByTestId } = render(
-
- );
-
- const traileringIconContainer = getByTestId(
- 'search-bar-trailering-icon-container'
- ).props.children;
- expect(traileringIconContainer.props.rippleColor).toBe('purple');
-});
-
it('renders clear icon instead of trailering icon', () => {
const { getByTestId, update, queryByTestId } = render(
{
const tree = render(
{
describe('getSegmentedButtonColors', () => {
it.each`
- theme | disabled | checked | checkedColor | uncheckedColor | expected
- ${getTheme()} | ${false} | ${true} | ${undefined} | ${undefined} | ${getTheme().colors.onSecondaryContainer}
- ${getTheme()} | ${false} | ${false} | ${undefined} | ${undefined} | ${getTheme().colors.onSurface}
- ${getTheme()} | ${true} | ${true} | ${undefined} | ${undefined} | ${getTheme().colors.onSurfaceDisabled}
- ${getTheme()} | ${true} | ${false} | ${undefined} | ${undefined} | ${getTheme().colors.onSurfaceDisabled}
- ${getTheme()} | ${false} | ${true} | ${'a125f5'} | ${undefined} | ${'a125f5'}
- ${getTheme()} | ${false} | ${false} | ${undefined} | ${'000'} | ${'000'}
- ${getTheme()} | ${false} | ${false} | ${'a125f5'} | ${'000'} | ${'000'}
- ${getTheme()} | ${false} | ${false} | ${'a125f5'} | ${undefined} | ${getTheme().colors.onSurface}
- ${getTheme()} | ${false} | ${true} | ${undefined} | ${'000'} | ${getTheme().colors.onSecondaryContainer}
- ${getTheme(false, false)} | ${false} | ${false} | ${undefined} | ${undefined} | ${getTheme(false, false).colors.primary}
- ${getTheme(false, false)} | ${false} | ${true} | ${undefined} | ${undefined} | ${getTheme(false, false).colors.primary}
- ${getTheme(false, false)} | ${true} | ${false} | ${undefined} | ${undefined} | ${getTheme(false, false).colors.disabled}
- ${getTheme(false, false)} | ${true} | ${true} | ${undefined} | ${undefined} | ${getTheme(false, false).colors.disabled}
- ${getTheme(false, false)} | ${false} | ${false} | ${'a125f5'} | ${undefined} | ${getTheme(false, false).colors.primary}
- ${getTheme(false, false)} | ${false} | ${true} | ${undefined} | ${'000'} | ${getTheme(false, false).colors.primary}
+ theme | disabled | checked | checkedColor | uncheckedColor | expected
+ ${getTheme()} | ${false} | ${true} | ${undefined} | ${undefined} | ${getTheme().colors.onSecondaryContainer}
+ ${getTheme()} | ${false} | ${false} | ${undefined} | ${undefined} | ${getTheme().colors.onSurface}
+ ${getTheme()} | ${true} | ${true} | ${undefined} | ${undefined} | ${getTheme().colors.onSurface}
+ ${getTheme()} | ${true} | ${false} | ${undefined} | ${undefined} | ${getTheme().colors.onSurface}
+ ${getTheme()} | ${false} | ${true} | ${'a125f5'} | ${undefined} | ${'a125f5'}
+ ${getTheme()} | ${false} | ${false} | ${undefined} | ${'000'} | ${'000'}
+ ${getTheme()} | ${false} | ${false} | ${'a125f5'} | ${'000'} | ${'000'}
+ ${getTheme()} | ${false} | ${false} | ${'a125f5'} | ${undefined} | ${getTheme().colors.onSurface}
+ ${getTheme()} | ${false} | ${true} | ${undefined} | ${'000'} | ${getTheme().colors.onSecondaryContainer}
`(
'returns $expected when disabled: $disabled, checked: $checked, checkedColor is $checkedColor and uncheckedColor is $uncheckedColor and isV3: $theme.isV3',
({ theme, disabled, checked, checkedColor, uncheckedColor, expected }) => {
@@ -97,25 +92,10 @@ describe('getSegmentedButtonColors', () => {
).toMatchObject({ backgroundColor: getTheme().colors.secondaryContainer });
});
- it('should return correct background color when checked and theme version 2', () => {
- expect(
- getSegmentedButtonColors({
- theme: getTheme(false, false),
- disabled: false,
- checked: true,
- })
- ).toMatchObject({
- backgroundColor: color(getTheme(false, false).colors.primary)
- .alpha(0.12)
- .rgb()
- .string(),
- });
- });
-
it('should return correct background color when uncheked (V3 & V2)', () => {
expect(
getSegmentedButtonColors({
- theme: getTheme(false, false),
+ theme: getTheme(),
disabled: false,
checked: false,
})
@@ -136,18 +116,6 @@ describe('getSegmentedButtonColors', () => {
});
});
- it('should return correct border color with theme version 2', () => {
- expect(
- getSegmentedButtonColors({
- theme: getTheme(false, false),
- disabled: false,
- checked: false,
- })
- ).toMatchObject({
- borderColor: color(black).alpha(0.29).rgb().string(),
- });
- });
-
it('should return correct border color when disabled and theme version 3', () => {
expect(
getSegmentedButtonColors({
@@ -156,7 +124,7 @@ describe('getSegmentedButtonColors', () => {
checked: false,
})
).toMatchObject({
- borderColor: getTheme().colors.surfaceDisabled,
+ borderColor: getTheme().colors.outlineVariant,
});
});
@@ -172,18 +140,6 @@ describe('getSegmentedButtonColors', () => {
});
});
- it('should return correct textColor with theme version 2', () => {
- expect(
- getSegmentedButtonColors({
- theme: getTheme(false, false),
- disabled: false,
- checked: false,
- })
- ).toMatchObject({
- textColor: getTheme(false, false).colors.primary,
- });
- });
-
it('should return correct textColor when disabled and theme version 3', () => {
expect(
getSegmentedButtonColors({
@@ -192,19 +148,8 @@ describe('getSegmentedButtonColors', () => {
checked: false,
})
).toMatchObject({
- textColor: getTheme().colors.onSurfaceDisabled,
- });
- });
-
- it('should return correct textColor when disabled and theme version 2', () => {
- expect(
- getSegmentedButtonColors({
- theme: getTheme(false, false),
- disabled: true,
- checked: false,
- })
- ).toMatchObject({
- textColor: getTheme(false, false).colors.disabled,
+ textColor: getTheme().colors.onSurface,
+ textOpacity: stateOpacity.disabled,
});
});
});
diff --git a/src/components/__tests__/Snackbar.test.tsx b/src/components/__tests__/Snackbar.test.tsx
index f520faa466..e8f71f3319 100644
--- a/src/components/__tests__/Snackbar.test.tsx
+++ b/src/components/__tests__/Snackbar.test.tsx
@@ -82,23 +82,6 @@ it('renders snackbar with View & Text as a child', () => {
expect(tree).toMatchSnapshot();
});
-it('renders with custom ripple color', () => {
- const { getByTestId } = render(
- {}}
- onIconPress={() => {}}
- rippleColor="purple"
- testID="snackbar"
- >
- Snackbar content
-
- );
-
- const iconContainer = getByTestId('snackbar-icon-container').props.children;
- expect(iconContainer.props.rippleColor).toBe('purple');
-});
-
it('animated value changes correctly', () => {
const value = new Animated.Value(1);
const { getByTestId } = render(
diff --git a/src/components/__tests__/Surface.test.tsx b/src/components/__tests__/Surface.test.tsx
index 8d8e639779..045a63a3e6 100644
--- a/src/components/__tests__/Surface.test.tsx
+++ b/src/components/__tests__/Surface.test.tsx
@@ -65,7 +65,7 @@ describe('Surface', () => {
shadowRadius: 12,
});
expect(getByTestId('surface-test')).toHaveStyle({
- backgroundColor: getTheme().colors.elevation.level5,
+ backgroundColor: getTheme().colors.surfaceContainerHighest,
});
});
@@ -256,7 +256,7 @@ describe('Surface', () => {
expect(getByTestId(testID)).not.toHaveStyle({ elevation: 5 });
expect(getByTestId(testID)).toHaveStyle({
- backgroundColor: getTheme().colors.elevation.level5,
+ backgroundColor: getTheme().colors.surfaceContainerHighest,
});
});
});
diff --git a/src/components/__tests__/Switch.test.tsx b/src/components/__tests__/Switch.test.tsx
index e475b9a166..ee7a82a15d 100644
--- a/src/components/__tests__/Switch.test.tsx
+++ b/src/components/__tests__/Switch.test.tsx
@@ -62,16 +62,6 @@ describe('getSwitchColor - checked color', () => {
checkedColor: getTheme().colors.primary,
});
});
-
- it('should return theme color, for theme version 2', () => {
- expect(
- getSwitchColor({
- theme: getTheme(false, false),
- })
- ).toMatchObject({
- checkedColor: getTheme(false, false).colors.accent,
- });
- });
});
describe('getSwitchColor - thumb tint color', () => {
@@ -163,24 +153,12 @@ describe('getSwitchColor - on tint color', () => {
});
});
- it('should return checked color for iOS platform, for theme version 2', () => {
- Platform.OS = 'ios';
-
- expect(
- getSwitchColor({
- theme: getTheme(false, false),
- })
- ).toMatchObject({
- onTintColor: getTheme(false, false).colors.accent,
- });
- });
-
it('should return custom color for iOS platform', () => {
Platform.OS = 'ios';
expect(
getSwitchColor({
- theme: getTheme(false, false),
+ theme: getTheme(),
color: 'purple',
})
).toMatchObject({
@@ -201,17 +179,6 @@ describe('getSwitchColor - on tint color', () => {
});
});
- it('should return correct disabled color, for theme version 2, dark mode', () => {
- expect(
- getSwitchColor({
- theme: getTheme(true, false),
- disabled: true,
- })
- ).toMatchObject({
- onTintColor: color(white).alpha(0.1).rgb().string(),
- });
- });
-
it('should return correct disabled color, light mode', () => {
expect(
getSwitchColor({
@@ -231,7 +198,7 @@ describe('getSwitchColor - on tint color', () => {
color: 'purple',
})
).toMatchObject({
- onTintColor: color('purple').alpha(0.5).rgb().string(),
+ checkedColor: 'purple',
});
});
diff --git a/src/components/__tests__/TextField.test.tsx b/src/components/__tests__/TextField.test.tsx
new file mode 100644
index 0000000000..f58cd603d9
--- /dev/null
+++ b/src/components/__tests__/TextField.test.tsx
@@ -0,0 +1,522 @@
+import * as React from 'react';
+import { I18nManager, StyleSheet, TextInput, View } from 'react-native';
+
+import { fireEvent, render } from '@testing-library/react-native';
+
+import TextField, {
+ type TextFieldAccessoryProps,
+} from '../TextField/TextField';
+
+const defaultI18nIsRTL = I18nManager.isRTL;
+
+afterEach(() => {
+ I18nManager.isRTL = defaultI18nIsRTL;
+});
+
+function firstIndexOfTestIdInTree(tree: unknown, testID: string): number {
+ const serialized = JSON.stringify(tree);
+ const match = new RegExp(`"testID":\\s*"${testID}"`).exec(serialized);
+ return match ? match.index : -1;
+}
+
+it('renders filled TextField with label and value', () => {
+ const tree = render(
+ {}} />
+ ).toJSON();
+
+ expect(tree).toMatchSnapshot();
+});
+
+it('renders outlined TextField with label and value', () => {
+ const tree = render(
+ {}}
+ />
+ ).toJSON();
+
+ expect(tree).toMatchSnapshot();
+});
+
+it('renders supporting text below the field', () => {
+ const { getByText } = render(
+ {}}
+ supportingText="Use a valid address"
+ />
+ );
+
+ expect(getByText('Use a valid address')).toBeTruthy();
+});
+
+it('sets aria-invalid on the input when status is error', () => {
+ const { getByTestId } = render(
+ {}}
+ status="error"
+ testID="tf-input"
+ />
+ );
+
+ expect(getByTestId('tf-input').props['aria-invalid']).toBe(true);
+});
+
+it('uses assertive aria-live on supporting text when status is error', () => {
+ const { getByText } = render(
+ {}}
+ supportingText="Invalid"
+ status="error"
+ />
+ );
+
+ expect(getByText('Invalid').props['aria-live']).toBe('assertive');
+});
+
+it('uses polite aria-live on supporting text when there is no error', () => {
+ const { getByText } = render(
+ {}}
+ supportingText="Optional"
+ />
+ );
+
+ expect(getByText('Optional').props['aria-live']).toBe('polite');
+});
+
+it('marks the input as aria-disabled when editable is false', () => {
+ const { getByTestId } = render(
+ {}}
+ editable={false}
+ testID="tf-input"
+ />
+ );
+
+ expect(getByTestId('tf-input').props['aria-disabled']).toBe(true);
+});
+
+it('marks the input as aria-disabled when status is disabled', () => {
+ const { getByTestId } = render(
+ {}}
+ status="disabled"
+ testID="tf-input"
+ />
+ );
+
+ expect(getByTestId('tf-input').props['aria-disabled']).toBe(true);
+});
+
+it('forwards TextInput props such as testID', () => {
+ const { getByTestId } = render(
+ {}}
+ testID="email-input"
+ />
+ );
+
+ expect(getByTestId('email-input')).toBeTruthy();
+});
+
+it('does not pass TextField-only props through to TextInput', () => {
+ const { getByTestId } = render(
+ {}}
+ testID="tf-native"
+ />
+ );
+
+ const input = getByTestId('tf-native');
+ expect(input.props.variant).toBeUndefined();
+ expect(input.props.theme).toBeUndefined();
+ expect(input.props.LeftAccessory).toBeUndefined();
+ expect(input.props.pressableStyle).toBeUndefined();
+ expect(input.props.fieldStyle).toBeUndefined();
+ expect(input.props.containerStyle).toBeUndefined();
+ expect(input.props.supportingText).toBeUndefined();
+ expect(input.props.supportingTextProps).toBeUndefined();
+});
+
+it('invokes onFocus and onBlur on the TextInput', () => {
+ const onFocus = jest.fn();
+ const onBlur = jest.fn();
+ const { getByTestId } = render(
+ {}}
+ onFocus={onFocus}
+ onBlur={onBlur}
+ testID="tf-input"
+ />
+ );
+
+ const input = getByTestId('tf-input');
+ fireEvent(input, 'focus');
+ fireEvent(input, 'blur');
+
+ expect(onFocus).toHaveBeenCalledTimes(1);
+ expect(onBlur).toHaveBeenCalledTimes(1);
+});
+
+it('focuses the TextInput when the outer Pressable is pressed', () => {
+ const focusSpy = jest.spyOn(TextInput.prototype, 'focus');
+
+ const { UNSAFE_getByProps, getByTestId } = render(
+ {}}
+ testID="tf-input"
+ />
+ );
+
+ expect(getByTestId('tf-input')).toBeTruthy();
+
+ /* Pressable is not exposed as a distinct type in the test renderer; match its props. */
+ const pressable = UNSAFE_getByProps({ role: 'none', accessible: false });
+ fireEvent.press(pressable);
+
+ expect(focusSpy).toHaveBeenCalled();
+ focusSpy.mockRestore();
+});
+
+it('does not focus the TextInput when disabled and the Pressable is pressed', () => {
+ const focusSpy = jest.spyOn(TextInput.prototype, 'focus');
+
+ const { UNSAFE_getByProps } = render(
+ {}}
+ editable={false}
+ />
+ );
+
+ const pressable = UNSAFE_getByProps({ role: 'none', accessible: false });
+ fireEvent.press(pressable);
+
+ expect(focusSpy).not.toHaveBeenCalled();
+ focusSpy.mockRestore();
+});
+
+it('exposes the TextInput instance via ref prop', () => {
+ const ref = React.createRef();
+
+ render(
+ {}}
+ testID="tf-input"
+ />
+ );
+
+ expect(ref.current).toBeTruthy();
+ expect(typeof ref.current?.focus).toBe('function');
+});
+
+it('passes status, editable, and multiline to accessories', () => {
+ const leftProps: TextFieldAccessoryProps[] = [];
+ const rightProps: TextFieldAccessoryProps[] = [];
+
+ function LeftAccessory(props: TextFieldAccessoryProps) {
+ leftProps.push(props);
+ return ;
+ }
+
+ function RightAccessory(props: TextFieldAccessoryProps) {
+ rightProps.push(props);
+ return ;
+ }
+
+ const { getByTestId } = render(
+ {}}
+ multiline
+ status="error"
+ editable={false}
+ LeftAccessory={LeftAccessory}
+ RightAccessory={RightAccessory}
+ />
+ );
+
+ expect(getByTestId('left-accessory')).toBeTruthy();
+ expect(getByTestId('right-accessory')).toBeTruthy();
+ expect(leftProps[0]).toMatchObject({
+ status: 'error',
+ editable: false,
+ multiline: true,
+ });
+ expect(rightProps[0]).toMatchObject({
+ status: 'error',
+ editable: false,
+ multiline: true,
+ });
+});
+
+it('applies supportingTextProps to the supporting Text', () => {
+ const { getByTestId } = render(
+ {}}
+ supportingText="Hint"
+ supportingTextProps={{ testID: 'supporting-text' }}
+ />
+ );
+
+ expect(getByTestId('supporting-text').props.children).toBe('Hint');
+});
+
+it('applies RTL text alignment and writing direction to the TextInput (filled)', () => {
+ I18nManager.isRTL = true;
+
+ const { getByTestId } = render(
+ {}}
+ testID="tf-input-rtl"
+ />
+ );
+
+ expect(StyleSheet.flatten(getByTestId('tf-input-rtl').props.style)).toEqual(
+ expect.objectContaining({
+ textAlign: 'right',
+ writingDirection: 'rtl',
+ })
+ );
+});
+
+it('applies RTL text alignment and writing direction to the TextInput (outlined)', () => {
+ I18nManager.isRTL = true;
+
+ const { getByTestId } = render(
+ {}}
+ testID="tf-input-rtl-outlined"
+ />
+ );
+
+ expect(
+ StyleSheet.flatten(getByTestId('tf-input-rtl-outlined').props.style)
+ ).toEqual(
+ expect.objectContaining({
+ textAlign: 'right',
+ writingDirection: 'rtl',
+ })
+ );
+});
+
+it('applies RTL writing direction to supporting text', () => {
+ I18nManager.isRTL = true;
+
+ const { getByTestId } = render(
+ {}}
+ supportingText="Hint"
+ supportingTextProps={{ testID: 'supporting-text-rtl' }}
+ />
+ );
+
+ expect(
+ StyleSheet.flatten(getByTestId('supporting-text-rtl').props.style)
+ ).toEqual(
+ expect.objectContaining({
+ writingDirection: 'rtl',
+ })
+ );
+});
+
+it('places RightAccessory before LeftAccessory in the tree when RTL', () => {
+ I18nManager.isRTL = true;
+
+ function LeftAccessory() {
+ return ;
+ }
+
+ function RightAccessory() {
+ return ;
+ }
+
+ const { toJSON } = render(
+ {}}
+ LeftAccessory={LeftAccessory}
+ RightAccessory={RightAccessory}
+ testID="tf-input-rtl-order"
+ />
+ );
+
+ const tree = toJSON();
+ expect(
+ firstIndexOfTestIdInTree(tree, 'rtl-acc-from-right-prop')
+ ).toBeLessThan(firstIndexOfTestIdInTree(tree, 'rtl-acc-from-left-prop'));
+});
+
+it('places LeftAccessory before RightAccessory in the tree when LTR', () => {
+ I18nManager.isRTL = false;
+
+ function LeftAccessory() {
+ return ;
+ }
+
+ function RightAccessory() {
+ return ;
+ }
+
+ const { toJSON } = render(
+ {}}
+ LeftAccessory={LeftAccessory}
+ RightAccessory={RightAccessory}
+ testID="tf-input-ltr-order"
+ />
+ );
+
+ const tree = toJSON();
+ expect(firstIndexOfTestIdInTree(tree, 'ltr-acc-from-left-prop')).toBeLessThan(
+ firstIndexOfTestIdInTree(tree, 'ltr-acc-from-right-prop')
+ );
+});
+
+it('hides placeholder when the TextField is not focused', () => {
+ const { getByTestId } = render(
+ {}}
+ placeholder="e.g. user@example.com"
+ testID="tf-input"
+ />
+ );
+
+ expect(getByTestId('tf-input').props.placeholder).toBeUndefined();
+});
+
+it('shows placeholder when the TextField is focused', () => {
+ const { getByTestId, getByText } = render(
+ {}}
+ placeholder="e.g. user@example.com"
+ testID="tf-input"
+ />
+ );
+
+ fireEvent(getByTestId('tf-input'), 'focus');
+
+ expect(getByTestId('tf-input').props.placeholder).toBeUndefined();
+ expect(getByText('e.g. user@example.com')).toBeTruthy();
+});
+
+it('shows placeholder on multiline TextField when focused', () => {
+ const { getByTestId, getByText } = render(
+ {}}
+ placeholder="Add a note…"
+ multiline
+ testID="tf-multiline"
+ />
+ );
+
+ expect(getByTestId('tf-multiline').props.placeholder).toBeUndefined();
+
+ fireEvent(getByTestId('tf-multiline'), 'focus');
+
+ expect(getByTestId('tf-multiline').props.placeholder).toBeUndefined();
+ expect(getByText('Add a note…')).toBeTruthy();
+});
+
+it('hides placeholder again after the TextField loses focus', () => {
+ const { getByTestId } = render(
+ {}}
+ placeholder="e.g. user@example.com"
+ testID="tf-input"
+ />
+ );
+
+ fireEvent(getByTestId('tf-input'), 'focus');
+ fireEvent(getByTestId('tf-input'), 'blur');
+
+ expect(getByTestId('tf-input').props.placeholder).toBeUndefined();
+});
+
+it('maps a lone LeftAccessory to leading in LTR and trailing in RTL (tree order)', () => {
+ function LoneLeftAccessory() {
+ return ;
+ }
+
+ I18nManager.isRTL = false;
+
+ const { toJSON: toJsonLtr } = render(
+ {}}
+ LeftAccessory={LoneLeftAccessory}
+ testID="tf-lone-ltr"
+ />
+ );
+
+ I18nManager.isRTL = true;
+
+ const { toJSON: toJsonRtl } = render(
+ {}}
+ LeftAccessory={LoneLeftAccessory}
+ testID="tf-lone-rtl"
+ />
+ );
+
+ const ltrTree = toJsonLtr();
+ expect(firstIndexOfTestIdInTree(ltrTree, 'lone-left-acc')).toBeLessThan(
+ firstIndexOfTestIdInTree(ltrTree, 'tf-lone-ltr')
+ );
+
+ const rtlTree = toJsonRtl();
+ expect(firstIndexOfTestIdInTree(rtlTree, 'tf-lone-rtl')).toBeLessThan(
+ firstIndexOfTestIdInTree(rtlTree, 'lone-left-acc')
+ );
+});
diff --git a/src/components/__tests__/TextInput.test.tsx b/src/components/__tests__/TextInput.test.tsx
index e190a537d6..2fbebb326f 100644
--- a/src/components/__tests__/TextInput.test.tsx
+++ b/src/components/__tests__/TextInput.test.tsx
@@ -3,16 +3,18 @@ import * as React from 'react';
import { I18nManager, Platform, StyleSheet, Text, View } from 'react-native';
import { fireEvent, render } from '@testing-library/react-native';
-import color from 'color';
import { DefaultTheme, getTheme, ThemeProvider } from '../../core/theming';
import { red500 } from '../../styles/themes/v2/colors';
+import { tokens } from '../../styles/themes/v3/tokens';
import {
getFlatInputColors,
getOutlinedInputColors,
} from '../TextInput/helpers';
import TextInput, { Props } from '../TextInput/TextInput';
+const { stateOpacity } = tokens.md.ref;
+
const style = StyleSheet.create({
inputStyle: {
color: red500,
@@ -547,18 +549,7 @@ describe('getFlatInputColor - underline color', () => {
theme: getTheme(),
})
).toMatchObject({
- underlineColorCustom: getTheme().colors.onSurfaceDisabled,
- });
- });
-
- it('should return correct disabled color, for theme version 2', () => {
- expect(
- getFlatInputColors({
- disabled: true,
- theme: getTheme(false, false),
- })
- ).toMatchObject({
- underlineColorCustom: 'transparent',
+ underlineColorCustom: getTheme().colors.onSurfaceVariant,
});
});
@@ -572,16 +563,6 @@ describe('getFlatInputColor - underline color', () => {
});
});
- it('should return correct theme color, for theme version 2', () => {
- expect(
- getFlatInputColors({
- theme: getTheme(false, false),
- })
- ).toMatchObject({
- underlineColorCustom: getTheme(false, false).colors.disabled,
- });
- });
-
it('should return custom color, no matter what the theme is', () => {
expect(
getFlatInputColors({
@@ -595,7 +576,7 @@ describe('getFlatInputColor - underline color', () => {
expect(
getFlatInputColors({
underlineColor: 'beige',
- theme: getTheme(false, false),
+ theme: getTheme(),
})
).toMatchObject({
underlineColorCustom: 'beige',
@@ -617,7 +598,7 @@ describe('getFlatInputColor - input text color', () => {
expect(
getOutlinedInputColors({
textColor: 'beige',
- theme: getTheme(false, false),
+ theme: getTheme(),
})
).toMatchObject({
inputTextColor: 'beige',
@@ -631,21 +612,8 @@ describe('getFlatInputColor - input text color', () => {
theme: getTheme(),
})
).toMatchObject({
- inputTextColor: getTheme().colors.onSurfaceDisabled,
- });
- });
-
- it('should return correct disabled color, for theme version 2', () => {
- expect(
- getFlatInputColors({
- disabled: true,
- theme: getTheme(false, false),
- })
- ).toMatchObject({
- inputTextColor: color(getTheme(false, false).colors?.text)
- .alpha(0.54)
- .rgb()
- .string(),
+ inputTextColor: getTheme().colors.onSurface,
+ disabledOpacity: stateOpacity.disabled,
});
});
@@ -658,42 +626,22 @@ describe('getFlatInputColor - input text color', () => {
inputTextColor: getTheme().colors.onSurface,
});
});
-
- it('should return correct theme color, for theme version 2', () => {
- expect(
- getFlatInputColors({
- theme: getTheme(false, false),
- })
- ).toMatchObject({
- inputTextColor: getTheme(false, false).colors.text,
- });
- });
});
describe('getFlatInputColor - placeholder color', () => {
- it('should return correct disabled color, for theme version 3', () => {
+ it('should return correct disabled color', () => {
expect(
getFlatInputColors({
disabled: true,
theme: getTheme(),
})
).toMatchObject({
- placeholderColor: getTheme().colors.onSurfaceDisabled,
- });
- });
-
- it('should return correct disabled color, for theme version 2', () => {
- expect(
- getFlatInputColors({
- disabled: true,
- theme: getTheme(false, false),
- })
- ).toMatchObject({
- placeholderColor: getTheme(false, false).colors.disabled,
+ placeholderColor: getTheme().colors.onSurfaceVariant,
+ disabledOpacity: stateOpacity.disabled,
});
});
- it('should return correct theme color, for theme version 3', () => {
+ it('should return correct theme color', () => {
expect(
getFlatInputColors({
theme: getTheme(),
@@ -702,16 +650,6 @@ describe('getFlatInputColor - placeholder color', () => {
placeholderColor: getTheme().colors.onSurfaceVariant,
});
});
-
- it('should return correct theme color, for theme version 2', () => {
- expect(
- getFlatInputColors({
- theme: getTheme(false, false),
- })
- ).toMatchObject({
- placeholderColor: getTheme(false, false).colors.placeholder,
- });
- });
});
describe('getFlatInputColor - background color', () => {
@@ -722,10 +660,7 @@ describe('getFlatInputColor - background color', () => {
theme: getTheme(),
})
).toMatchObject({
- backgroundColor: color(getTheme().colors.onSurface)
- .alpha(0.04)
- .rgb()
- .string(),
+ backgroundColor: getTheme().colors.surfaceContainerHighest,
});
expect(
getFlatInputColors({
@@ -733,21 +668,7 @@ describe('getFlatInputColor - background color', () => {
theme: getTheme(true),
})
).toMatchObject({
- backgroundColor: color(getTheme(true).colors.onSurface)
- .alpha(0.04)
- .rgb()
- .string(),
- });
- });
-
- it('should return undefined when disabled, for theme version 2', () => {
- expect(
- getFlatInputColors({
- disabled: true,
- theme: getTheme(false, false),
- })
- ).toMatchObject({
- backgroundColor: undefined,
+ backgroundColor: getTheme(true).colors.surfaceContainerHighest,
});
});
@@ -760,32 +681,6 @@ describe('getFlatInputColor - background color', () => {
backgroundColor: getTheme().colors.surfaceVariant,
});
});
-
- it('should return correct theme color, for theme version 2, light mode', () => {
- expect(
- getFlatInputColors({
- theme: getTheme(false, false),
- })
- ).toMatchObject({
- backgroundColor: color(getTheme(false, false).colors?.background)
- .darken(0.06)
- .rgb()
- .string(),
- });
- });
-
- it('should return correct theme color, for theme version 2, dark mode', () => {
- expect(
- getFlatInputColors({
- theme: getTheme(true, false),
- })
- ).toMatchObject({
- backgroundColor: color(getTheme(true, false).colors?.background)
- .lighten(0.24)
- .rgb()
- .string(),
- });
- });
});
describe('getFlatInputColor - error color', () => {
@@ -802,10 +697,10 @@ describe('getFlatInputColor - error color', () => {
expect(
getFlatInputColors({
error: true,
- theme: getTheme(false, true),
+ theme: getTheme(),
})
).toMatchObject({
- errorColor: getTheme(false, true).colors.error,
+ errorColor: getTheme().colors.error,
});
});
});
@@ -818,21 +713,8 @@ describe('getFlatInputColor - active color', () => {
theme: getTheme(),
})
).toMatchObject({
- activeColor: getTheme().colors.onSurfaceDisabled,
- });
- });
-
- it('should return disabled color, for theme version 2', () => {
- expect(
- getFlatInputColors({
- disabled: true,
- theme: getTheme(false, false),
- })
- ).toMatchObject({
- activeColor: color(getTheme(false, false).colors?.text)
- .alpha(0.54)
- .rgb()
- .string(),
+ activeColor: getTheme().colors.primary,
+ disabledOpacity: stateOpacity.disabled,
});
});
@@ -849,10 +731,10 @@ describe('getFlatInputColor - active color', () => {
expect(
getFlatInputColors({
error: true,
- theme: getTheme(false, true),
+ theme: getTheme(),
})
).toMatchObject({
- activeColor: getTheme(false, true).colors.error,
+ activeColor: getTheme().colors.error,
});
});
@@ -869,7 +751,7 @@ describe('getFlatInputColor - active color', () => {
expect(
getFlatInputColors({
activeUnderlineColor: 'beige',
- theme: getTheme(false, false),
+ theme: getTheme(),
})
).toMatchObject({
activeColor: 'beige',
@@ -885,16 +767,6 @@ describe('getFlatInputColor - active color', () => {
activeColor: getTheme().colors.primary,
});
});
-
- it('should return theme active color, for theme version 2', () => {
- expect(
- getFlatInputColors({
- theme: getTheme(false, true),
- })
- ).toMatchObject({
- activeColor: getTheme(false, true).colors.primary,
- });
- });
});
describe('getOutlinedInputColors - outline color', () => {
@@ -905,7 +777,7 @@ describe('getOutlinedInputColors - outline color', () => {
theme: getTheme(),
})
).toMatchObject({
- outlineColor: getTheme().colors.surfaceDisabled,
+ outlineColor: getTheme().colors.outlineVariant,
});
});
@@ -920,29 +792,6 @@ describe('getOutlinedInputColors - outline color', () => {
});
});
- it('should return correct disabled color, for theme version 2', () => {
- expect(
- getOutlinedInputColors({
- disabled: true,
- theme: getTheme(false, false),
- })
- ).toMatchObject({
- outlineColor: getTheme(false, false).colors.disabled,
- });
- });
-
- it('should return custom color as disabled, when it is transparent, for theme version 2', () => {
- expect(
- getOutlinedInputColors({
- disabled: true,
- customOutlineColor: 'transparent',
- theme: getTheme(false, false),
- })
- ).toMatchObject({
- outlineColor: 'transparent',
- });
- });
-
it('should return custom color, if not disabled, no matter what the theme is', () => {
expect(
getOutlinedInputColors({
@@ -956,7 +805,7 @@ describe('getOutlinedInputColors - outline color', () => {
expect(
getOutlinedInputColors({
customOutlineColor: 'beige',
- theme: getTheme(false, false),
+ theme: getTheme(),
})
).toMatchObject({
outlineColor: 'beige',
@@ -972,16 +821,6 @@ describe('getOutlinedInputColors - outline color', () => {
outlineColor: getTheme().colors.outline,
});
});
-
- it('should return theme color, for theme version 2', () => {
- expect(
- getOutlinedInputColors({
- theme: getTheme(false, false),
- })
- ).toMatchObject({
- outlineColor: getTheme(false, false).colors.placeholder,
- });
- });
});
describe('getOutlinedInputColors - input text color', () => {
@@ -992,21 +831,8 @@ describe('getOutlinedInputColors - input text color', () => {
theme: getTheme(),
})
).toMatchObject({
- inputTextColor: getTheme().colors.onSurfaceDisabled,
- });
- });
-
- it('should return correct disabled color, for theme version 2', () => {
- expect(
- getOutlinedInputColors({
- disabled: true,
- theme: getTheme(false, false),
- })
- ).toMatchObject({
- inputTextColor: color(getTheme(false, false).colors?.text)
- .alpha(0.54)
- .rgb()
- .string(),
+ inputTextColor: getTheme().colors.onSurface,
+ disabledOpacity: stateOpacity.disabled,
});
});
@@ -1019,16 +845,6 @@ describe('getOutlinedInputColors - input text color', () => {
inputTextColor: getTheme().colors.onSurface,
});
});
-
- it('should return correct theme color, for theme version 2', () => {
- expect(
- getOutlinedInputColors({
- theme: getTheme(false, false),
- })
- ).toMatchObject({
- inputTextColor: getTheme(false, false).colors.text,
- });
- });
});
describe('getOutlinedInputColors - placeholder color', () => {
@@ -1039,18 +855,8 @@ describe('getOutlinedInputColors - placeholder color', () => {
theme: getTheme(),
})
).toMatchObject({
- placeholderColor: getTheme().colors.onSurfaceDisabled,
- });
- });
-
- it('should return correct disabled color, for theme version 2', () => {
- expect(
- getOutlinedInputColors({
- disabled: true,
- theme: getTheme(false, false),
- })
- ).toMatchObject({
- placeholderColor: getTheme(false, false).colors.disabled,
+ placeholderColor: getTheme().colors.onSurfaceVariant,
+ disabledOpacity: stateOpacity.disabled,
});
});
@@ -1063,16 +869,6 @@ describe('getOutlinedInputColors - placeholder color', () => {
placeholderColor: getTheme().colors.onSurfaceVariant,
});
});
-
- it('should return correct theme color, for theme version 2', () => {
- expect(
- getOutlinedInputColors({
- theme: getTheme(false, false),
- })
- ).toMatchObject({
- placeholderColor: getTheme(false, false).colors.placeholder,
- });
- });
});
describe('getOutlinedInputColors - error color', () => {
@@ -1089,10 +885,10 @@ describe('getOutlinedInputColors - error color', () => {
expect(
getOutlinedInputColors({
error: true,
- theme: getTheme(false, true),
+ theme: getTheme(),
})
).toMatchObject({
- errorColor: getTheme(false, true).colors.error,
+ errorColor: getTheme().colors.error,
});
});
});
@@ -1105,21 +901,8 @@ describe('getOutlinedInputColors - active color', () => {
theme: getTheme(),
})
).toMatchObject({
- activeColor: getTheme().colors.onSurfaceDisabled,
- });
- });
-
- it('should return disabled color, for theme version 2', () => {
- expect(
- getOutlinedInputColors({
- disabled: true,
- theme: getTheme(false, false),
- })
- ).toMatchObject({
- activeColor: color(getTheme(false, false).colors?.text)
- .alpha(0.54)
- .rgb()
- .string(),
+ activeColor: getTheme().colors.primary,
+ disabledOpacity: stateOpacity.disabled,
});
});
@@ -1136,10 +919,10 @@ describe('getOutlinedInputColors - active color', () => {
expect(
getOutlinedInputColors({
error: true,
- theme: getTheme(false, true),
+ theme: getTheme(),
})
).toMatchObject({
- activeColor: getTheme(false, true).colors.error,
+ activeColor: getTheme().colors.error,
});
});
@@ -1156,7 +939,7 @@ describe('getOutlinedInputColors - active color', () => {
expect(
getOutlinedInputColors({
activeOutlineColor: 'beige',
- theme: getTheme(false, false),
+ theme: getTheme(),
})
).toMatchObject({
activeColor: 'beige',
@@ -1172,16 +955,6 @@ describe('getOutlinedInputColors - active color', () => {
activeColor: getTheme().colors.primary,
});
});
-
- it('should return theme active color, for theme version 2', () => {
- expect(
- getOutlinedInputColors({
- theme: getTheme(false, true),
- })
- ).toMatchObject({
- activeColor: getTheme(false, true).colors.primary,
- });
- });
});
describe('outlineStyle - underlineStyle', () => {
diff --git a/src/components/__tests__/ToggleButton.test.tsx b/src/components/__tests__/ToggleButton.test.tsx
index 3ab234d0f3..a830558681 100644
--- a/src/components/__tests__/ToggleButton.test.tsx
+++ b/src/components/__tests__/ToggleButton.test.tsx
@@ -2,10 +2,8 @@ import * as React from 'react';
import { Animated } from 'react-native';
import { act, render } from '@testing-library/react-native';
-import color from 'color';
import { getTheme } from '../../core/theming';
-import { tokens } from '../../styles/themes/v3/tokens';
import ToggleButton from '../ToggleButton';
import { getToggleButtonColor } from '../ToggleButton/utils';
@@ -33,56 +31,22 @@ it('renders unchecked toggle button', () => {
expect(tree).toMatchSnapshot();
});
-it('render toggle button with custom ripple color', () => {
- const { getByTestId } = render(
-
- );
-
- const iconContainer = getByTestId('toggle-button-container').props.children;
- expect(iconContainer.props.rippleColor).toBe('purple');
-});
-
describe('getToggleButtonColor', () => {
it('should return correct color when checked and theme version 3', () => {
expect(getToggleButtonColor({ theme: getTheme(), checked: true })).toBe(
- color(getTheme().colors.onSecondaryContainer)
- .alpha(tokens.md.ref.opacity.level2)
- .rgb()
- .string()
+ getTheme().colors.surfaceContainerHighest
);
});
it('should return correct color when checked and theme version 3, dark theme', () => {
expect(getToggleButtonColor({ theme: getTheme(true), checked: true })).toBe(
- color(getTheme(true).colors.onSecondaryContainer)
- .alpha(tokens.md.ref.opacity.level2)
- .rgb()
- .string()
+ getTheme(true).colors.surfaceContainerHighest
);
});
- it('should return correct color when checked and theme version 2', () => {
- expect(
- getToggleButtonColor({ theme: getTheme(false, false), checked: true })
- ).toBe('rgba(0, 0, 0, .08)');
- });
-
- it('should return correct color when checked and theme version 2, dark theme', () => {
- expect(
- getToggleButtonColor({ theme: getTheme(true, false), checked: true })
- ).toBe('rgba(255, 255, 255, .12)');
- });
-
- it('should return transparent color when not checked', () => {
+ it('should return correct color when not checked', () => {
expect(getToggleButtonColor({ theme: getTheme(), checked: false })).toBe(
- 'transparent'
+ getTheme().colors.surfaceContainer
);
});
});
diff --git a/src/components/__tests__/Typography/__snapshots__/Caption.test.tsx.snap b/src/components/__tests__/Typography/__snapshots__/Caption.test.tsx.snap
index 1120e943ca..8433f85658 100644
--- a/src/components/__tests__/Typography/__snapshots__/Caption.test.tsx.snap
+++ b/src/components/__tests__/Typography/__snapshots__/Caption.test.tsx.snap
@@ -5,7 +5,7 @@ exports[`renders caption applying style 1`] = `
style={
[
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
},
{
"textAlign": "left",
@@ -15,7 +15,7 @@ exports[`renders caption applying style 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 0.54)",
+ "color": "rgba(29, 27, 32, 0.54)",
"writingDirection": "ltr",
},
[
@@ -43,7 +43,7 @@ exports[`renders caption with children as content 1`] = `
style={
[
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
},
{
"textAlign": "left",
@@ -53,7 +53,7 @@ exports[`renders caption with children as content 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 0.54)",
+ "color": "rgba(29, 27, 32, 0.54)",
"writingDirection": "ltr",
},
[
diff --git a/src/components/__tests__/Typography/__snapshots__/Text.test.tsx.snap b/src/components/__tests__/Typography/__snapshots__/Text.test.tsx.snap
index a47cd14611..5b87989124 100644
--- a/src/components/__tests__/Typography/__snapshots__/Text.test.tsx.snap
+++ b/src/components/__tests__/Typography/__snapshots__/Text.test.tsx.snap
@@ -9,7 +9,7 @@ exports[`renders every variant of Text with children as content 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -34,7 +34,7 @@ exports[`renders every variant of Text with children as content 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -59,7 +59,7 @@ exports[`renders every variant of Text with children as content 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -84,7 +84,7 @@ exports[`renders every variant of Text with children as content 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -109,7 +109,7 @@ exports[`renders every variant of Text with children as content 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -134,7 +134,7 @@ exports[`renders every variant of Text with children as content 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -159,7 +159,7 @@ exports[`renders every variant of Text with children as content 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -184,7 +184,7 @@ exports[`renders every variant of Text with children as content 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -209,7 +209,7 @@ exports[`renders every variant of Text with children as content 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -234,7 +234,7 @@ exports[`renders every variant of Text with children as content 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -259,7 +259,7 @@ exports[`renders every variant of Text with children as content 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -284,7 +284,7 @@ exports[`renders every variant of Text with children as content 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -309,7 +309,7 @@ exports[`renders every variant of Text with children as content 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -334,7 +334,7 @@ exports[`renders every variant of Text with children as content 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -359,7 +359,7 @@ exports[`renders every variant of Text with children as content 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -386,7 +386,7 @@ exports[`renders v3 Text component with custom variant correctly 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
diff --git a/src/components/__tests__/__snapshots__/Avatar.test.tsx.snap b/src/components/__tests__/__snapshots__/Avatar.test.tsx.snap
index c73f2ae180..9e55666cef 100644
--- a/src/components/__tests__/__snapshots__/Avatar.test.tsx.snap
+++ b/src/components/__tests__/__snapshots__/Avatar.test.tsx.snap
@@ -158,7 +158,7 @@ exports[`renders avatar with text 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -212,7 +212,7 @@ exports[`renders avatar with text and custom background color 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -266,7 +266,7 @@ exports[`renders avatar with text and custom colors 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -320,7 +320,7 @@ exports[`renders avatar with text and custom size 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
diff --git a/src/components/__tests__/__snapshots__/Banner.test.tsx.snap b/src/components/__tests__/__snapshots__/Banner.test.tsx.snap
index b1aaff7ab0..6be6a1afa3 100644
--- a/src/components/__tests__/__snapshots__/Banner.test.tsx.snap
+++ b/src/components/__tests__/__snapshots__/Banner.test.tsx.snap
@@ -5,7 +5,7 @@ exports[`render visible banner, with custom theme 1`] = `
collapsable={false}
style={
{
- "backgroundColor": "rgb(247, 243, 249)",
+ "backgroundColor": "rgba(247, 242, 250, 1)",
"opacity": 1,
"shadowColor": "#000",
"shadowOffset": {
@@ -22,7 +22,7 @@ exports[`render visible banner, with custom theme 1`] = `
collapsable={false}
style={
{
- "backgroundColor": "rgb(247, 243, 249)",
+ "backgroundColor": "rgba(247, 242, 250, 1)",
"flex": undefined,
"shadowColor": "#000",
"shadowOffset": {
@@ -81,22 +81,26 @@ exports[`render visible banner, with custom theme 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
- "fontFamily": "System",
- "fontWeight": "400",
- "letterSpacing": 0,
- },
- {
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
{
- "flex": 1,
- "margin": 8,
- },
- {
- "color": "rgba(28, 27, 31, 1)",
+ "fontFamily": "System",
+ "fontSize": 14,
+ "fontWeight": "400",
+ "letterSpacing": 0.25,
+ "lineHeight": 20,
},
+ [
+ {
+ "flex": 1,
+ "margin": 8,
+ },
+ {
+ "color": "#00f",
+ },
+ ],
],
]
}
@@ -204,6 +208,9 @@ exports[`render visible banner, with custom theme 1`] = `
"flexDirection": "row",
"justifyContent": "center",
},
+ {
+ "opacity": 1,
+ },
undefined,
]
}
@@ -217,7 +224,7 @@ exports[`render visible banner, with custom theme 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -234,7 +241,6 @@ exports[`render visible banner, with custom theme 1`] = `
"marginVertical": 9,
"textAlign": "center",
},
- false,
{
"marginHorizontal": 12,
},
@@ -275,7 +281,7 @@ exports[`renders hidden banner, without action buttons and without image 1`] = `
collapsable={false}
style={
{
- "backgroundColor": "rgb(247, 243, 249)",
+ "backgroundColor": "rgba(247, 242, 250, 1)",
"opacity": 0,
"shadowColor": "#000",
"shadowOffset": {
@@ -292,7 +298,7 @@ exports[`renders hidden banner, without action buttons and without image 1`] = `
collapsable={false}
style={
{
- "backgroundColor": "rgb(247, 243, 249)",
+ "backgroundColor": "rgba(247, 242, 250, 1)",
"flex": undefined,
"shadowColor": "#000",
"shadowOffset": {
@@ -363,22 +369,26 @@ exports[`renders hidden banner, without action buttons and without image 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
- "fontFamily": "System",
- "fontWeight": "400",
- "letterSpacing": 0,
- },
- {
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
{
- "flex": 1,
- "margin": 8,
- },
- {
- "color": "rgba(28, 27, 31, 1)",
+ "fontFamily": "System",
+ "fontSize": 14,
+ "fontWeight": "400",
+ "letterSpacing": 0.25,
+ "lineHeight": 20,
},
+ [
+ {
+ "flex": 1,
+ "margin": 8,
+ },
+ {
+ "color": "rgba(29, 27, 32, 1)",
+ },
+ ],
],
]
}
@@ -406,7 +416,7 @@ exports[`renders visible banner, with action buttons and with image 1`] = `
collapsable={false}
style={
{
- "backgroundColor": "rgb(247, 243, 249)",
+ "backgroundColor": "rgba(247, 242, 250, 1)",
"opacity": 1,
"shadowColor": "#000",
"shadowOffset": {
@@ -423,7 +433,7 @@ exports[`renders visible banner, with action buttons and with image 1`] = `
collapsable={false}
style={
{
- "backgroundColor": "rgb(247, 243, 249)",
+ "backgroundColor": "rgba(247, 242, 250, 1)",
"flex": undefined,
"shadowColor": "#000",
"shadowOffset": {
@@ -504,22 +514,26 @@ exports[`renders visible banner, with action buttons and with image 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
- "fontFamily": "System",
- "fontWeight": "400",
- "letterSpacing": 0,
- },
- {
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
{
- "flex": 1,
- "margin": 8,
- },
- {
- "color": "rgba(28, 27, 31, 1)",
+ "fontFamily": "System",
+ "fontSize": 14,
+ "fontWeight": "400",
+ "letterSpacing": 0.25,
+ "lineHeight": 20,
},
+ [
+ {
+ "flex": 1,
+ "margin": 8,
+ },
+ {
+ "color": "rgba(29, 27, 32, 1)",
+ },
+ ],
],
]
}
@@ -627,6 +641,9 @@ exports[`renders visible banner, with action buttons and with image 1`] = `
"flexDirection": "row",
"justifyContent": "center",
},
+ {
+ "opacity": 1,
+ },
undefined,
]
}
@@ -640,7 +657,7 @@ exports[`renders visible banner, with action buttons and with image 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -657,7 +674,6 @@ exports[`renders visible banner, with action buttons and with image 1`] = `
"marginVertical": 9,
"textAlign": "center",
},
- false,
{
"marginHorizontal": 12,
},
@@ -698,7 +714,7 @@ exports[`renders visible banner, with action buttons and without image 1`] = `
collapsable={false}
style={
{
- "backgroundColor": "rgb(247, 243, 249)",
+ "backgroundColor": "rgba(247, 242, 250, 1)",
"opacity": 1,
"shadowColor": "#000",
"shadowOffset": {
@@ -715,7 +731,7 @@ exports[`renders visible banner, with action buttons and without image 1`] = `
collapsable={false}
style={
{
- "backgroundColor": "rgb(247, 243, 249)",
+ "backgroundColor": "rgba(247, 242, 250, 1)",
"flex": undefined,
"shadowColor": "#000",
"shadowOffset": {
@@ -774,22 +790,26 @@ exports[`renders visible banner, with action buttons and without image 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
- "fontFamily": "System",
- "fontWeight": "400",
- "letterSpacing": 0,
- },
- {
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
{
- "flex": 1,
- "margin": 8,
- },
- {
- "color": "rgba(28, 27, 31, 1)",
+ "fontFamily": "System",
+ "fontSize": 14,
+ "fontWeight": "400",
+ "letterSpacing": 0.25,
+ "lineHeight": 20,
},
+ [
+ {
+ "flex": 1,
+ "margin": 8,
+ },
+ {
+ "color": "rgba(29, 27, 32, 1)",
+ },
+ ],
],
]
}
@@ -897,6 +917,9 @@ exports[`renders visible banner, with action buttons and without image 1`] = `
"flexDirection": "row",
"justifyContent": "center",
},
+ {
+ "opacity": 1,
+ },
undefined,
]
}
@@ -910,7 +933,7 @@ exports[`renders visible banner, with action buttons and without image 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -927,7 +950,6 @@ exports[`renders visible banner, with action buttons and without image 1`] = `
"marginVertical": 9,
"textAlign": "center",
},
- false,
{
"marginHorizontal": 12,
},
@@ -1047,6 +1069,9 @@ exports[`renders visible banner, with action buttons and without image 1`] = `
"flexDirection": "row",
"justifyContent": "center",
},
+ {
+ "opacity": 1,
+ },
undefined,
]
}
@@ -1060,7 +1085,7 @@ exports[`renders visible banner, with action buttons and without image 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -1077,7 +1102,6 @@ exports[`renders visible banner, with action buttons and without image 1`] = `
"marginVertical": 9,
"textAlign": "center",
},
- false,
{
"marginHorizontal": 12,
},
@@ -1118,7 +1142,7 @@ exports[`renders visible banner, without action buttons and with image 1`] = `
collapsable={false}
style={
{
- "backgroundColor": "rgb(247, 243, 249)",
+ "backgroundColor": "rgba(247, 242, 250, 1)",
"opacity": 1,
"shadowColor": "#000",
"shadowOffset": {
@@ -1135,7 +1159,7 @@ exports[`renders visible banner, without action buttons and with image 1`] = `
collapsable={false}
style={
{
- "backgroundColor": "rgb(247, 243, 249)",
+ "backgroundColor": "rgba(247, 242, 250, 1)",
"flex": undefined,
"shadowColor": "#000",
"shadowOffset": {
@@ -1216,22 +1240,26 @@ exports[`renders visible banner, without action buttons and with image 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
- "fontFamily": "System",
- "fontWeight": "400",
- "letterSpacing": 0,
- },
- {
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
{
- "flex": 1,
- "margin": 8,
- },
- {
- "color": "rgba(28, 27, 31, 1)",
+ "fontFamily": "System",
+ "fontSize": 14,
+ "fontWeight": "400",
+ "letterSpacing": 0.25,
+ "lineHeight": 20,
},
+ [
+ {
+ "flex": 1,
+ "margin": 8,
+ },
+ {
+ "color": "rgba(29, 27, 32, 1)",
+ },
+ ],
],
]
}
@@ -1259,7 +1287,7 @@ exports[`renders visible banner, without action buttons and without image 1`] =
collapsable={false}
style={
{
- "backgroundColor": "rgb(247, 243, 249)",
+ "backgroundColor": "rgba(247, 242, 250, 1)",
"opacity": 1,
"shadowColor": "#000",
"shadowOffset": {
@@ -1276,7 +1304,7 @@ exports[`renders visible banner, without action buttons and without image 1`] =
collapsable={false}
style={
{
- "backgroundColor": "rgb(247, 243, 249)",
+ "backgroundColor": "rgba(247, 242, 250, 1)",
"flex": undefined,
"shadowColor": "#000",
"shadowOffset": {
@@ -1335,22 +1363,26 @@ exports[`renders visible banner, without action buttons and without image 1`] =
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
- "fontFamily": "System",
- "fontWeight": "400",
- "letterSpacing": 0,
- },
- {
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
{
- "flex": 1,
- "margin": 8,
- },
- {
- "color": "rgba(28, 27, 31, 1)",
+ "fontFamily": "System",
+ "fontSize": 14,
+ "fontWeight": "400",
+ "letterSpacing": 0.25,
+ "lineHeight": 20,
},
+ [
+ {
+ "flex": 1,
+ "margin": 8,
+ },
+ {
+ "color": "rgba(29, 27, 32, 1)",
+ },
+ ],
],
]
}
diff --git a/src/components/__tests__/__snapshots__/BottomNavigation.test.tsx.snap b/src/components/__tests__/__snapshots__/BottomNavigation.test.tsx.snap
index cc788ce0b9..587006fa3d 100644
--- a/src/components/__tests__/__snapshots__/BottomNavigation.test.tsx.snap
+++ b/src/components/__tests__/__snapshots__/BottomNavigation.test.tsx.snap
@@ -20,7 +20,7 @@ exports[`allows customizing Route's type via generics 1`] = `
"flex": 1,
},
{
- "backgroundColor": "rgba(255, 251, 254, 1)",
+ "backgroundColor": "rgba(254, 247, 255, 1)",
},
]
}
@@ -113,7 +113,7 @@ exports[`allows customizing Route's type via generics 1`] = `
style={
{
"alignItems": "center",
- "backgroundColor": "rgb(243, 237, 246)",
+ "backgroundColor": "rgba(243, 237, 247, 1)",
"overflow": "hidden",
}
}
@@ -313,7 +313,7 @@ exports[`allows customizing Route's type via generics 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -332,7 +332,7 @@ exports[`allows customizing Route's type via generics 1`] = `
"textAlign": "center",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontSize": 12,
"fontWeight": "500",
@@ -369,7 +369,7 @@ exports[`allows customizing Route's type via generics 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -388,7 +388,7 @@ exports[`allows customizing Route's type via generics 1`] = `
"textAlign": "center",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontSize": 12,
"fontWeight": "500",
@@ -567,7 +567,7 @@ exports[`allows customizing Route's type via generics 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -623,7 +623,7 @@ exports[`allows customizing Route's type via generics 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -687,7 +687,7 @@ exports[`hides labels in non-shifting bottom navigation 1`] = `
"flex": 1,
},
{
- "backgroundColor": "rgba(255, 251, 254, 1)",
+ "backgroundColor": "rgba(254, 247, 255, 1)",
},
]
}
@@ -780,7 +780,7 @@ exports[`hides labels in non-shifting bottom navigation 1`] = `
style={
{
"alignItems": "center",
- "backgroundColor": "rgb(243, 237, 246)",
+ "backgroundColor": "rgba(243, 237, 247, 1)",
"overflow": "hidden",
}
}
@@ -1428,7 +1428,7 @@ exports[`hides labels in shifting bottom navigation 1`] = `
"flex": 1,
},
{
- "backgroundColor": "rgba(255, 251, 254, 1)",
+ "backgroundColor": "rgba(254, 247, 255, 1)",
},
]
}
@@ -1521,7 +1521,7 @@ exports[`hides labels in shifting bottom navigation 1`] = `
style={
{
"alignItems": "center",
- "backgroundColor": "rgb(243, 237, 246)",
+ "backgroundColor": "rgba(243, 237, 247, 1)",
"overflow": "hidden",
}
}
@@ -2169,7 +2169,7 @@ exports[`renders bottom navigation with getLazy 1`] = `
"flex": 1,
},
{
- "backgroundColor": "rgba(255, 251, 254, 1)",
+ "backgroundColor": "rgba(254, 247, 255, 1)",
},
]
}
@@ -2394,7 +2394,7 @@ exports[`renders bottom navigation with getLazy 1`] = `
style={
{
"alignItems": "center",
- "backgroundColor": "rgb(243, 237, 246)",
+ "backgroundColor": "rgba(243, 237, 247, 1)",
"overflow": "hidden",
}
}
@@ -2654,7 +2654,7 @@ exports[`renders bottom navigation with getLazy 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -2673,7 +2673,7 @@ exports[`renders bottom navigation with getLazy 1`] = `
"textAlign": "center",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontSize": 12,
"fontWeight": "500",
@@ -2710,7 +2710,7 @@ exports[`renders bottom navigation with getLazy 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -2729,7 +2729,7 @@ exports[`renders bottom navigation with getLazy 1`] = `
"textAlign": "center",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontSize": 12,
"fontWeight": "500",
@@ -2968,7 +2968,7 @@ exports[`renders bottom navigation with getLazy 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -3024,7 +3024,7 @@ exports[`renders bottom navigation with getLazy 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -3282,7 +3282,7 @@ exports[`renders bottom navigation with getLazy 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -3338,7 +3338,7 @@ exports[`renders bottom navigation with getLazy 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -3596,7 +3596,7 @@ exports[`renders bottom navigation with getLazy 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -3652,7 +3652,7 @@ exports[`renders bottom navigation with getLazy 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -3910,7 +3910,7 @@ exports[`renders bottom navigation with getLazy 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -3966,7 +3966,7 @@ exports[`renders bottom navigation with getLazy 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -4030,7 +4030,7 @@ exports[`renders bottom navigation with scene animation 1`] = `
"flex": 1,
},
{
- "backgroundColor": "rgba(255, 251, 254, 1)",
+ "backgroundColor": "rgba(254, 247, 255, 1)",
},
]
}
@@ -4123,7 +4123,7 @@ exports[`renders bottom navigation with scene animation 1`] = `
style={
{
"alignItems": "center",
- "backgroundColor": "rgb(243, 237, 246)",
+ "backgroundColor": "rgba(243, 237, 247, 1)",
"overflow": "hidden",
}
}
@@ -4388,7 +4388,7 @@ exports[`renders bottom navigation with scene animation 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -4407,7 +4407,7 @@ exports[`renders bottom navigation with scene animation 1`] = `
"textAlign": "center",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontSize": 12,
"fontWeight": "500",
@@ -4651,7 +4651,7 @@ exports[`renders bottom navigation with scene animation 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -4914,7 +4914,7 @@ exports[`renders bottom navigation with scene animation 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -5177,7 +5177,7 @@ exports[`renders bottom navigation with scene animation 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -5440,7 +5440,7 @@ exports[`renders bottom navigation with scene animation 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -5504,7 +5504,7 @@ exports[`renders custom icon and label in non-shifting bottom navigation 1`] = `
"flex": 1,
},
{
- "backgroundColor": "rgba(255, 251, 254, 1)",
+ "backgroundColor": "rgba(254, 247, 255, 1)",
},
]
}
@@ -5597,7 +5597,7 @@ exports[`renders custom icon and label in non-shifting bottom navigation 1`] = `
style={
{
"alignItems": "center",
- "backgroundColor": "rgb(243, 237, 246)",
+ "backgroundColor": "rgba(243, 237, 247, 1)",
"overflow": "hidden",
}
}
@@ -5790,7 +5790,7 @@ exports[`renders custom icon and label in non-shifting bottom navigation 1`] = `
}
>
Route: 0
@@ -5809,7 +5809,7 @@ exports[`renders custom icon and label in non-shifting bottom navigation 1`] = `
}
>
Route: 0
@@ -6206,7 +6206,7 @@ exports[`renders custom icon and label in shifting bottom navigation 1`] = `
"flex": 1,
},
{
- "backgroundColor": "rgba(255, 251, 254, 1)",
+ "backgroundColor": "rgba(254, 247, 255, 1)",
},
]
}
@@ -6299,7 +6299,7 @@ exports[`renders custom icon and label in shifting bottom navigation 1`] = `
style={
{
"alignItems": "center",
- "backgroundColor": "rgb(243, 237, 246)",
+ "backgroundColor": "rgba(243, 237, 247, 1)",
"overflow": "hidden",
}
}
@@ -6497,7 +6497,7 @@ exports[`renders custom icon and label in shifting bottom navigation 1`] = `
}
>
Route: 0
@@ -7200,7 +7200,7 @@ exports[`renders custom icon and label with custom colors in non-shifting bottom
"flex": 1,
},
{
- "backgroundColor": "rgba(255, 251, 254, 1)",
+ "backgroundColor": "rgba(254, 247, 255, 1)",
},
]
}
@@ -7293,7 +7293,7 @@ exports[`renders custom icon and label with custom colors in non-shifting bottom
style={
{
"alignItems": "center",
- "backgroundColor": "rgb(243, 237, 246)",
+ "backgroundColor": "rgba(243, 237, 247, 1)",
"overflow": "hidden",
}
}
@@ -7553,7 +7553,7 @@ exports[`renders custom icon and label with custom colors in non-shifting bottom
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -7609,7 +7609,7 @@ exports[`renders custom icon and label with custom colors in non-shifting bottom
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -7867,7 +7867,7 @@ exports[`renders custom icon and label with custom colors in non-shifting bottom
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -7923,7 +7923,7 @@ exports[`renders custom icon and label with custom colors in non-shifting bottom
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -8181,7 +8181,7 @@ exports[`renders custom icon and label with custom colors in non-shifting bottom
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -8237,7 +8237,7 @@ exports[`renders custom icon and label with custom colors in non-shifting bottom
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -8301,7 +8301,7 @@ exports[`renders custom icon and label with custom colors in shifting bottom nav
"flex": 1,
},
{
- "backgroundColor": "rgba(255, 251, 254, 1)",
+ "backgroundColor": "rgba(254, 247, 255, 1)",
},
]
}
@@ -8394,7 +8394,7 @@ exports[`renders custom icon and label with custom colors in shifting bottom nav
style={
{
"alignItems": "center",
- "backgroundColor": "rgb(243, 237, 246)",
+ "backgroundColor": "rgba(243, 237, 247, 1)",
"overflow": "hidden",
}
}
@@ -8659,7 +8659,7 @@ exports[`renders custom icon and label with custom colors in shifting bottom nav
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -8922,7 +8922,7 @@ exports[`renders custom icon and label with custom colors in shifting bottom nav
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -9185,7 +9185,7 @@ exports[`renders custom icon and label with custom colors in shifting bottom nav
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -9249,7 +9249,7 @@ exports[`renders non-shifting bottom navigation 1`] = `
"flex": 1,
},
{
- "backgroundColor": "rgba(255, 251, 254, 1)",
+ "backgroundColor": "rgba(254, 247, 255, 1)",
},
]
}
@@ -9342,7 +9342,7 @@ exports[`renders non-shifting bottom navigation 1`] = `
style={
{
"alignItems": "center",
- "backgroundColor": "rgb(243, 237, 246)",
+ "backgroundColor": "rgba(243, 237, 247, 1)",
"overflow": "hidden",
}
}
@@ -9602,7 +9602,7 @@ exports[`renders non-shifting bottom navigation 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -9621,7 +9621,7 @@ exports[`renders non-shifting bottom navigation 1`] = `
"textAlign": "center",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontSize": 12,
"fontWeight": "500",
@@ -9658,7 +9658,7 @@ exports[`renders non-shifting bottom navigation 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -9677,7 +9677,7 @@ exports[`renders non-shifting bottom navigation 1`] = `
"textAlign": "center",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontSize": 12,
"fontWeight": "500",
@@ -9916,7 +9916,7 @@ exports[`renders non-shifting bottom navigation 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -9972,7 +9972,7 @@ exports[`renders non-shifting bottom navigation 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -10230,7 +10230,7 @@ exports[`renders non-shifting bottom navigation 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -10286,7 +10286,7 @@ exports[`renders non-shifting bottom navigation 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -10350,7 +10350,7 @@ exports[`renders shifting bottom navigation 1`] = `
"flex": 1,
},
{
- "backgroundColor": "rgba(255, 251, 254, 1)",
+ "backgroundColor": "rgba(254, 247, 255, 1)",
},
]
}
@@ -10443,7 +10443,7 @@ exports[`renders shifting bottom navigation 1`] = `
style={
{
"alignItems": "center",
- "backgroundColor": "rgb(243, 237, 246)",
+ "backgroundColor": "rgba(243, 237, 247, 1)",
"overflow": "hidden",
}
}
@@ -10708,7 +10708,7 @@ exports[`renders shifting bottom navigation 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -10727,7 +10727,7 @@ exports[`renders shifting bottom navigation 1`] = `
"textAlign": "center",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontSize": 12,
"fontWeight": "500",
@@ -10971,7 +10971,7 @@ exports[`renders shifting bottom navigation 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -11234,7 +11234,7 @@ exports[`renders shifting bottom navigation 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -11497,7 +11497,7 @@ exports[`renders shifting bottom navigation 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -11760,7 +11760,7 @@ exports[`renders shifting bottom navigation 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
diff --git a/src/components/__tests__/__snapshots__/Button.test.tsx.snap b/src/components/__tests__/__snapshots__/Button.test.tsx.snap
index db8e187690..6c34864a74 100644
--- a/src/components/__tests__/__snapshots__/Button.test.tsx.snap
+++ b/src/components/__tests__/__snapshots__/Button.test.tsx.snap
@@ -92,6 +92,9 @@ exports[`renders button with an accessibility hint 1`] = `
"flexDirection": "row",
"justifyContent": "center",
},
+ {
+ "opacity": 1,
+ },
undefined,
]
}
@@ -105,7 +108,7 @@ exports[`renders button with an accessibility hint 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -122,7 +125,6 @@ exports[`renders button with an accessibility hint 1`] = `
"marginVertical": 9,
"textAlign": "center",
},
- false,
{
"marginHorizontal": 12,
},
@@ -243,6 +245,9 @@ exports[`renders button with an accessibility label 1`] = `
"flexDirection": "row",
"justifyContent": "center",
},
+ {
+ "opacity": 1,
+ },
undefined,
]
}
@@ -256,7 +261,7 @@ exports[`renders button with an accessibility label 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -273,7 +278,6 @@ exports[`renders button with an accessibility label 1`] = `
"marginVertical": 9,
"textAlign": "center",
},
- false,
{
"marginHorizontal": 12,
},
@@ -393,6 +397,9 @@ exports[`renders button with button color 1`] = `
"flexDirection": "row",
"justifyContent": "center",
},
+ {
+ "opacity": 1,
+ },
undefined,
]
}
@@ -406,7 +413,7 @@ exports[`renders button with button color 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -423,7 +430,6 @@ exports[`renders button with button color 1`] = `
"marginVertical": 9,
"textAlign": "center",
},
- false,
{
"marginHorizontal": 12,
},
@@ -543,6 +549,9 @@ exports[`renders button with color 1`] = `
"flexDirection": "row",
"justifyContent": "center",
},
+ {
+ "opacity": 1,
+ },
undefined,
]
}
@@ -556,7 +565,7 @@ exports[`renders button with color 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -573,7 +582,6 @@ exports[`renders button with color 1`] = `
"marginVertical": 9,
"textAlign": "center",
},
- false,
{
"marginHorizontal": 12,
},
@@ -693,6 +701,9 @@ exports[`renders button with custom testID 1`] = `
"flexDirection": "row",
"justifyContent": "center",
},
+ {
+ "opacity": 1,
+ },
undefined,
]
}
@@ -706,7 +717,7 @@ exports[`renders button with custom testID 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -723,7 +734,6 @@ exports[`renders button with custom testID 1`] = `
"marginVertical": 9,
"textAlign": "center",
},
- false,
{
"marginHorizontal": 12,
},
@@ -843,6 +853,9 @@ exports[`renders button with icon 1`] = `
"flexDirection": "row",
"justifyContent": "center",
},
+ {
+ "opacity": 1,
+ },
undefined,
]
}
@@ -905,7 +918,7 @@ exports[`renders button with icon 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -922,7 +935,6 @@ exports[`renders button with icon 1`] = `
"marginVertical": 9,
"textAlign": "center",
},
- false,
{
"marginHorizontal": 16,
},
@@ -1042,6 +1054,9 @@ exports[`renders button with icon in reverse order 1`] = `
"flexDirection": "row",
"justifyContent": "center",
},
+ {
+ "opacity": 1,
+ },
{
"flexDirection": "row-reverse",
},
@@ -1106,7 +1121,7 @@ exports[`renders button with icon in reverse order 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -1123,7 +1138,6 @@ exports[`renders button with icon in reverse order 1`] = `
"marginVertical": 9,
"textAlign": "center",
},
- false,
{
"marginHorizontal": 16,
},
@@ -1243,6 +1257,9 @@ exports[`renders contained contained with mode 1`] = `
"flexDirection": "row",
"justifyContent": "center",
},
+ {
+ "opacity": 1,
+ },
undefined,
]
}
@@ -1256,7 +1273,7 @@ exports[`renders contained contained with mode 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -1273,7 +1290,6 @@ exports[`renders contained contained with mode 1`] = `
"marginVertical": 9,
"textAlign": "center",
},
- false,
{
"marginHorizontal": 24,
"marginVertical": 10,
@@ -1394,6 +1410,9 @@ exports[`renders disabled button 1`] = `
"flexDirection": "row",
"justifyContent": "center",
},
+ {
+ "opacity": 0.38,
+ },
undefined,
]
}
@@ -1407,7 +1426,7 @@ exports[`renders disabled button 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -1424,14 +1443,13 @@ exports[`renders disabled button 1`] = `
"marginVertical": 9,
"textAlign": "center",
},
- false,
{
"marginHorizontal": 12,
},
undefined,
false,
{
- "color": "rgba(28, 27, 31, 0.38)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontSize": 14,
"fontWeight": "500",
@@ -1544,6 +1562,9 @@ exports[`renders loading button 1`] = `
"flexDirection": "row",
"justifyContent": "center",
},
+ {
+ "opacity": 1,
+ },
undefined,
]
}
@@ -1765,7 +1786,7 @@ exports[`renders loading button 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -1782,7 +1803,6 @@ exports[`renders loading button 1`] = `
"marginVertical": 9,
"textAlign": "center",
},
- false,
{
"marginHorizontal": 16,
},
@@ -1834,7 +1854,7 @@ exports[`renders outlined button with mode 1`] = `
style={
{
"backgroundColor": "transparent",
- "borderColor": "rgba(121, 116, 126, 1)",
+ "borderColor": "rgba(202, 196, 208, 1)",
"borderRadius": 20,
"borderStyle": "solid",
"borderWidth": 1,
@@ -1902,6 +1922,9 @@ exports[`renders outlined button with mode 1`] = `
"flexDirection": "row",
"justifyContent": "center",
},
+ {
+ "opacity": 1,
+ },
undefined,
]
}
@@ -1915,7 +1938,7 @@ exports[`renders outlined button with mode 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -1932,7 +1955,6 @@ exports[`renders outlined button with mode 1`] = `
"marginVertical": 9,
"textAlign": "center",
},
- false,
{
"marginHorizontal": 24,
"marginVertical": 10,
@@ -2053,6 +2075,9 @@ exports[`renders text button by default 1`] = `
"flexDirection": "row",
"justifyContent": "center",
},
+ {
+ "opacity": 1,
+ },
undefined,
]
}
@@ -2066,7 +2091,7 @@ exports[`renders text button by default 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -2083,7 +2108,6 @@ exports[`renders text button by default 1`] = `
"marginVertical": 9,
"textAlign": "center",
},
- false,
{
"marginHorizontal": 12,
},
@@ -2203,6 +2227,9 @@ exports[`renders text button with mode 1`] = `
"flexDirection": "row",
"justifyContent": "center",
},
+ {
+ "opacity": 1,
+ },
undefined,
]
}
@@ -2216,7 +2243,7 @@ exports[`renders text button with mode 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -2233,7 +2260,6 @@ exports[`renders text button with mode 1`] = `
"marginVertical": 9,
"textAlign": "center",
},
- false,
{
"marginHorizontal": 12,
},
diff --git a/src/components/__tests__/__snapshots__/Chip.test.tsx.snap b/src/components/__tests__/__snapshots__/Chip.test.tsx.snap
index 2994761722..4c6358aa1d 100644
--- a/src/components/__tests__/__snapshots__/Chip.test.tsx.snap
+++ b/src/components/__tests__/__snapshots__/Chip.test.tsx.snap
@@ -100,6 +100,9 @@ exports[`renders chip with close button 1`] = `
{
"paddingLeft": 0,
},
+ {
+ "opacity": 1,
+ },
{
"paddingRight": 34,
},
@@ -160,7 +163,7 @@ exports[`renders chip with close button 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -395,6 +398,9 @@ exports[`renders chip with custom close button 1`] = `
{
"paddingLeft": 0,
},
+ {
+ "opacity": 1,
+ },
{
"paddingRight": 34,
},
@@ -455,7 +461,7 @@ exports[`renders chip with custom close button 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -690,6 +696,9 @@ exports[`renders chip with icon 1`] = `
{
"paddingLeft": 0,
},
+ {
+ "opacity": 1,
+ },
{
"paddingRight": 0,
},
@@ -750,7 +759,7 @@ exports[`renders chip with icon 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -892,6 +901,9 @@ exports[`renders chip with onPress 1`] = `
{
"paddingLeft": 0,
},
+ {
+ "opacity": 1,
+ },
{
"paddingRight": 0,
},
@@ -907,7 +919,7 @@ exports[`renders chip with onPress 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -972,7 +984,7 @@ exports[`renders outlined disabled chip 1`] = `
style={
{
"backgroundColor": "transparent",
- "borderColor": "rgba(73, 69, 79, 0.12)",
+ "borderColor": "rgba(243, 237, 247, 1)",
"borderRadius": 8,
"borderStyle": "solid",
"borderWidth": 1,
@@ -1049,6 +1061,9 @@ exports[`renders outlined disabled chip 1`] = `
{
"paddingLeft": 0,
},
+ {
+ "opacity": 0.38,
+ },
{
"paddingRight": 0,
},
@@ -1064,7 +1079,7 @@ exports[`renders outlined disabled chip 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -1081,7 +1096,7 @@ exports[`renders outlined disabled chip 1`] = `
"textAlignVertical": "center",
},
{
- "color": "rgba(28, 27, 31, 0.38)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontSize": 14,
"fontWeight": "500",
@@ -1111,7 +1126,7 @@ exports[`renders selected chip 1`] = `
collapsable={false}
style={
{
- "backgroundColor": "rgb(232, 222, 248)",
+ "backgroundColor": "rgba(232, 222, 248, 1)",
"borderRadius": 8,
"shadowColor": "#000",
"shadowOffset": {
@@ -1128,7 +1143,7 @@ exports[`renders selected chip 1`] = `
collapsable={false}
style={
{
- "backgroundColor": "rgb(232, 222, 248)",
+ "backgroundColor": "rgba(232, 222, 248, 1)",
"borderColor": "transparent",
"borderRadius": 8,
"borderStyle": "solid",
@@ -1206,6 +1221,9 @@ exports[`renders selected chip 1`] = `
{
"paddingLeft": 0,
},
+ {
+ "opacity": 1,
+ },
{
"paddingRight": 0,
},
@@ -1266,7 +1284,7 @@ exports[`renders selected chip 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
diff --git a/src/components/__tests__/__snapshots__/DataTable.test.tsx.snap b/src/components/__tests__/__snapshots__/DataTable.test.tsx.snap
index a6ffbfcb06..f6071c245c 100644
--- a/src/components/__tests__/__snapshots__/DataTable.test.tsx.snap
+++ b/src/components/__tests__/__snapshots__/DataTable.test.tsx.snap
@@ -54,7 +54,7 @@ exports[`DataTable.Cell renders data table cell 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -128,7 +128,7 @@ exports[`DataTable.Cell renders right aligned data table cell 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -213,7 +213,7 @@ exports[`DataTable.Header renders data table header 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -233,7 +233,7 @@ exports[`DataTable.Header renders data table header 1`] = `
},
{},
{
- "color": "rgba(28, 27, 31, 0.6)",
+ "color": "rgba(73, 69, 79, 1)",
},
undefined,
],
@@ -294,7 +294,7 @@ exports[`DataTable.Header renders data table header 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -314,7 +314,7 @@ exports[`DataTable.Header renders data table header 1`] = `
},
{},
{
- "color": "rgba(28, 27, 31, 0.6)",
+ "color": "rgba(73, 69, 79, 1)",
},
undefined,
],
@@ -352,7 +352,7 @@ exports[`DataTable.Pagination renders data table pagination 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -366,7 +366,7 @@ exports[`DataTable.Pagination renders data table pagination 1`] = `
"marginRight": 16,
},
{
- "color": "rgba(28, 27, 31, 0.6)",
+ "color": "rgba(73, 69, 79, 1)",
},
],
]
@@ -404,7 +404,7 @@ exports[`DataTable.Pagination renders data table pagination 1`] = `
style={
{
"backgroundColor": "transparent",
- "borderColor": "rgba(121, 116, 126, 1)",
+ "borderColor": "rgba(202, 196, 208, 1)",
"borderRadius": 20,
"borderWidth": 0,
"elevation": 0,
@@ -481,35 +481,43 @@ exports[`DataTable.Pagination renders data table pagination 1`] = `
}
testID="icon-button"
>
-
+
- chevron-left
-
+ [
+ {
+ "lineHeight": 24,
+ "transform": [
+ {
+ "scaleX": 1,
+ },
+ ],
+ },
+ {
+ "backgroundColor": "transparent",
+ },
+ ],
+ ]
+ }
+ >
+ chevron-left
+
+
@@ -538,7 +546,7 @@ exports[`DataTable.Pagination renders data table pagination 1`] = `
style={
{
"backgroundColor": "transparent",
- "borderColor": "rgba(121, 116, 126, 1)",
+ "borderColor": "rgba(202, 196, 208, 1)",
"borderRadius": 20,
"borderWidth": 0,
"elevation": 0,
@@ -615,35 +623,43 @@ exports[`DataTable.Pagination renders data table pagination 1`] = `
}
testID="icon-button"
>
-
+
- chevron-right
-
+ [
+ {
+ "lineHeight": 24,
+ "transform": [
+ {
+ "scaleX": 1,
+ },
+ ],
+ },
+ {
+ "backgroundColor": "transparent",
+ },
+ ],
+ ]
+ }
+ >
+ chevron-right
+
+
@@ -676,7 +692,7 @@ exports[`DataTable.Pagination renders data table pagination with fast-forward bu
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -690,7 +706,7 @@ exports[`DataTable.Pagination renders data table pagination with fast-forward bu
"marginRight": 16,
},
{
- "color": "rgba(28, 27, 31, 0.6)",
+ "color": "rgba(73, 69, 79, 1)",
},
],
]
@@ -730,7 +746,7 @@ exports[`DataTable.Pagination renders data table pagination with fast-forward bu
style={
{
"backgroundColor": "transparent",
- "borderColor": "rgba(121, 116, 126, 1)",
+ "borderColor": "rgba(202, 196, 208, 1)",
"borderRadius": 20,
"borderWidth": 0,
"elevation": 0,
@@ -807,35 +823,43 @@ exports[`DataTable.Pagination renders data table pagination with fast-forward bu
}
testID="icon-button"
>
-
+
- page-first
-
+ [
+ {
+ "lineHeight": 24,
+ "transform": [
+ {
+ "scaleX": 1,
+ },
+ ],
+ },
+ {
+ "backgroundColor": "transparent",
+ },
+ ],
+ ]
+ }
+ >
+ page-first
+
+
@@ -864,7 +888,7 @@ exports[`DataTable.Pagination renders data table pagination with fast-forward bu
style={
{
"backgroundColor": "transparent",
- "borderColor": "rgba(121, 116, 126, 1)",
+ "borderColor": "rgba(202, 196, 208, 1)",
"borderRadius": 20,
"borderWidth": 0,
"elevation": 0,
@@ -941,35 +965,43 @@ exports[`DataTable.Pagination renders data table pagination with fast-forward bu
}
testID="icon-button"
>
-
+
- chevron-left
-
+ [
+ {
+ "lineHeight": 24,
+ "transform": [
+ {
+ "scaleX": 1,
+ },
+ ],
+ },
+ {
+ "backgroundColor": "transparent",
+ },
+ ],
+ ]
+ }
+ >
+ chevron-left
+
+
@@ -998,7 +1030,7 @@ exports[`DataTable.Pagination renders data table pagination with fast-forward bu
style={
{
"backgroundColor": "transparent",
- "borderColor": "rgba(121, 116, 126, 1)",
+ "borderColor": "rgba(202, 196, 208, 1)",
"borderRadius": 20,
"borderWidth": 0,
"elevation": 0,
@@ -1075,35 +1107,43 @@ exports[`DataTable.Pagination renders data table pagination with fast-forward bu
}
testID="icon-button"
>
-
+
- chevron-right
-
+ [
+ {
+ "lineHeight": 24,
+ "transform": [
+ {
+ "scaleX": 1,
+ },
+ ],
+ },
+ {
+ "backgroundColor": "transparent",
+ },
+ ],
+ ]
+ }
+ >
+ chevron-right
+
+
@@ -1132,7 +1172,7 @@ exports[`DataTable.Pagination renders data table pagination with fast-forward bu
style={
{
"backgroundColor": "transparent",
- "borderColor": "rgba(121, 116, 126, 1)",
+ "borderColor": "rgba(202, 196, 208, 1)",
"borderRadius": 20,
"borderWidth": 0,
"elevation": 0,
@@ -1209,35 +1249,43 @@ exports[`DataTable.Pagination renders data table pagination with fast-forward bu
}
testID="icon-button"
>
-
+
- page-last
-
+ [
+ {
+ "lineHeight": 24,
+ "transform": [
+ {
+ "scaleX": 1,
+ },
+ ],
+ },
+ {
+ "backgroundColor": "transparent",
+ },
+ ],
+ ]
+ }
+ >
+ page-last
+
+
@@ -1270,7 +1318,7 @@ exports[`DataTable.Pagination renders data table pagination with label 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -1284,7 +1332,7 @@ exports[`DataTable.Pagination renders data table pagination with label 1`] = `
"marginRight": 16,
},
{
- "color": "rgba(28, 27, 31, 0.6)",
+ "color": "rgba(73, 69, 79, 1)",
},
],
]
@@ -1324,7 +1372,7 @@ exports[`DataTable.Pagination renders data table pagination with label 1`] = `
style={
{
"backgroundColor": "transparent",
- "borderColor": "rgba(121, 116, 126, 1)",
+ "borderColor": "rgba(202, 196, 208, 1)",
"borderRadius": 20,
"borderWidth": 0,
"elevation": 0,
@@ -1401,35 +1449,43 @@ exports[`DataTable.Pagination renders data table pagination with label 1`] = `
}
testID="icon-button"
>
-
+
- chevron-left
-
+ [
+ {
+ "lineHeight": 24,
+ "transform": [
+ {
+ "scaleX": 1,
+ },
+ ],
+ },
+ {
+ "backgroundColor": "transparent",
+ },
+ ],
+ ]
+ }
+ >
+ chevron-left
+
+
@@ -1458,7 +1514,7 @@ exports[`DataTable.Pagination renders data table pagination with label 1`] = `
style={
{
"backgroundColor": "transparent",
- "borderColor": "rgba(121, 116, 126, 1)",
+ "borderColor": "rgba(202, 196, 208, 1)",
"borderRadius": 20,
"borderWidth": 0,
"elevation": 0,
@@ -1535,35 +1591,43 @@ exports[`DataTable.Pagination renders data table pagination with label 1`] = `
}
testID="icon-button"
>
-
+
- chevron-right
-
+ [
+ {
+ "lineHeight": 24,
+ "transform": [
+ {
+ "scaleX": 1,
+ },
+ ],
+ },
+ {
+ "backgroundColor": "transparent",
+ },
+ ],
+ ]
+ }
+ >
+ chevron-right
+
+
@@ -1606,7 +1670,7 @@ exports[`DataTable.Pagination renders data table pagination with options select
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -1620,7 +1684,7 @@ exports[`DataTable.Pagination renders data table pagination with options select
"marginRight": 16,
},
{
- "color": "rgba(28, 27, 31, 0.6)",
+ "color": "rgba(73, 69, 79, 1)",
},
],
]
@@ -1654,7 +1718,7 @@ exports[`DataTable.Pagination renders data table pagination with options select
style={
{
"backgroundColor": "transparent",
- "borderColor": "rgba(121, 116, 126, 1)",
+ "borderColor": "rgba(202, 196, 208, 1)",
"borderRadius": 20,
"borderStyle": "solid",
"borderWidth": 1,
@@ -1723,6 +1787,9 @@ exports[`DataTable.Pagination renders data table pagination with options select
"flexDirection": "row",
"justifyContent": "center",
},
+ {
+ "opacity": 1,
+ },
{
"flexDirection": "row-reverse",
},
@@ -1784,7 +1851,7 @@ exports[`DataTable.Pagination renders data table pagination with options select
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -1801,7 +1868,6 @@ exports[`DataTable.Pagination renders data table pagination with options select
"marginVertical": 9,
"textAlign": "center",
},
- false,
{
"marginHorizontal": 24,
"marginVertical": 10,
@@ -1840,7 +1906,7 @@ exports[`DataTable.Pagination renders data table pagination with options select
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -1854,7 +1920,7 @@ exports[`DataTable.Pagination renders data table pagination with options select
"marginRight": 16,
},
{
- "color": "rgba(28, 27, 31, 0.6)",
+ "color": "rgba(73, 69, 79, 1)",
},
],
]
@@ -1894,7 +1960,7 @@ exports[`DataTable.Pagination renders data table pagination with options select
style={
{
"backgroundColor": "transparent",
- "borderColor": "rgba(121, 116, 126, 1)",
+ "borderColor": "rgba(202, 196, 208, 1)",
"borderRadius": 20,
"borderWidth": 0,
"elevation": 0,
@@ -1971,35 +2037,43 @@ exports[`DataTable.Pagination renders data table pagination with options select
}
testID="icon-button"
>
-
+
- page-first
-
+ [
+ {
+ "lineHeight": 24,
+ "transform": [
+ {
+ "scaleX": 1,
+ },
+ ],
+ },
+ {
+ "backgroundColor": "transparent",
+ },
+ ],
+ ]
+ }
+ >
+ page-first
+
+
@@ -2028,7 +2102,7 @@ exports[`DataTable.Pagination renders data table pagination with options select
style={
{
"backgroundColor": "transparent",
- "borderColor": "rgba(121, 116, 126, 1)",
+ "borderColor": "rgba(202, 196, 208, 1)",
"borderRadius": 20,
"borderWidth": 0,
"elevation": 0,
@@ -2105,35 +2179,43 @@ exports[`DataTable.Pagination renders data table pagination with options select
}
testID="icon-button"
>
-
+
- chevron-left
-
+ [
+ {
+ "lineHeight": 24,
+ "transform": [
+ {
+ "scaleX": 1,
+ },
+ ],
+ },
+ {
+ "backgroundColor": "transparent",
+ },
+ ],
+ ]
+ }
+ >
+ chevron-left
+
+
@@ -2162,7 +2244,7 @@ exports[`DataTable.Pagination renders data table pagination with options select
style={
{
"backgroundColor": "transparent",
- "borderColor": "rgba(121, 116, 126, 1)",
+ "borderColor": "rgba(202, 196, 208, 1)",
"borderRadius": 20,
"borderWidth": 0,
"elevation": 0,
@@ -2239,35 +2321,43 @@ exports[`DataTable.Pagination renders data table pagination with options select
}
testID="icon-button"
>
-
+
- chevron-right
-
+ [
+ {
+ "lineHeight": 24,
+ "transform": [
+ {
+ "scaleX": 1,
+ },
+ ],
+ },
+ {
+ "backgroundColor": "transparent",
+ },
+ ],
+ ]
+ }
+ >
+ chevron-right
+
+
@@ -2296,7 +2386,7 @@ exports[`DataTable.Pagination renders data table pagination with options select
style={
{
"backgroundColor": "transparent",
- "borderColor": "rgba(121, 116, 126, 1)",
+ "borderColor": "rgba(202, 196, 208, 1)",
"borderRadius": 20,
"borderWidth": 0,
"elevation": 0,
@@ -2373,35 +2463,43 @@ exports[`DataTable.Pagination renders data table pagination with options select
}
testID="icon-button"
>
-
+
- page-last
-
+ [
+ {
+ "lineHeight": 24,
+ "transform": [
+ {
+ "scaleX": 1,
+ },
+ ],
+ },
+ {
+ "backgroundColor": "transparent",
+ },
+ ],
+ ]
+ }
+ >
+ page-last
+
+
@@ -2475,7 +2573,7 @@ exports[`DataTable.Title renders data table title with press handler 1`] = `
style={
[
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontSize": 16,
},
[
@@ -2505,7 +2603,7 @@ exports[`DataTable.Title renders data table title with press handler 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -2603,7 +2701,7 @@ exports[`DataTable.Title renders data table title with sort icon 1`] = `
style={
[
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontSize": 16,
},
[
@@ -2633,7 +2731,7 @@ exports[`DataTable.Title renders data table title with sort icon 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -2719,7 +2817,7 @@ exports[`DataTable.Title renders right aligned data table title 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -2739,7 +2837,7 @@ exports[`DataTable.Title renders right aligned data table title 1`] = `
},
{},
{
- "color": "rgba(28, 27, 31, 0.6)",
+ "color": "rgba(73, 69, 79, 1)",
},
undefined,
],
diff --git a/src/components/__tests__/__snapshots__/DrawerItem.test.tsx.snap b/src/components/__tests__/__snapshots__/DrawerItem.test.tsx.snap
index 78e3ed8612..5746cc089b 100644
--- a/src/components/__tests__/__snapshots__/DrawerItem.test.tsx.snap
+++ b/src/components/__tests__/__snapshots__/DrawerItem.test.tsx.snap
@@ -43,10 +43,6 @@ exports[`renders DrawerItem with icon 1`] = `
"marginHorizontal": 10,
"marginVertical": 4,
},
- {
- "backgroundColor": undefined,
- "borderRadius": 28,
- },
{
"height": 56,
"justifyContent": "center",
@@ -54,6 +50,10 @@ exports[`renders DrawerItem with icon 1`] = `
"marginRight": 12,
"marginVertical": 0,
},
+ {
+ "backgroundColor": undefined,
+ "borderRadius": 28,
+ },
undefined,
],
]
@@ -122,7 +122,7 @@ exports[`renders DrawerItem with icon 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -202,10 +202,6 @@ exports[`renders active DrawerItem 1`] = `
"marginHorizontal": 10,
"marginVertical": 4,
},
- {
- "backgroundColor": "rgba(232, 222, 248, 1)",
- "borderRadius": 28,
- },
{
"height": 56,
"justifyContent": "center",
@@ -213,6 +209,10 @@ exports[`renders active DrawerItem 1`] = `
"marginRight": 12,
"marginVertical": 0,
},
+ {
+ "backgroundColor": "rgba(232, 222, 248, 1)",
+ "borderRadius": 28,
+ },
undefined,
],
]
@@ -281,7 +281,7 @@ exports[`renders active DrawerItem 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -361,10 +361,6 @@ exports[`renders basic DrawerItem 1`] = `
"marginHorizontal": 10,
"marginVertical": 4,
},
- {
- "backgroundColor": undefined,
- "borderRadius": 28,
- },
{
"height": 56,
"justifyContent": "center",
@@ -372,6 +368,10 @@ exports[`renders basic DrawerItem 1`] = `
"marginRight": 12,
"marginVertical": 0,
},
+ {
+ "backgroundColor": undefined,
+ "borderRadius": 28,
+ },
undefined,
],
]
@@ -411,7 +411,7 @@ exports[`renders basic DrawerItem 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
diff --git a/src/components/__tests__/__snapshots__/FAB.test.tsx.snap b/src/components/__tests__/__snapshots__/FAB.test.tsx.snap
index b4a42c20fa..7dbef02469 100644
--- a/src/components/__tests__/__snapshots__/FAB.test.tsx.snap
+++ b/src/components/__tests__/__snapshots__/FAB.test.tsx.snap
@@ -522,180 +522,6 @@ exports[`renders default FAB 1`] = `
`;
-exports[`renders disabled FAB 1`] = `
-
-
-
-
-
-
-
- plus
-
-
-
-
-
-
-
-`;
-
exports[`renders extended FAB 1`] = `
-
+
- camera
-
+ [
+ {
+ "lineHeight": 24,
+ "transform": [
+ {
+ "scaleX": 1,
+ },
+ ],
+ },
+ {
+ "backgroundColor": "transparent",
+ },
+ ],
+ ]
+ }
+ >
+ camera
+
+
@@ -167,7 +175,7 @@ exports[`renders icon button by default 1`] = `
style={
{
"backgroundColor": "transparent",
- "borderColor": "rgba(121, 116, 126, 1)",
+ "borderColor": "rgba(202, 196, 208, 1)",
"borderRadius": 20,
"borderWidth": 0,
"elevation": 0,
@@ -243,35 +251,43 @@ exports[`renders icon button by default 1`] = `
}
testID="icon-button"
>
-
+
- camera
-
+ [
+ {
+ "lineHeight": 24,
+ "transform": [
+ {
+ "scaleX": 1,
+ },
+ ],
+ },
+ {
+ "backgroundColor": "transparent",
+ },
+ ],
+ ]
+ }
+ >
+ camera
+
+
@@ -303,7 +319,7 @@ exports[`renders icon button with color 1`] = `
style={
{
"backgroundColor": "transparent",
- "borderColor": "rgba(121, 116, 126, 1)",
+ "borderColor": "rgba(202, 196, 208, 1)",
"borderRadius": 20,
"borderWidth": 0,
"elevation": 0,
@@ -379,35 +395,43 @@ exports[`renders icon button with color 1`] = `
}
testID="icon-button"
>
-
+
- camera
-
+ [
+ {
+ "lineHeight": 24,
+ "transform": [
+ {
+ "scaleX": 1,
+ },
+ ],
+ },
+ {
+ "backgroundColor": "transparent",
+ },
+ ],
+ ]
+ }
+ >
+ camera
+
+
@@ -439,7 +463,7 @@ exports[`renders icon button with size 1`] = `
style={
{
"backgroundColor": "transparent",
- "borderColor": "rgba(121, 116, 126, 1)",
+ "borderColor": "rgba(202, 196, 208, 1)",
"borderRadius": 23,
"borderWidth": 0,
"elevation": 0,
@@ -515,35 +539,43 @@ exports[`renders icon button with size 1`] = `
}
testID="icon-button"
>
-
+
- camera
-
+ [
+ {
+ "lineHeight": 30,
+ "transform": [
+ {
+ "scaleX": 1,
+ },
+ ],
+ },
+ {
+ "backgroundColor": "transparent",
+ },
+ ],
+ ]
+ }
+ >
+ camera
+
+
@@ -575,7 +607,7 @@ exports[`renders icon change animated 1`] = `
style={
{
"backgroundColor": "transparent",
- "borderColor": "rgba(121, 116, 126, 1)",
+ "borderColor": "rgba(202, 196, 208, 1)",
"borderRadius": 20,
"borderWidth": 0,
"elevation": 0,
@@ -653,66 +685,74 @@ exports[`renders icon change animated 1`] = `
>
-
- camera
-
+
+ camera
+
+
diff --git a/src/components/__tests__/__snapshots__/ListAccordion.test.tsx.snap b/src/components/__tests__/__snapshots__/ListAccordion.test.tsx.snap
index 0857e59773..ec3393cb29 100644
--- a/src/components/__tests__/__snapshots__/ListAccordion.test.tsx.snap
+++ b/src/components/__tests__/__snapshots__/ListAccordion.test.tsx.snap
@@ -5,7 +5,7 @@ exports[`renders expanded accordion 1`] = `
@@ -90,7 +90,7 @@ exports[`renders expanded accordion 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -237,7 +237,7 @@ exports[`renders expanded accordion 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -250,7 +250,7 @@ exports[`renders expanded accordion 1`] = `
"fontSize": 16,
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
},
undefined,
],
@@ -270,7 +270,7 @@ exports[`renders list accordion with children 1`] = `
@@ -402,7 +402,7 @@ exports[`renders list accordion with children 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -415,7 +415,7 @@ exports[`renders list accordion with children 1`] = `
"fontSize": 16,
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
},
undefined,
],
@@ -477,7 +477,7 @@ exports[`renders list accordion with custom title and description styles 1`] = `
@@ -562,7 +562,7 @@ exports[`renders list accordion with custom title and description styles 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -575,7 +575,7 @@ exports[`renders list accordion with custom title and description styles 1`] = `
"fontSize": 16,
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
},
{
"color": "#f44336",
@@ -596,7 +596,7 @@ exports[`renders list accordion with custom title and description styles 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -677,7 +677,7 @@ exports[`renders list accordion with left items 1`] = `
@@ -809,7 +809,7 @@ exports[`renders list accordion with left items 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -822,7 +822,7 @@ exports[`renders list accordion with left items 1`] = `
"fontSize": 16,
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
},
undefined,
],
@@ -884,7 +884,7 @@ exports[`renders multiline list accordion 1`] = `
@@ -969,7 +969,7 @@ exports[`renders multiline list accordion 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -982,7 +982,7 @@ exports[`renders multiline list accordion 1`] = `
"fontSize": 16,
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
},
undefined,
],
@@ -1001,7 +1001,7 @@ exports[`renders multiline list accordion 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
diff --git a/src/components/__tests__/__snapshots__/ListItem.test.tsx.snap b/src/components/__tests__/__snapshots__/ListItem.test.tsx.snap
index 1f8c683d3a..d194b59877 100644
--- a/src/components/__tests__/__snapshots__/ListItem.test.tsx.snap
+++ b/src/components/__tests__/__snapshots__/ListItem.test.tsx.snap
@@ -82,7 +82,7 @@ exports[`renders list item with custom description 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -95,7 +95,7 @@ exports[`renders list item with custom description 1`] = `
"fontSize": 16,
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
},
undefined,
],
@@ -216,6 +216,9 @@ exports[`renders list item with custom description 1`] = `
{
"paddingLeft": 0,
},
+ {
+ "opacity": 1,
+ },
{
"paddingRight": 0,
},
@@ -276,7 +279,7 @@ exports[`renders list item with custom description 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -405,7 +408,7 @@ exports[`renders list item with custom title and description styles 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -418,7 +421,7 @@ exports[`renders list item with custom title and description styles 1`] = `
"fontSize": 16,
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
},
{
"fontSize": 20,
@@ -439,7 +442,7 @@ exports[`renders list item with custom title and description styles 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -553,7 +556,7 @@ exports[`renders list item with left and right items 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -566,7 +569,7 @@ exports[`renders list item with left and right items 1`] = `
"fontSize": 16,
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
},
undefined,
],
@@ -585,7 +588,7 @@ exports[`renders list item with left and right items 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -787,7 +790,7 @@ exports[`renders list item with left item 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -800,7 +803,7 @@ exports[`renders list item with left item 1`] = `
"fontSize": 16,
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
},
undefined,
],
@@ -896,7 +899,7 @@ exports[`renders list item with right item 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -909,7 +912,7 @@ exports[`renders list item with right item 1`] = `
"fontSize": 16,
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
},
undefined,
],
@@ -1008,7 +1011,7 @@ exports[`renders list item with title and description 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -1021,7 +1024,7 @@ exports[`renders list item with title and description 1`] = `
"fontSize": 16,
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
},
undefined,
],
@@ -1040,7 +1043,7 @@ exports[`renders list item with title and description 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -1149,7 +1152,7 @@ exports[`renders with a description with typeof number 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -1162,7 +1165,7 @@ exports[`renders with a description with typeof number 1`] = `
"fontSize": 16,
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
},
{
"fontSize": 20,
@@ -1183,7 +1186,7 @@ exports[`renders with a description with typeof number 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
diff --git a/src/components/__tests__/__snapshots__/ListSection.test.tsx.snap b/src/components/__tests__/__snapshots__/ListSection.test.tsx.snap
index b5bc07c4b8..bb71edde3b 100644
--- a/src/components/__tests__/__snapshots__/ListSection.test.tsx.snap
+++ b/src/components/__tests__/__snapshots__/ListSection.test.tsx.snap
@@ -16,46 +16,63 @@ exports[`renders list section with custom title style 1`] = `
"scale": 1,
},
"colors": {
- "backdrop": "rgba(50, 47, 55, 0.4)",
- "background": "rgba(255, 251, 254, 1)",
+ "background": "rgba(254, 247, 255, 1)",
"elevation": {
"level0": "transparent",
- "level1": "rgb(247, 243, 249)",
- "level2": "rgb(243, 237, 246)",
- "level3": "rgb(238, 232, 244)",
- "level4": "rgb(236, 230, 243)",
- "level5": "rgb(233, 227, 241)",
+ "level1": "rgba(247, 242, 250, 1)",
+ "level2": "rgba(243, 237, 247, 1)",
+ "level3": "rgba(236, 230, 240, 1)",
+ "level4": "rgba(236, 230, 240, 1)",
+ "level5": "rgba(230, 224, 233, 1)",
},
"error": "rgba(179, 38, 30, 1)",
"errorContainer": "rgba(249, 222, 220, 1)",
- "inverseOnSurface": "rgba(244, 239, 244, 1)",
+ "inverseOnSurface": "rgba(245, 239, 247, 1)",
"inversePrimary": "rgba(208, 188, 255, 1)",
- "inverseSurface": "rgba(49, 48, 51, 1)",
- "onBackground": "rgba(28, 27, 31, 1)",
+ "inverseSurface": "rgba(50, 47, 53, 1)",
+ "onBackground": "rgba(29, 27, 32, 1)",
"onError": "rgba(255, 255, 255, 1)",
"onErrorContainer": "rgba(65, 14, 11, 1)",
"onPrimary": "rgba(255, 255, 255, 1)",
"onPrimaryContainer": "rgba(33, 0, 93, 1)",
+ "onPrimaryFixed": "rgba(33, 0, 93, 1)",
+ "onPrimaryFixedVariant": "rgba(79, 55, 139, 1)",
"onSecondary": "rgba(255, 255, 255, 1)",
"onSecondaryContainer": "rgba(29, 25, 43, 1)",
- "onSurface": "rgba(28, 27, 31, 1)",
- "onSurfaceDisabled": "rgba(28, 27, 31, 0.38)",
+ "onSecondaryFixed": "rgba(29, 25, 43, 1)",
+ "onSecondaryFixedVariant": "rgba(74, 68, 88, 1)",
+ "onSurface": "rgba(29, 27, 32, 1)",
"onSurfaceVariant": "rgba(73, 69, 79, 1)",
"onTertiary": "rgba(255, 255, 255, 1)",
"onTertiaryContainer": "rgba(49, 17, 29, 1)",
+ "onTertiaryFixed": "rgba(49, 17, 29, 1)",
+ "onTertiaryFixedVariant": "rgba(99, 59, 72, 1)",
"outline": "rgba(121, 116, 126, 1)",
"outlineVariant": "rgba(202, 196, 208, 1)",
"primary": "rgba(103, 80, 164, 1)",
"primaryContainer": "rgba(234, 221, 255, 1)",
+ "primaryFixed": "rgba(234, 221, 255, 1)",
+ "primaryFixedDim": "rgba(208, 188, 255, 1)",
"scrim": "rgba(0, 0, 0, 1)",
"secondary": "rgba(98, 91, 113, 1)",
"secondaryContainer": "rgba(232, 222, 248, 1)",
+ "secondaryFixed": "rgba(232, 222, 248, 1)",
+ "secondaryFixedDim": "rgba(204, 194, 220, 1)",
"shadow": "rgba(0, 0, 0, 1)",
- "surface": "rgba(255, 251, 254, 1)",
- "surfaceDisabled": "rgba(28, 27, 31, 0.12)",
+ "stateLayerPressed": "rgba(29, 27, 32, 0.1)",
+ "surface": "rgba(254, 247, 255, 1)",
+ "surfaceBright": "rgba(254, 247, 255, 1)",
+ "surfaceContainer": "rgba(243, 237, 247, 1)",
+ "surfaceContainerHigh": "rgba(236, 230, 240, 1)",
+ "surfaceContainerHighest": "rgba(230, 224, 233, 1)",
+ "surfaceContainerLow": "rgba(247, 242, 250, 1)",
+ "surfaceContainerLowest": "rgba(255, 255, 255, 1)",
+ "surfaceDim": "rgba(222, 216, 225, 1)",
"surfaceVariant": "rgba(231, 224, 236, 1)",
"tertiary": "rgba(125, 82, 96, 1)",
"tertiaryContainer": "rgba(255, 216, 228, 1)",
+ "tertiaryFixed": "rgba(255, 216, 228, 1)",
+ "tertiaryFixedDim": "rgba(239, 184, 200, 1)",
},
"dark": false,
"fonts": {
@@ -184,7 +201,7 @@ exports[`renders list section with custom title style 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -346,7 +363,7 @@ exports[`renders list section with custom title style 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -359,7 +376,7 @@ exports[`renders list section with custom title style 1`] = `
"fontSize": 16,
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
},
undefined,
],
@@ -499,7 +516,7 @@ exports[`renders list section with custom title style 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -512,7 +529,7 @@ exports[`renders list section with custom title style 1`] = `
"fontSize": 16,
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
},
undefined,
],
@@ -543,46 +560,63 @@ exports[`renders list section with subheader 1`] = `
"scale": 1,
},
"colors": {
- "backdrop": "rgba(50, 47, 55, 0.4)",
- "background": "rgba(255, 251, 254, 1)",
+ "background": "rgba(254, 247, 255, 1)",
"elevation": {
"level0": "transparent",
- "level1": "rgb(247, 243, 249)",
- "level2": "rgb(243, 237, 246)",
- "level3": "rgb(238, 232, 244)",
- "level4": "rgb(236, 230, 243)",
- "level5": "rgb(233, 227, 241)",
+ "level1": "rgba(247, 242, 250, 1)",
+ "level2": "rgba(243, 237, 247, 1)",
+ "level3": "rgba(236, 230, 240, 1)",
+ "level4": "rgba(236, 230, 240, 1)",
+ "level5": "rgba(230, 224, 233, 1)",
},
"error": "rgba(179, 38, 30, 1)",
"errorContainer": "rgba(249, 222, 220, 1)",
- "inverseOnSurface": "rgba(244, 239, 244, 1)",
+ "inverseOnSurface": "rgba(245, 239, 247, 1)",
"inversePrimary": "rgba(208, 188, 255, 1)",
- "inverseSurface": "rgba(49, 48, 51, 1)",
- "onBackground": "rgba(28, 27, 31, 1)",
+ "inverseSurface": "rgba(50, 47, 53, 1)",
+ "onBackground": "rgba(29, 27, 32, 1)",
"onError": "rgba(255, 255, 255, 1)",
"onErrorContainer": "rgba(65, 14, 11, 1)",
"onPrimary": "rgba(255, 255, 255, 1)",
"onPrimaryContainer": "rgba(33, 0, 93, 1)",
+ "onPrimaryFixed": "rgba(33, 0, 93, 1)",
+ "onPrimaryFixedVariant": "rgba(79, 55, 139, 1)",
"onSecondary": "rgba(255, 255, 255, 1)",
"onSecondaryContainer": "rgba(29, 25, 43, 1)",
- "onSurface": "rgba(28, 27, 31, 1)",
- "onSurfaceDisabled": "rgba(28, 27, 31, 0.38)",
+ "onSecondaryFixed": "rgba(29, 25, 43, 1)",
+ "onSecondaryFixedVariant": "rgba(74, 68, 88, 1)",
+ "onSurface": "rgba(29, 27, 32, 1)",
"onSurfaceVariant": "rgba(73, 69, 79, 1)",
"onTertiary": "rgba(255, 255, 255, 1)",
"onTertiaryContainer": "rgba(49, 17, 29, 1)",
+ "onTertiaryFixed": "rgba(49, 17, 29, 1)",
+ "onTertiaryFixedVariant": "rgba(99, 59, 72, 1)",
"outline": "rgba(121, 116, 126, 1)",
"outlineVariant": "rgba(202, 196, 208, 1)",
"primary": "rgba(103, 80, 164, 1)",
"primaryContainer": "rgba(234, 221, 255, 1)",
+ "primaryFixed": "rgba(234, 221, 255, 1)",
+ "primaryFixedDim": "rgba(208, 188, 255, 1)",
"scrim": "rgba(0, 0, 0, 1)",
"secondary": "rgba(98, 91, 113, 1)",
"secondaryContainer": "rgba(232, 222, 248, 1)",
+ "secondaryFixed": "rgba(232, 222, 248, 1)",
+ "secondaryFixedDim": "rgba(204, 194, 220, 1)",
"shadow": "rgba(0, 0, 0, 1)",
- "surface": "rgba(255, 251, 254, 1)",
- "surfaceDisabled": "rgba(28, 27, 31, 0.12)",
+ "stateLayerPressed": "rgba(29, 27, 32, 0.1)",
+ "surface": "rgba(254, 247, 255, 1)",
+ "surfaceBright": "rgba(254, 247, 255, 1)",
+ "surfaceContainer": "rgba(243, 237, 247, 1)",
+ "surfaceContainerHigh": "rgba(236, 230, 240, 1)",
+ "surfaceContainerHighest": "rgba(230, 224, 233, 1)",
+ "surfaceContainerLow": "rgba(247, 242, 250, 1)",
+ "surfaceContainerLowest": "rgba(255, 255, 255, 1)",
+ "surfaceDim": "rgba(222, 216, 225, 1)",
"surfaceVariant": "rgba(231, 224, 236, 1)",
"tertiary": "rgba(125, 82, 96, 1)",
"tertiaryContainer": "rgba(255, 216, 228, 1)",
+ "tertiaryFixed": "rgba(255, 216, 228, 1)",
+ "tertiaryFixedDim": "rgba(239, 184, 200, 1)",
},
"dark": false,
"fonts": {
@@ -711,7 +745,7 @@ exports[`renders list section with subheader 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -871,7 +905,7 @@ exports[`renders list section with subheader 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -884,7 +918,7 @@ exports[`renders list section with subheader 1`] = `
"fontSize": 16,
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
},
undefined,
],
@@ -1024,7 +1058,7 @@ exports[`renders list section with subheader 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -1037,7 +1071,7 @@ exports[`renders list section with subheader 1`] = `
"fontSize": 16,
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
},
undefined,
],
@@ -1068,46 +1102,63 @@ exports[`renders list section without subheader 1`] = `
"scale": 1,
},
"colors": {
- "backdrop": "rgba(50, 47, 55, 0.4)",
- "background": "rgba(255, 251, 254, 1)",
+ "background": "rgba(254, 247, 255, 1)",
"elevation": {
"level0": "transparent",
- "level1": "rgb(247, 243, 249)",
- "level2": "rgb(243, 237, 246)",
- "level3": "rgb(238, 232, 244)",
- "level4": "rgb(236, 230, 243)",
- "level5": "rgb(233, 227, 241)",
+ "level1": "rgba(247, 242, 250, 1)",
+ "level2": "rgba(243, 237, 247, 1)",
+ "level3": "rgba(236, 230, 240, 1)",
+ "level4": "rgba(236, 230, 240, 1)",
+ "level5": "rgba(230, 224, 233, 1)",
},
"error": "rgba(179, 38, 30, 1)",
"errorContainer": "rgba(249, 222, 220, 1)",
- "inverseOnSurface": "rgba(244, 239, 244, 1)",
+ "inverseOnSurface": "rgba(245, 239, 247, 1)",
"inversePrimary": "rgba(208, 188, 255, 1)",
- "inverseSurface": "rgba(49, 48, 51, 1)",
- "onBackground": "rgba(28, 27, 31, 1)",
+ "inverseSurface": "rgba(50, 47, 53, 1)",
+ "onBackground": "rgba(29, 27, 32, 1)",
"onError": "rgba(255, 255, 255, 1)",
"onErrorContainer": "rgba(65, 14, 11, 1)",
"onPrimary": "rgba(255, 255, 255, 1)",
"onPrimaryContainer": "rgba(33, 0, 93, 1)",
+ "onPrimaryFixed": "rgba(33, 0, 93, 1)",
+ "onPrimaryFixedVariant": "rgba(79, 55, 139, 1)",
"onSecondary": "rgba(255, 255, 255, 1)",
"onSecondaryContainer": "rgba(29, 25, 43, 1)",
- "onSurface": "rgba(28, 27, 31, 1)",
- "onSurfaceDisabled": "rgba(28, 27, 31, 0.38)",
+ "onSecondaryFixed": "rgba(29, 25, 43, 1)",
+ "onSecondaryFixedVariant": "rgba(74, 68, 88, 1)",
+ "onSurface": "rgba(29, 27, 32, 1)",
"onSurfaceVariant": "rgba(73, 69, 79, 1)",
"onTertiary": "rgba(255, 255, 255, 1)",
"onTertiaryContainer": "rgba(49, 17, 29, 1)",
+ "onTertiaryFixed": "rgba(49, 17, 29, 1)",
+ "onTertiaryFixedVariant": "rgba(99, 59, 72, 1)",
"outline": "rgba(121, 116, 126, 1)",
"outlineVariant": "rgba(202, 196, 208, 1)",
"primary": "rgba(103, 80, 164, 1)",
"primaryContainer": "rgba(234, 221, 255, 1)",
+ "primaryFixed": "rgba(234, 221, 255, 1)",
+ "primaryFixedDim": "rgba(208, 188, 255, 1)",
"scrim": "rgba(0, 0, 0, 1)",
"secondary": "rgba(98, 91, 113, 1)",
"secondaryContainer": "rgba(232, 222, 248, 1)",
+ "secondaryFixed": "rgba(232, 222, 248, 1)",
+ "secondaryFixedDim": "rgba(204, 194, 220, 1)",
"shadow": "rgba(0, 0, 0, 1)",
- "surface": "rgba(255, 251, 254, 1)",
- "surfaceDisabled": "rgba(28, 27, 31, 0.12)",
+ "stateLayerPressed": "rgba(29, 27, 32, 0.1)",
+ "surface": "rgba(254, 247, 255, 1)",
+ "surfaceBright": "rgba(254, 247, 255, 1)",
+ "surfaceContainer": "rgba(243, 237, 247, 1)",
+ "surfaceContainerHigh": "rgba(236, 230, 240, 1)",
+ "surfaceContainerHighest": "rgba(230, 224, 233, 1)",
+ "surfaceContainerLow": "rgba(247, 242, 250, 1)",
+ "surfaceContainerLowest": "rgba(255, 255, 255, 1)",
+ "surfaceDim": "rgba(222, 216, 225, 1)",
"surfaceVariant": "rgba(231, 224, 236, 1)",
"tertiary": "rgba(125, 82, 96, 1)",
"tertiaryContainer": "rgba(255, 216, 228, 1)",
+ "tertiaryFixed": "rgba(255, 216, 228, 1)",
+ "tertiaryFixedDim": "rgba(239, 184, 200, 1)",
},
"dark": false,
"fonts": {
@@ -1356,7 +1407,7 @@ exports[`renders list section without subheader 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -1369,7 +1420,7 @@ exports[`renders list section without subheader 1`] = `
"fontSize": 16,
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
},
undefined,
],
@@ -1509,7 +1560,7 @@ exports[`renders list section without subheader 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontWeight": "400",
"letterSpacing": 0,
@@ -1522,7 +1573,7 @@ exports[`renders list section without subheader 1`] = `
"fontSize": 16,
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
},
undefined,
],
diff --git a/src/components/__tests__/__snapshots__/Menu.test.tsx.snap b/src/components/__tests__/__snapshots__/Menu.test.tsx.snap
index fc3ac61473..2a09d12a10 100644
--- a/src/components/__tests__/__snapshots__/Menu.test.tsx.snap
+++ b/src/components/__tests__/__snapshots__/Menu.test.tsx.snap
@@ -36,7 +36,7 @@ exports[`renders menu with content styles 1`] = `
style={
{
"backgroundColor": "transparent",
- "borderColor": "rgba(121, 116, 126, 1)",
+ "borderColor": "rgba(202, 196, 208, 1)",
"borderRadius": 20,
"borderStyle": "solid",
"borderWidth": 1,
@@ -104,6 +104,9 @@ exports[`renders menu with content styles 1`] = `
"flexDirection": "row",
"justifyContent": "center",
},
+ {
+ "opacity": 1,
+ },
undefined,
]
}
@@ -117,7 +120,7 @@ exports[`renders menu with content styles 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -134,7 +137,6 @@ exports[`renders menu with content styles 1`] = `
"marginVertical": 9,
"textAlign": "center",
},
- false,
{
"marginHorizontal": 24,
"marginVertical": 10,
@@ -260,7 +262,7 @@ exports[`renders menu with content styles 1`] = `
collapsable={false}
style={
{
- "backgroundColor": "rgb(243, 237, 246)",
+ "backgroundColor": "rgba(243, 237, 247, 1)",
"borderRadius": 4,
"borderTopLeftRadius": 0,
"borderTopRightRadius": 0,
@@ -289,7 +291,7 @@ exports[`renders menu with content styles 1`] = `
pointerEvents="box-none"
style={
{
- "backgroundColor": "rgb(243, 237, 246)",
+ "backgroundColor": "rgba(243, 237, 247, 1)",
"borderRadius": 4,
"borderTopLeftRadius": 0,
"borderTopRightRadius": 0,
@@ -363,6 +365,9 @@ exports[`renders menu with content styles 1`] = `
{
"flexDirection": "row",
},
+ {
+ "opacity": 1,
+ },
undefined,
]
}
@@ -371,7 +376,6 @@ exports[`renders menu with content styles 1`] = `
pointerEvents="none"
style={
[
- false,
{
"justifyContent": "center",
},
@@ -396,7 +400,7 @@ exports[`renders menu with content styles 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -408,9 +412,8 @@ exports[`renders menu with content styles 1`] = `
"lineHeight": 24,
},
[
- false,
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
@@ -486,6 +489,9 @@ exports[`renders menu with content styles 1`] = `
{
"flexDirection": "row",
},
+ {
+ "opacity": 1,
+ },
undefined,
]
}
@@ -494,7 +500,6 @@ exports[`renders menu with content styles 1`] = `
pointerEvents="none"
style={
[
- false,
{
"justifyContent": "center",
},
@@ -519,7 +524,7 @@ exports[`renders menu with content styles 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -531,9 +536,8 @@ exports[`renders menu with content styles 1`] = `
"lineHeight": 24,
},
[
- false,
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
@@ -595,7 +599,7 @@ exports[`renders not visible menu 1`] = `
style={
{
"backgroundColor": "transparent",
- "borderColor": "rgba(121, 116, 126, 1)",
+ "borderColor": "rgba(202, 196, 208, 1)",
"borderRadius": 20,
"borderStyle": "solid",
"borderWidth": 1,
@@ -663,6 +667,9 @@ exports[`renders not visible menu 1`] = `
"flexDirection": "row",
"justifyContent": "center",
},
+ {
+ "opacity": 1,
+ },
undefined,
]
}
@@ -676,7 +683,7 @@ exports[`renders not visible menu 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -693,7 +700,6 @@ exports[`renders not visible menu 1`] = `
"marginVertical": 9,
"textAlign": "center",
},
- false,
{
"marginHorizontal": 24,
"marginVertical": 10,
@@ -761,7 +767,7 @@ exports[`renders visible menu 1`] = `
style={
{
"backgroundColor": "transparent",
- "borderColor": "rgba(121, 116, 126, 1)",
+ "borderColor": "rgba(202, 196, 208, 1)",
"borderRadius": 20,
"borderStyle": "solid",
"borderWidth": 1,
@@ -829,6 +835,9 @@ exports[`renders visible menu 1`] = `
"flexDirection": "row",
"justifyContent": "center",
},
+ {
+ "opacity": 1,
+ },
undefined,
]
}
@@ -842,7 +851,7 @@ exports[`renders visible menu 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -859,7 +868,6 @@ exports[`renders visible menu 1`] = `
"marginVertical": 9,
"textAlign": "center",
},
- false,
{
"marginHorizontal": 24,
"marginVertical": 10,
@@ -985,7 +993,7 @@ exports[`renders visible menu 1`] = `
collapsable={false}
style={
{
- "backgroundColor": "rgb(243, 237, 246)",
+ "backgroundColor": "rgba(243, 237, 247, 1)",
"borderRadius": 4,
"opacity": 0,
"shadowColor": "#000",
@@ -1012,7 +1020,7 @@ exports[`renders visible menu 1`] = `
pointerEvents="box-none"
style={
{
- "backgroundColor": "rgb(243, 237, 246)",
+ "backgroundColor": "rgba(243, 237, 247, 1)",
"borderRadius": 4,
"flex": undefined,
"paddingVertical": 8,
@@ -1084,6 +1092,9 @@ exports[`renders visible menu 1`] = `
{
"flexDirection": "row",
},
+ {
+ "opacity": 1,
+ },
undefined,
]
}
@@ -1092,7 +1103,6 @@ exports[`renders visible menu 1`] = `
pointerEvents="none"
style={
[
- false,
{
"justifyContent": "center",
},
@@ -1117,7 +1127,7 @@ exports[`renders visible menu 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -1129,9 +1139,8 @@ exports[`renders visible menu 1`] = `
"lineHeight": 24,
},
[
- false,
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
@@ -1207,6 +1216,9 @@ exports[`renders visible menu 1`] = `
{
"flexDirection": "row",
},
+ {
+ "opacity": 1,
+ },
undefined,
]
}
@@ -1215,7 +1227,6 @@ exports[`renders visible menu 1`] = `
pointerEvents="none"
style={
[
- false,
{
"justifyContent": "center",
},
@@ -1240,7 +1251,7 @@ exports[`renders visible menu 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -1252,9 +1263,8 @@ exports[`renders visible menu 1`] = `
"lineHeight": 24,
},
[
- false,
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
diff --git a/src/components/__tests__/__snapshots__/MenuItem.test.tsx.snap b/src/components/__tests__/__snapshots__/MenuItem.test.tsx.snap
index e16c6134f4..e879443bf9 100644
--- a/src/components/__tests__/__snapshots__/MenuItem.test.tsx.snap
+++ b/src/components/__tests__/__snapshots__/MenuItem.test.tsx.snap
@@ -59,6 +59,9 @@ exports[`Menu Item renders menu item 1`] = `
{
"flexDirection": "row",
},
+ {
+ "opacity": 1,
+ },
undefined,
]
}
@@ -67,7 +70,6 @@ exports[`Menu Item renders menu item 1`] = `
pointerEvents="box-none"
style={
[
- false,
{
"width": 24,
},
@@ -108,7 +110,6 @@ exports[`Menu Item renders menu item 1`] = `
pointerEvents="none"
style={
[
- false,
{
"justifyContent": "center",
},
@@ -133,7 +134,7 @@ exports[`Menu Item renders menu item 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -145,9 +146,8 @@ exports[`Menu Item renders menu item 1`] = `
"lineHeight": 24,
},
[
- false,
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
@@ -223,6 +223,9 @@ exports[`Menu Item renders menu item 1`] = `
{
"flexDirection": "row",
},
+ {
+ "opacity": 1,
+ },
undefined,
]
}
@@ -231,7 +234,6 @@ exports[`Menu Item renders menu item 1`] = `
pointerEvents="box-none"
style={
[
- false,
{
"width": 24,
},
@@ -272,7 +274,6 @@ exports[`Menu Item renders menu item 1`] = `
pointerEvents="none"
style={
[
- false,
{
"justifyContent": "center",
},
@@ -297,7 +298,7 @@ exports[`Menu Item renders menu item 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -309,9 +310,8 @@ exports[`Menu Item renders menu item 1`] = `
"lineHeight": 24,
},
[
- false,
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
@@ -387,6 +387,9 @@ exports[`Menu Item renders menu item 1`] = `
{
"flexDirection": "row",
},
+ {
+ "opacity": 0.38,
+ },
undefined,
]
}
@@ -395,7 +398,6 @@ exports[`Menu Item renders menu item 1`] = `
pointerEvents="box-none"
style={
[
- false,
{
"width": 24,
},
@@ -410,7 +412,7 @@ exports[`Menu Item renders menu item 1`] = `
style={
[
{
- "color": "rgba(28, 27, 31, 0.38)",
+ "color": "rgba(73, 69, 79, 1)",
"fontSize": 24,
},
[
@@ -436,7 +438,6 @@ exports[`Menu Item renders menu item 1`] = `
pointerEvents="none"
style={
[
- false,
{
"justifyContent": "center",
},
@@ -461,7 +462,7 @@ exports[`Menu Item renders menu item 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -473,9 +474,8 @@ exports[`Menu Item renders menu item 1`] = `
"lineHeight": 24,
},
[
- false,
{
- "color": "rgba(28, 27, 31, 0.38)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
@@ -551,6 +551,9 @@ exports[`Menu Item renders menu item 1`] = `
{
"flexDirection": "row",
},
+ {
+ "opacity": 0.38,
+ },
undefined,
]
}
@@ -559,7 +562,6 @@ exports[`Menu Item renders menu item 1`] = `
pointerEvents="box-none"
style={
[
- false,
{
"width": 24,
},
@@ -574,7 +576,7 @@ exports[`Menu Item renders menu item 1`] = `
style={
[
{
- "color": "rgba(28, 27, 31, 0.38)",
+ "color": "rgba(73, 69, 79, 1)",
"fontSize": 24,
},
[
@@ -600,7 +602,6 @@ exports[`Menu Item renders menu item 1`] = `
pointerEvents="none"
style={
[
- false,
{
"justifyContent": "center",
},
@@ -625,7 +626,7 @@ exports[`Menu Item renders menu item 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -637,9 +638,8 @@ exports[`Menu Item renders menu item 1`] = `
"lineHeight": 24,
},
[
- false,
{
- "color": "rgba(28, 27, 31, 0.38)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
@@ -715,6 +715,9 @@ exports[`Menu Item renders menu item 1`] = `
{
"flexDirection": "row",
},
+ {
+ "opacity": 1,
+ },
undefined,
]
}
@@ -723,7 +726,6 @@ exports[`Menu Item renders menu item 1`] = `
pointerEvents="none"
style={
[
- false,
{
"justifyContent": "center",
},
@@ -748,7 +750,7 @@ exports[`Menu Item renders menu item 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -760,9 +762,8 @@ exports[`Menu Item renders menu item 1`] = `
"lineHeight": 24,
},
[
- false,
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
diff --git a/src/components/__tests__/__snapshots__/Searchbar.test.tsx.snap b/src/components/__tests__/__snapshots__/Searchbar.test.tsx.snap
index f30e19f3f8..1954a404ef 100644
--- a/src/components/__tests__/__snapshots__/Searchbar.test.tsx.snap
+++ b/src/components/__tests__/__snapshots__/Searchbar.test.tsx.snap
@@ -5,7 +5,7 @@ exports[`activity indicator snapshot test 1`] = `
collapsable={false}
style={
{
- "backgroundColor": "rgb(238, 232, 244)",
+ "backgroundColor": "rgba(236, 230, 240, 1)",
"borderRadius": 28,
"shadowColor": "#000",
"shadowOffset": {
@@ -23,7 +23,7 @@ exports[`activity indicator snapshot test 1`] = `
style={
{
"alignItems": "center",
- "backgroundColor": "rgb(238, 232, 244)",
+ "backgroundColor": "rgba(236, 230, 240, 1)",
"borderRadius": 28,
"flex": undefined,
"flexDirection": "row",
@@ -63,7 +63,7 @@ exports[`activity indicator snapshot test 1`] = `
style={
{
"backgroundColor": "transparent",
- "borderColor": "rgba(121, 116, 126, 1)",
+ "borderColor": "rgba(202, 196, 208, 1)",
"borderRadius": 20,
"borderWidth": 0,
"elevation": 0,
@@ -140,35 +140,43 @@ exports[`activity indicator snapshot test 1`] = `
}
testID="search-bar-icon"
>
-
+
- magnify
-
+ [
+ {
+ "lineHeight": 24,
+ "transform": [
+ {
+ "scaleX": 1,
+ },
+ ],
+ },
+ {
+ "backgroundColor": "transparent",
+ },
+ ],
+ ]
+ }
+ >
+ magnify
+
+
@@ -176,7 +184,7 @@ exports[`activity indicator snapshot test 1`] = `
accessibilityRole="search"
keyboardAppearance="light"
placeholder=""
- placeholderTextColor="rgba(28, 27, 31, 1)"
+ placeholderTextColor="rgba(29, 27, 32, 1)"
returnKeyType="search"
selectionColor="rgba(103, 80, 164, 1)"
style={
@@ -415,7 +423,7 @@ exports[`renders with placeholder 1`] = `
collapsable={false}
style={
{
- "backgroundColor": "rgb(238, 232, 244)",
+ "backgroundColor": "rgba(236, 230, 240, 1)",
"borderRadius": 28,
"shadowColor": "#000",
"shadowOffset": {
@@ -433,7 +441,7 @@ exports[`renders with placeholder 1`] = `
style={
{
"alignItems": "center",
- "backgroundColor": "rgb(238, 232, 244)",
+ "backgroundColor": "rgba(236, 230, 240, 1)",
"borderRadius": 28,
"flex": undefined,
"flexDirection": "row",
@@ -473,7 +481,7 @@ exports[`renders with placeholder 1`] = `
style={
{
"backgroundColor": "transparent",
- "borderColor": "rgba(121, 116, 126, 1)",
+ "borderColor": "rgba(202, 196, 208, 1)",
"borderRadius": 20,
"borderWidth": 0,
"elevation": 0,
@@ -550,35 +558,43 @@ exports[`renders with placeholder 1`] = `
}
testID="search-bar-icon"
>
-
+
- magnify
-
+ [
+ {
+ "lineHeight": 24,
+ "transform": [
+ {
+ "scaleX": 1,
+ },
+ ],
+ },
+ {
+ "backgroundColor": "transparent",
+ },
+ ],
+ ]
+ }
+ >
+ magnify
+
+
@@ -586,7 +602,7 @@ exports[`renders with placeholder 1`] = `
accessibilityRole="search"
keyboardAppearance="light"
placeholder="Search"
- placeholderTextColor="rgba(28, 27, 31, 1)"
+ placeholderTextColor="rgba(29, 27, 32, 1)"
returnKeyType="search"
selectionColor="rgba(103, 80, 164, 1)"
style={
@@ -657,7 +673,7 @@ exports[`renders with placeholder 1`] = `
style={
{
"backgroundColor": "transparent",
- "borderColor": "rgba(121, 116, 126, 1)",
+ "borderColor": "rgba(202, 196, 208, 1)",
"borderRadius": 20,
"borderWidth": 0,
"elevation": 0,
@@ -734,35 +750,43 @@ exports[`renders with placeholder 1`] = `
}
testID="search-bar-clear-icon"
>
-
+
- close
-
+ [
+ {
+ "lineHeight": 24,
+ "transform": [
+ {
+ "scaleX": 1,
+ },
+ ],
+ },
+ {
+ "backgroundColor": "transparent",
+ },
+ ],
+ ]
+ }
+ >
+ close
+
+
@@ -776,7 +800,7 @@ exports[`renders with text 1`] = `
collapsable={false}
style={
{
- "backgroundColor": "rgb(238, 232, 244)",
+ "backgroundColor": "rgba(236, 230, 240, 1)",
"borderRadius": 28,
"shadowColor": "#000",
"shadowOffset": {
@@ -794,7 +818,7 @@ exports[`renders with text 1`] = `
style={
{
"alignItems": "center",
- "backgroundColor": "rgb(238, 232, 244)",
+ "backgroundColor": "rgba(236, 230, 240, 1)",
"borderRadius": 28,
"flex": undefined,
"flexDirection": "row",
@@ -834,7 +858,7 @@ exports[`renders with text 1`] = `
style={
{
"backgroundColor": "transparent",
- "borderColor": "rgba(121, 116, 126, 1)",
+ "borderColor": "rgba(202, 196, 208, 1)",
"borderRadius": 20,
"borderWidth": 0,
"elevation": 0,
@@ -911,35 +935,43 @@ exports[`renders with text 1`] = `
}
testID="search-bar-icon"
>
-
+
- magnify
-
+ [
+ {
+ "lineHeight": 24,
+ "transform": [
+ {
+ "scaleX": 1,
+ },
+ ],
+ },
+ {
+ "backgroundColor": "transparent",
+ },
+ ],
+ ]
+ }
+ >
+ magnify
+
+
@@ -947,7 +979,7 @@ exports[`renders with text 1`] = `
accessibilityRole="search"
keyboardAppearance="light"
placeholder="Search"
- placeholderTextColor="rgba(28, 27, 31, 1)"
+ placeholderTextColor="rgba(29, 27, 32, 1)"
returnKeyType="search"
selectionColor="rgba(103, 80, 164, 1)"
style={
@@ -1014,7 +1046,7 @@ exports[`renders with text 1`] = `
style={
{
"backgroundColor": "transparent",
- "borderColor": "rgba(121, 116, 126, 1)",
+ "borderColor": "rgba(202, 196, 208, 1)",
"borderRadius": 20,
"borderWidth": 0,
"elevation": 0,
@@ -1091,35 +1123,43 @@ exports[`renders with text 1`] = `
}
testID="search-bar-clear-icon"
>
-
+
- close
-
+ [
+ {
+ "lineHeight": 24,
+ "transform": [
+ {
+ "scaleX": 1,
+ },
+ ],
+ },
+ {
+ "backgroundColor": "transparent",
+ },
+ ],
+ ]
+ }
+ >
+ close
+
+
diff --git a/src/components/__tests__/__snapshots__/SegmentedButton.test.tsx.snap b/src/components/__tests__/__snapshots__/SegmentedButton.test.tsx.snap
index 83f1541397..895061bb52 100644
--- a/src/components/__tests__/__snapshots__/SegmentedButton.test.tsx.snap
+++ b/src/components/__tests__/__snapshots__/SegmentedButton.test.tsx.snap
@@ -91,6 +91,7 @@ exports[`renders segmented button 1`] = `
"paddingVertical": 9,
},
{
+ "opacity": 1,
"paddingVertical": 9,
},
]
@@ -105,7 +106,7 @@ exports[`renders segmented button 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -216,6 +217,7 @@ exports[`renders segmented button 1`] = `
"paddingVertical": 9,
},
{
+ "opacity": 1,
"paddingVertical": 9,
},
]
@@ -230,7 +232,7 @@ exports[`renders segmented button 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -246,7 +248,7 @@ exports[`renders segmented button 1`] = `
"textAlign": "center",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontSize": 14,
"fontWeight": "500",
diff --git a/src/components/__tests__/__snapshots__/Snackbar.test.tsx.snap b/src/components/__tests__/__snapshots__/Snackbar.test.tsx.snap
index 9fdd75d4dc..ce2a9c8637 100644
--- a/src/components/__tests__/__snapshots__/Snackbar.test.tsx.snap
+++ b/src/components/__tests__/__snapshots__/Snackbar.test.tsx.snap
@@ -24,7 +24,7 @@ exports[`renders snackbar with Text as a child 1`] = `
collapsable={false}
style={
{
- "backgroundColor": "rgba(49, 48, 51, 1)",
+ "backgroundColor": "rgba(50, 47, 53, 1)",
"borderRadius": 4,
"margin": 8,
"opacity": 0,
@@ -50,7 +50,7 @@ exports[`renders snackbar with Text as a child 1`] = `
pointerEvents="box-none"
style={
{
- "backgroundColor": "rgba(49, 48, 51, 1)",
+ "backgroundColor": "rgba(50, 47, 53, 1)",
"borderRadius": 4,
"flex": undefined,
"flexDirection": "row",
@@ -112,7 +112,7 @@ exports[`renders snackbar with View & Text as a child 1`] = `
collapsable={false}
style={
{
- "backgroundColor": "rgba(49, 48, 51, 1)",
+ "backgroundColor": "rgba(50, 47, 53, 1)",
"borderRadius": 4,
"margin": 8,
"opacity": 0,
@@ -138,7 +138,7 @@ exports[`renders snackbar with View & Text as a child 1`] = `
pointerEvents="box-none"
style={
{
- "backgroundColor": "rgba(49, 48, 51, 1)",
+ "backgroundColor": "rgba(50, 47, 53, 1)",
"borderRadius": 4,
"flex": undefined,
"flexDirection": "row",
@@ -226,7 +226,7 @@ exports[`renders snackbar with action button 1`] = `
collapsable={false}
style={
{
- "backgroundColor": "rgba(49, 48, 51, 1)",
+ "backgroundColor": "rgba(50, 47, 53, 1)",
"borderRadius": 4,
"margin": 8,
"opacity": 0,
@@ -252,7 +252,7 @@ exports[`renders snackbar with action button 1`] = `
pointerEvents="box-none"
style={
{
- "backgroundColor": "rgba(49, 48, 51, 1)",
+ "backgroundColor": "rgba(50, 47, 53, 1)",
"borderRadius": 4,
"flex": undefined,
"flexDirection": "row",
@@ -276,7 +276,7 @@ exports[`renders snackbar with action button 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -294,7 +294,7 @@ exports[`renders snackbar with action button 1`] = `
"marginVertical": 14,
},
{
- "color": "rgba(244, 239, 244, 1)",
+ "color": "rgba(245, 239, 247, 1)",
},
],
],
@@ -410,6 +410,9 @@ exports[`renders snackbar with action button 1`] = `
"flexDirection": "row",
"justifyContent": "center",
},
+ {
+ "opacity": 1,
+ },
undefined,
]
}
@@ -423,7 +426,7 @@ exports[`renders snackbar with action button 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -440,7 +443,6 @@ exports[`renders snackbar with action button 1`] = `
"marginVertical": 9,
"textAlign": "center",
},
- false,
{
"marginHorizontal": 12,
},
@@ -495,7 +497,7 @@ exports[`renders snackbar with content 1`] = `
collapsable={false}
style={
{
- "backgroundColor": "rgba(49, 48, 51, 1)",
+ "backgroundColor": "rgba(50, 47, 53, 1)",
"borderRadius": 4,
"margin": 8,
"opacity": 0,
@@ -521,7 +523,7 @@ exports[`renders snackbar with content 1`] = `
pointerEvents="box-none"
style={
{
- "backgroundColor": "rgba(49, 48, 51, 1)",
+ "backgroundColor": "rgba(50, 47, 53, 1)",
"borderRadius": 4,
"flex": undefined,
"flexDirection": "row",
@@ -545,7 +547,7 @@ exports[`renders snackbar with content 1`] = `
"textAlign": "left",
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"writingDirection": "ltr",
},
[
@@ -563,7 +565,7 @@ exports[`renders snackbar with content 1`] = `
"marginVertical": 14,
},
{
- "color": "rgba(244, 239, 244, 1)",
+ "color": "rgba(245, 239, 247, 1)",
},
],
],
diff --git a/src/components/__tests__/__snapshots__/TextField.test.tsx.snap b/src/components/__tests__/__snapshots__/TextField.test.tsx.snap
new file mode 100644
index 0000000000..236902c2ee
--- /dev/null
+++ b/src/components/__tests__/__snapshots__/TextField.test.tsx.snap
@@ -0,0 +1,328 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`renders filled TextField with label and value 1`] = `
+
+
+
+
+
+
+ Email
+
+
+
+
+
+
+
+`;
+
+exports[`renders outlined TextField with label and value 1`] = `
+
+
+
+
+
+ Password
+
+
+
+
+
+
+
+`;
diff --git a/src/components/__tests__/__snapshots__/TextInput.test.tsx.snap b/src/components/__tests__/__snapshots__/TextInput.test.tsx.snap
index 76ad8d4e54..0a7334fa12 100644
--- a/src/components/__tests__/__snapshots__/TextInput.test.tsx.snap
+++ b/src/components/__tests__/__snapshots__/TextInput.test.tsx.snap
@@ -21,6 +21,7 @@ exports[`call onPress when affix adornment pressed 1`] = `
"bottom": 0,
"height": 1,
"left": 0,
+ "opacity": 1,
"position": "absolute",
"right": 0,
"transform": [
@@ -65,6 +66,9 @@ exports[`call onPress when affix adornment pressed 1`] = `
{
"zIndex": 3,
},
+ {
+ "opacity": 1,
+ },
]
}
>
@@ -199,13 +203,14 @@ exports[`call onPress when affix adornment pressed 1`] = `
"paddingTop": 24,
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": undefined,
"letterSpacing": 0.15,
"lineHeight": undefined,
"minWidth": 65,
+ "opacity": 1,
"paddingLeft": 16,
"paddingRight": 16,
"textAlign": "left",
@@ -278,6 +283,7 @@ exports[`call onPress when affix adornment pressed 1`] = `
[
{
"color": "rgba(73, 69, 79, 1)",
+ "opacity": 1,
},
{
"fontFamily": "System",
@@ -319,6 +325,7 @@ exports[`correctly applies a component as the text label 1`] = `
"bottom": 0,
"height": 1,
"left": 0,
+ "opacity": 1,
"position": "absolute",
"right": 0,
"transform": [
@@ -363,6 +370,9 @@ exports[`correctly applies a component as the text label 1`] = `
{
"zIndex": 3,
},
+ {
+ "opacity": 1,
+ },
]
}
>
@@ -513,13 +523,14 @@ exports[`correctly applies a component as the text label 1`] = `
"paddingTop": 24,
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": undefined,
"letterSpacing": 0.15,
"lineHeight": undefined,
"minWidth": 65,
+ "opacity": 1,
"paddingLeft": 16,
"paddingRight": 16,
"textAlign": "left",
@@ -561,6 +572,7 @@ exports[`correctly applies cursorColor prop 1`] = `
"bottom": 0,
"height": 1,
"left": 0,
+ "opacity": 1,
"position": "absolute",
"right": 0,
"transform": [
@@ -605,6 +617,9 @@ exports[`correctly applies cursorColor prop 1`] = `
{
"zIndex": 3,
},
+ {
+ "opacity": 1,
+ },
]
}
>
@@ -739,13 +754,14 @@ exports[`correctly applies cursorColor prop 1`] = `
"paddingTop": 24,
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": undefined,
"letterSpacing": 0.15,
"lineHeight": undefined,
"minWidth": 65,
+ "opacity": 1,
"paddingLeft": 16,
"paddingRight": 16,
"textAlign": "left",
@@ -787,6 +803,7 @@ exports[`correctly applies default textAlign based on default RTL 1`] = `
"bottom": 0,
"height": 1,
"left": 0,
+ "opacity": 1,
"position": "absolute",
"right": 0,
"transform": [
@@ -831,6 +848,9 @@ exports[`correctly applies default textAlign based on default RTL 1`] = `
{
"zIndex": 3,
},
+ {
+ "opacity": 1,
+ },
]
}
>
@@ -965,13 +985,14 @@ exports[`correctly applies default textAlign based on default RTL 1`] = `
"paddingTop": 24,
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": undefined,
"letterSpacing": 0.15,
"lineHeight": undefined,
"minWidth": 65,
+ "opacity": 1,
"paddingLeft": 16,
"paddingRight": 16,
"textAlign": "left",
@@ -1009,7 +1030,7 @@ exports[`correctly applies height to multiline Outline TextInput 1`] = `
},
false,
{
- "backgroundColor": "rgba(255, 251, 254, 1)",
+ "backgroundColor": "rgba(254, 247, 255, 1)",
"borderColor": "rgba(121, 116, 126, 1)",
"borderRadius": 4,
"borderWidth": 1,
@@ -1050,6 +1071,9 @@ exports[`correctly applies height to multiline Outline TextInput 1`] = `
{
"zIndex": 3,
},
+ {
+ "opacity": 1,
+ },
]
}
>
@@ -1086,7 +1110,7 @@ exports[`correctly applies height to multiline Outline TextInput 1`] = `
numberOfLines={1}
style={
{
- "backgroundColor": "rgba(255, 251, 254, 1)",
+ "backgroundColor": "rgba(254, 247, 255, 1)",
"color": "transparent",
"fontFamily": "System",
"fontSize": 16,
@@ -1225,13 +1249,14 @@ exports[`correctly applies height to multiline Outline TextInput 1`] = `
"paddingTop": 24,
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": undefined,
"letterSpacing": 0.15,
"lineHeight": undefined,
"minWidth": 65,
+ "opacity": 1,
"paddingHorizontal": 16,
"textAlign": "left",
"textAlignVertical": "top",
@@ -1272,6 +1297,7 @@ exports[`correctly applies paddingLeft from contentStyleProp 1`] = `
"bottom": 0,
"height": 1,
"left": 0,
+ "opacity": 1,
"position": "absolute",
"right": 0,
"transform": [
@@ -1316,6 +1342,9 @@ exports[`correctly applies paddingLeft from contentStyleProp 1`] = `
{
"zIndex": 3,
},
+ {
+ "opacity": 1,
+ },
]
}
>
@@ -1450,13 +1479,14 @@ exports[`correctly applies paddingLeft from contentStyleProp 1`] = `
"paddingTop": 24,
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": undefined,
"letterSpacing": 0.15,
"lineHeight": undefined,
"minWidth": 65,
+ "opacity": 1,
"paddingLeft": 16,
"paddingRight": 16,
"textAlign": "left",
@@ -1500,6 +1530,7 @@ exports[`correctly applies textAlign center 1`] = `
"bottom": 0,
"height": 1,
"left": 0,
+ "opacity": 1,
"position": "absolute",
"right": 0,
"transform": [
@@ -1544,6 +1575,9 @@ exports[`correctly applies textAlign center 1`] = `
{
"zIndex": 3,
},
+ {
+ "opacity": 1,
+ },
]
}
>
@@ -1678,13 +1712,14 @@ exports[`correctly applies textAlign center 1`] = `
"paddingTop": 24,
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": undefined,
"letterSpacing": 0.15,
"lineHeight": undefined,
"minWidth": 65,
+ "opacity": 1,
"paddingLeft": 16,
"paddingRight": 16,
"textAlign": "center",
@@ -1726,6 +1761,7 @@ exports[`correctly renders left-side affix adornment, and right-side icon adornm
"bottom": 0,
"height": 1,
"left": 0,
+ "opacity": 1,
"position": "absolute",
"right": 0,
"transform": [
@@ -1770,6 +1806,9 @@ exports[`correctly renders left-side affix adornment, and right-side icon adornm
{
"zIndex": 3,
},
+ {
+ "opacity": 1,
+ },
]
}
>
@@ -1904,13 +1943,14 @@ exports[`correctly renders left-side affix adornment, and right-side icon adornm
"paddingTop": 24,
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": undefined,
"letterSpacing": 0.15,
"lineHeight": undefined,
"minWidth": 65,
+ "opacity": 1,
"paddingLeft": 16,
"paddingRight": 56,
"textAlign": "left",
@@ -1952,6 +1992,7 @@ exports[`correctly renders left-side affix adornment, and right-side icon adornm
[
{
"color": "rgba(73, 69, 79, 1)",
+ "opacity": 1,
},
{
"fontFamily": "System",
@@ -1980,6 +2021,9 @@ exports[`correctly renders left-side affix adornment, and right-side icon adornm
"position": "absolute",
"width": 24,
},
+ {
+ "opacity": 1,
+ },
{
"right": 16,
"top": 16,
@@ -2012,7 +2056,7 @@ exports[`correctly renders left-side affix adornment, and right-side icon adornm
style={
{
"backgroundColor": "transparent",
- "borderColor": "rgba(121, 116, 126, 1)",
+ "borderColor": "rgba(202, 196, 208, 1)",
"borderRadius": 20,
"borderWidth": 0,
"elevation": 0,
@@ -2088,35 +2132,43 @@ exports[`correctly renders left-side affix adornment, and right-side icon adornm
}
testID="right-icon-adornment"
>
-
+
- heart
-
+ [
+ {
+ "lineHeight": 24,
+ "transform": [
+ {
+ "scaleX": 1,
+ },
+ ],
+ },
+ {
+ "backgroundColor": "transparent",
+ },
+ ],
+ ]
+ }
+ >
+ heart
+
+
@@ -2145,6 +2197,7 @@ exports[`correctly renders left-side icon adornment, and right-side affix adornm
"bottom": 0,
"height": 1,
"left": 0,
+ "opacity": 1,
"position": "absolute",
"right": 0,
"transform": [
@@ -2189,6 +2242,9 @@ exports[`correctly renders left-side icon adornment, and right-side affix adornm
{
"zIndex": 3,
},
+ {
+ "opacity": 1,
+ },
]
}
>
@@ -2323,13 +2379,14 @@ exports[`correctly renders left-side icon adornment, and right-side affix adornm
"paddingTop": 24,
},
{
- "color": "rgba(28, 27, 31, 1)",
+ "color": "rgba(29, 27, 32, 1)",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": undefined,
"letterSpacing": 0.15,
"lineHeight": undefined,
"minWidth": 65,
+ "opacity": 1,
"paddingLeft": 56,
"paddingRight": 56,
"textAlign": "left",
@@ -2360,6 +2417,9 @@ exports[`correctly renders left-side icon adornment, and right-side affix adornm
"position": "absolute",
"width": 24,
},
+ {
+ "opacity": 1,
+ },
{
"left": 16,
"top": 16,
@@ -2392,7 +2452,7 @@ exports[`correctly renders left-side icon adornment, and right-side affix adornm
style={
{
"backgroundColor": "transparent",
- "borderColor": "rgba(121, 116, 126, 1)",
+ "borderColor": "rgba(202, 196, 208, 1)",
"borderRadius": 20,
"borderWidth": 0,
"elevation": 0,
@@ -2468,35 +2528,43 @@ exports[`correctly renders left-side icon adornment, and right-side affix adornm
}
testID="left-icon-adornment"
>
-
+
- heart
-
+ [
+ {
+ "lineHeight": 24,
+ "transform": [
+ {
+ "scaleX": 1,
+ },
+ ],
+ },
+ {
+ "backgroundColor": "transparent",
+ },
+ ],
+ ]
+ }
+ >
+ heart
+
+
@@ -2522,6 +2590,7 @@ exports[`correctly renders left-side icon adornment, and right-side affix adornm
[
{
"color": "rgba(73, 69, 79, 1)",
+ "opacity": 1,
},
{
"fontFamily": "System",
diff --git a/src/components/__tests__/__snapshots__/ToggleButton.test.tsx.snap b/src/components/__tests__/__snapshots__/ToggleButton.test.tsx.snap
index 456c0402fa..a8feb453e3 100644
--- a/src/components/__tests__/__snapshots__/ToggleButton.test.tsx.snap
+++ b/src/components/__tests__/__snapshots__/ToggleButton.test.tsx.snap
@@ -5,7 +5,7 @@ exports[`renders disabled toggle button 1`] = `
collapsable={false}
style={
{
- "backgroundColor": "rgba(29, 25, 43, 0.12)",
+ "backgroundColor": "rgba(230, 224, 233, 1)",
"borderRadius": 4,
"height": 42,
"margin": 0,
@@ -25,7 +25,7 @@ exports[`renders disabled toggle button 1`] = `
collapsable={false}
style={
{
- "backgroundColor": "rgba(29, 25, 43, 0.12)",
+ "backgroundColor": "rgba(230, 224, 233, 1)",
"borderColor": "rgba(121, 116, 126, 1)",
"borderRadius": 4,
"borderWidth": 0,
@@ -105,35 +105,43 @@ exports[`renders disabled toggle button 1`] = `
}
testID="icon-button"
>
-
+
- heart
-
+ [
+ {
+ "lineHeight": 24,
+ "transform": [
+ {
+ "scaleX": 1,
+ },
+ ],
+ },
+ {
+ "backgroundColor": "transparent",
+ },
+ ],
+ ]
+ }
+ >
+ heart
+
+
@@ -144,7 +152,7 @@ exports[`renders toggle button 1`] = `
collapsable={false}
style={
{
- "backgroundColor": "rgba(29, 25, 43, 0.12)",
+ "backgroundColor": "rgba(230, 224, 233, 1)",
"borderRadius": 4,
"height": 42,
"margin": 0,
@@ -164,7 +172,7 @@ exports[`renders toggle button 1`] = `
collapsable={false}
style={
{
- "backgroundColor": "rgba(29, 25, 43, 0.12)",
+ "backgroundColor": "rgba(230, 224, 233, 1)",
"borderColor": "rgba(121, 116, 126, 1)",
"borderRadius": 4,
"borderWidth": 0,
@@ -239,35 +247,43 @@ exports[`renders toggle button 1`] = `
}
testID="icon-button"
>
-
+
- heart
-
+ [
+ {
+ "lineHeight": 24,
+ "transform": [
+ {
+ "scaleX": 1,
+ },
+ ],
+ },
+ {
+ "backgroundColor": "transparent",
+ },
+ ],
+ ]
+ }
+ >
+ heart
+
+
@@ -278,7 +294,7 @@ exports[`renders unchecked toggle button 1`] = `
collapsable={false}
style={
{
- "backgroundColor": "transparent",
+ "backgroundColor": "rgba(243, 237, 247, 1)",
"borderRadius": 4,
"height": 42,
"margin": 0,
@@ -298,7 +314,7 @@ exports[`renders unchecked toggle button 1`] = `
collapsable={false}
style={
{
- "backgroundColor": "transparent",
+ "backgroundColor": "rgba(243, 237, 247, 1)",
"borderColor": "rgba(121, 116, 126, 1)",
"borderRadius": 4,
"borderWidth": 0,
@@ -378,35 +394,43 @@ exports[`renders unchecked toggle button 1`] = `
}
testID="icon-button"
>
-
+
- heart
-
+ [
+ {
+ "lineHeight": 24,
+ "transform": [
+ {
+ "scaleX": 1,
+ },
+ ],
+ },
+ {
+ "backgroundColor": "transparent",
+ },
+ ],
+ ]
+ }
+ >
+ heart
+
+
diff --git a/src/core/PaperProvider.tsx b/src/core/PaperProvider.tsx
index 44fd426ab5..04bc547d34 100644
--- a/src/core/PaperProvider.tsx
+++ b/src/core/PaperProvider.tsx
@@ -8,7 +8,7 @@ import {
import SafeAreaProviderCompat from './SafeAreaProviderCompat';
import { Provider as SettingsProvider, Settings } from './settings';
-import { defaultThemesByVersion, ThemeProvider } from './theming';
+import { defaultThemes, ThemeProvider } from './theming';
import MaterialCommunityIcon from '../components/MaterialCommunityIcon';
import PortalHost from '../components/Portal/PortalHost';
import type { ThemeProp } from '../types';
@@ -21,12 +21,8 @@ export type Props = {
};
const PaperProvider = (props: Props) => {
- const isOnlyVersionInTheme =
- props.theme && Object.keys(props.theme).length === 1 && props.theme.version;
-
const colorSchemeName =
- ((!props.theme || isOnlyVersionInTheme) && Appearance?.getColorScheme()) ||
- 'light';
+ (!props.theme && Appearance?.getColorScheme()) || 'light';
const [reduceMotionEnabled, setReduceMotionEnabled] =
React.useState(false);
@@ -59,13 +55,13 @@ const PaperProvider = (props: Props) => {
React.useEffect(() => {
let appearanceSubscription: NativeEventSubscription | undefined;
- if (!props.theme || isOnlyVersionInTheme) {
+ if (!props.theme) {
appearanceSubscription = Appearance?.addChangeListener(
handleAppearanceChange
) as NativeEventSubscription | undefined;
}
return () => {
- if (!props.theme || isOnlyVersionInTheme) {
+ if (!props.theme) {
if (appearanceSubscription) {
appearanceSubscription.remove();
} else {
@@ -74,17 +70,16 @@ const PaperProvider = (props: Props) => {
}
}
};
- }, [props.theme, isOnlyVersionInTheme]);
+ }, [props.theme]);
const theme = React.useMemo(() => {
- const themeVersion = props.theme?.version || 3;
const scheme = colorScheme === 'dark' ? 'dark' : 'light';
- const defaultThemeBase = defaultThemesByVersion[themeVersion][scheme];
+ const defaultThemeBase = defaultThemes[scheme];
const extendedThemeBase = {
...defaultThemeBase,
...props.theme,
- version: themeVersion,
+ version: 3 as const,
animation: {
...props.theme?.animation,
scale: reduceMotionEnabled ? 0 : 1,
@@ -93,7 +88,7 @@ const PaperProvider = (props: Props) => {
return {
...extendedThemeBase,
- isV3: extendedThemeBase.version === 3,
+ isV3: true as const,
};
}, [colorScheme, props.theme, reduceMotionEnabled]);
diff --git a/src/core/__tests__/PaperProvider.test.tsx b/src/core/__tests__/PaperProvider.test.tsx
index 11c4beff49..28843d4ba7 100644
--- a/src/core/__tests__/PaperProvider.test.tsx
+++ b/src/core/__tests__/PaperProvider.test.tsx
@@ -8,12 +8,7 @@ import {
import { render, act } from '@testing-library/react-native';
-import {
- MD2LightTheme,
- MD2DarkTheme,
- MD3LightTheme,
- MD3DarkTheme,
-} from '../../styles/themes';
+import { MD3LightTheme, MD3DarkTheme } from '../../styles/themes';
import type { ThemeProp } from '../../types';
import PaperProvider from '../PaperProvider';
import { useTheme } from '../theming';
@@ -229,7 +224,6 @@ describe('PaperProvider', () => {
colors: {
...ExtendedLightTheme.colors,
primary: 'tomato',
- accent: 'yellow',
},
} as ThemeProp;
const { getByTestId } = render(createProvider(customTheme));
@@ -237,23 +231,4 @@ describe('PaperProvider', () => {
customTheme
);
});
-
- it.each`
- version | colorScheme | expectedTheme
- ${2} | ${'light'} | ${MD2LightTheme}
- ${2} | ${'dark'} | ${MD2DarkTheme}
- ${3} | ${'light'} | ${MD3LightTheme}
- ${3} | ${'dark'} | ${MD3DarkTheme}
- `(
- 'uses correct theme, $colorScheme mode, version $version',
- async ({ version, colorScheme, expectedTheme }) => {
- mockAppearance();
- (Appearance.getColorScheme as jest.Mock).mockReturnValue(colorScheme);
- const { getByTestId } = render(createProvider({ version }));
-
- expect(getByTestId('provider-child-view').props.theme).toStrictEqual(
- expectedTheme
- );
- }
- );
});
diff --git a/src/core/__tests__/theming.test.tsx b/src/core/__tests__/theming.test.tsx
index 7b069cd482..f9efe7752e 100644
--- a/src/core/__tests__/theming.test.tsx
+++ b/src/core/__tests__/theming.test.tsx
@@ -91,7 +91,7 @@ describe('adaptNavigationTheme', () => {
...NavigationLightTheme.colors,
primary: MD3LightTheme.colors.primary,
background: MD3LightTheme.colors.background,
- card: MD3LightTheme.colors.elevation.level2,
+ card: MD3LightTheme.colors.surfaceContainer,
text: MD3LightTheme.colors.onSurface,
border: MD3LightTheme.colors.outline,
notification: MD3LightTheme.colors.error,
@@ -103,7 +103,7 @@ describe('adaptNavigationTheme', () => {
...NavigationDarkTheme.colors,
primary: MD3DarkTheme.colors.primary,
background: MD3DarkTheme.colors.background,
- card: MD3DarkTheme.colors.elevation.level2,
+ card: MD3DarkTheme.colors.surfaceContainer,
text: MD3DarkTheme.colors.onSurface,
border: MD3DarkTheme.colors.outline,
notification: MD3DarkTheme.colors.error,
@@ -125,7 +125,7 @@ describe('adaptNavigationTheme', () => {
...NavigationLightTheme.colors,
primary: colors.primary,
background: colors.background,
- card: colors.elevation.level2,
+ card: colors.surfaceContainer,
text: colors.onSurface,
border: colors.outline,
notification: colors.error,
@@ -146,7 +146,7 @@ describe('adaptNavigationTheme', () => {
...NavigationDarkTheme.colors,
primary: colors.primary,
background: colors.background,
- card: colors.elevation.level2,
+ card: colors.surfaceContainer,
text: colors.onSurface,
border: colors.outline,
notification: colors.error,
@@ -167,7 +167,7 @@ describe('adaptNavigationTheme', () => {
...NavigationCustomLightTheme.colors,
primary: colors.primary,
background: colors.background,
- card: colors.elevation.level2,
+ card: colors.surfaceContainer,
text: colors.onSurface,
border: colors.outline,
notification: colors.error,
@@ -191,7 +191,7 @@ describe('adaptNavigationTheme', () => {
...NavigationLightTheme.colors,
primary: colors.primary,
background: colors.background,
- card: colors.elevation.level2,
+ card: colors.surfaceContainer,
text: colors.onSurface,
border: colors.outline,
notification: colors.error,
@@ -213,7 +213,7 @@ describe('adaptNavigationTheme', () => {
...NavigationDarkTheme.colors,
primary: colors.primary,
background: colors.background,
- card: colors.elevation.level2,
+ card: colors.surfaceContainer,
text: colors.onSurface,
border: colors.outline,
notification: colors.error,
@@ -232,7 +232,7 @@ describe('adaptNavigationTheme', () => {
...NavigationThemeWithFonts.colors,
primary: MD3LightTheme.colors.primary,
background: MD3LightTheme.colors.background,
- card: MD3LightTheme.colors.elevation.level2,
+ card: MD3LightTheme.colors.surfaceContainer,
text: MD3LightTheme.colors.onSurface,
border: MD3LightTheme.colors.outline,
notification: MD3LightTheme.colors.error,
diff --git a/src/core/theming.tsx b/src/core/theming.tsx
index 44223f032a..04649515c6 100644
--- a/src/core/theming.tsx
+++ b/src/core/theming.tsx
@@ -1,20 +1,9 @@
import type { ComponentType } from 'react';
import { $DeepPartial, createTheming } from '@callstack/react-theme-provider';
-import color from 'color';
-
-import {
- MD2DarkTheme,
- MD2LightTheme,
- MD3DarkTheme,
- MD3LightTheme,
-} from '../styles/themes';
-import type {
- InternalTheme,
- MD3Theme,
- MD3AndroidColors,
- NavigationTheme,
-} from '../types';
+
+import { MD3DarkTheme, MD3LightTheme } from '../styles/themes';
+import type { InternalTheme, MD3Theme, NavigationTheme } from '../types';
export const DefaultTheme = MD3LightTheme;
@@ -36,30 +25,17 @@ export const withInternalTheme = (
WrappedComponent: ComponentType & C
) => withTheme(WrappedComponent);
-export const defaultThemesByVersion = {
- 2: {
- light: MD2LightTheme,
- dark: MD2DarkTheme,
- },
- 3: {
- light: MD3LightTheme,
- dark: MD3DarkTheme,
- },
+export const defaultThemes = {
+ light: MD3LightTheme,
+ dark: MD3DarkTheme,
};
-export const getTheme = <
- Scheme extends boolean = false,
- IsVersion3 extends boolean = true
->(
- isDark: Scheme = false as Scheme,
- isV3: IsVersion3 = true as IsVersion3
-): (typeof defaultThemesByVersion)[IsVersion3 extends true
- ? 3
- : 2][Scheme extends true ? 'dark' : 'light'] => {
- const themeVersion = isV3 ? 3 : 2;
+export const getTheme = (
+ isDark: Scheme = false as Scheme
+): (typeof defaultThemes)[Scheme extends true ? 'dark' : 'light'] => {
const scheme = isDark ? 'dark' : 'light';
- return defaultThemesByVersion[themeVersion][scheme];
+ return defaultThemes[scheme];
};
// eslint-disable-next-line no-redeclare
@@ -123,7 +99,7 @@ const getAdaptedTheme = (
...theme.colors,
primary: materialTheme.colors.primary,
background: materialTheme.colors.background,
- card: materialTheme.colors.elevation.level2,
+ card: materialTheme.colors.surfaceContainer,
text: materialTheme.colors.onSurface,
border: materialTheme.colors.outline,
notification: materialTheme.colors.error,
@@ -160,19 +136,3 @@ const getAdaptedTheme = (
return base;
};
-
-export const getDynamicThemeElevations = (scheme: MD3AndroidColors) => {
- const elevationValues = ['transparent', 0.05, 0.08, 0.11, 0.12, 0.14];
- return elevationValues.reduce((elevations, elevationValue, index) => {
- return {
- ...elevations,
- [`level${index}`]:
- index === 0
- ? elevationValue
- : color(scheme.surface)
- .mix(color(scheme.primary), elevationValue as number)
- .rgb()
- .string(),
- };
- }, {});
-};
diff --git a/src/index.tsx b/src/index.tsx
index 1b20528787..f2903fa894 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -19,9 +19,7 @@ export { default as configureFonts } from './styles/fonts';
import * as Avatar from './components/Avatar/Avatar';
import * as Drawer from './components/Drawer/Drawer';
import * as List from './components/List/List';
-import * as MD2Colors from './styles/themes/v2/colors';
-export { MD2Colors };
export { Avatar, List, Drawer };
export * from './components/FAB/AnimatedFAB';
@@ -53,6 +51,7 @@ export { default as Surface } from './components/Surface';
export { default as Switch } from './components/Switch/Switch';
export { default as Appbar } from './components/Appbar';
export { default as TouchableRipple } from './components/TouchableRipple/TouchableRipple';
+export { default as TextField } from './components/TextField/TextField';
export { default as TextInput } from './components/TextInput/TextInput';
export { default as ToggleButton } from './components/ToggleButton';
export { default as SegmentedButtons } from './components/SegmentedButtons/SegmentedButtons';
@@ -137,6 +136,11 @@ export type { Props as SearchbarProps } from './components/Searchbar';
export type { Props as SnackbarProps } from './components/Snackbar';
export type { Props as SurfaceProps } from './components/Surface';
export type { Props as SwitchProps } from './components/Switch/Switch';
+export type {
+ TextFieldProps,
+ TextFieldAccessoryProps,
+ TextFieldVariant,
+} from './components/TextField/TextField';
export type { Props as TextInputProps } from './components/TextInput/TextInput';
export type { Props as TextInputAffixProps } from './components/TextInput/Adornment/TextInputAffix';
export type { Props as TextInputIconProps } from './components/TextInput/Adornment/TextInputIcon';
@@ -161,7 +165,6 @@ export type {
} from './react-navigation';
export type {
- MD2Theme,
MD3Theme,
ThemeBase,
MD3Elevation,
diff --git a/src/styles/__tests__/fonts.test.js b/src/styles/__tests__/fonts.test.js
index fb8dce5ba5..6deed087a4 100644
--- a/src/styles/__tests__/fonts.test.js
+++ b/src/styles/__tests__/fonts.test.js
@@ -1,10 +1,3 @@
-const customFont = {
- custom: {
- fontFamily: 'sans-serif',
- fontWeight: 'bold',
- },
-};
-
const customFontV3 = {
displayLarge: {
fontFamily: 'NotoSans',
@@ -131,18 +124,16 @@ const mockPlatform = (OS) => {
const loadFonts = () => {
let configureFonts;
- let fontConfig;
let typescale;
jest.isolateModules(() => {
const fonts = require('../fonts');
configureFonts = fonts.default;
- fontConfig = fonts.fontConfig;
typescale = require('../themes/v3/tokens').typescale;
});
- return { configureFonts, fontConfig, typescale };
+ return { configureFonts, typescale };
};
describe('configureFonts', () => {
@@ -150,66 +141,6 @@ describe('configureFonts', () => {
jest.dontMock('react-native');
});
- it('adds custom fonts to the iOS config', () => {
- mockPlatform('ios');
- const { configureFonts, fontConfig } = loadFonts();
-
- expect(
- configureFonts({
- config: {
- ios: {
- ...fontConfig.ios,
- customFont,
- },
- },
- isV3: false,
- })
- ).toEqual({
- ...fontConfig.ios,
- customFont,
- });
- });
-
- it('adds custom fonts to the Android config', () => {
- mockPlatform('android');
- const { configureFonts, fontConfig } = loadFonts();
-
- expect(
- configureFonts({
- config: {
- android: {
- ...fontConfig.android,
- customFont,
- },
- },
- isV3: false,
- })
- ).toEqual({
- ...fontConfig.android,
- customFont,
- });
- });
-
- it('adds custom fonts to the Web config', () => {
- mockPlatform('web');
- const { configureFonts, fontConfig } = loadFonts();
-
- expect(
- configureFonts({
- config: {
- web: {
- ...fontConfig.web,
- customFont,
- },
- },
- isV3: false,
- })
- ).toEqual({
- ...fontConfig.web,
- customFont,
- });
- });
-
it('overrides properties passed in config for all variants', () => {
mockPlatform('ios');
const { configureFonts } = loadFonts();
diff --git a/src/styles/fonts.tsx b/src/styles/fonts.tsx
index e3b5017fc4..07a0ab2a2e 100644
--- a/src/styles/fonts.tsx
+++ b/src/styles/fonts.tsx
@@ -1,69 +1,6 @@
-import { Platform, PlatformOSType } from 'react-native';
-
-import type { Fonts, MD3Type, MD3Typescale, MD3TypescaleKey } from '../types';
+import type { MD3Type, MD3Typescale, MD3TypescaleKey } from '../types';
import { typescale } from './themes/v3/tokens';
-export const fontConfig = {
- web: {
- regular: {
- fontFamily: 'Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif',
- fontWeight: '400' as '400',
- },
- medium: {
- fontFamily: 'Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif',
- fontWeight: '500' as '500',
- },
- light: {
- fontFamily: 'Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif',
- fontWeight: '300' as '300',
- },
- thin: {
- fontFamily: 'Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif',
- fontWeight: '100' as '100',
- },
- },
- ios: {
- regular: {
- fontFamily: 'System',
- fontWeight: '400' as '400',
- },
- medium: {
- fontFamily: 'System',
- fontWeight: '500' as '500',
- },
- light: {
- fontFamily: 'System',
- fontWeight: '300' as '300',
- },
- thin: {
- fontFamily: 'System',
- fontWeight: '100' as '100',
- },
- },
- default: {
- regular: {
- fontFamily: 'sans-serif',
- fontWeight: 'normal' as 'normal',
- },
- medium: {
- fontFamily: 'sans-serif-medium',
- fontWeight: 'normal' as 'normal',
- },
- light: {
- fontFamily: 'sans-serif-light',
- fontWeight: 'normal' as 'normal',
- },
- thin: {
- fontFamily: 'sans-serif-thin',
- fontWeight: 'normal' as 'normal',
- },
- },
-};
-
-type MD2FontsConfig = {
- [platform in PlatformOSType | 'default']?: Fonts;
-};
-
type MD3FontsConfig =
| {
[key in MD3TypescaleKey]: Partial;
@@ -73,11 +10,6 @@ type MD3FontsConfig =
}
| Partial;
-function configureV2Fonts(config: MD2FontsConfig): Fonts {
- const fonts = Platform.select({ ...fontConfig, ...config }) as Fonts;
- return fonts;
-}
-
function configureV3Fonts(
config: MD3FontsConfig
): MD3Typescale | (MD3Typescale & { [key: string]: MD3Type }) {
@@ -110,13 +42,6 @@ function configureV3Fonts(
);
}
-// eslint-disable-next-line no-redeclare
-export default function configureFonts(params: { isV3: false }): Fonts;
-// eslint-disable-next-line no-redeclare
-export default function configureFonts(params: {
- config?: MD2FontsConfig;
- isV3: false;
-}): Fonts;
// eslint-disable-next-line no-redeclare
export default function configureFonts(params?: {
config?: Partial;
@@ -134,10 +59,6 @@ export default function configureFonts(params: {
}): MD3Typescale & { [key: string]: MD3Type };
// eslint-disable-next-line no-redeclare
export default function configureFonts(params?: any) {
- const { isV3 = true, config } = params || {};
-
- if (isV3) {
- return configureV3Fonts(config);
- }
- return configureV2Fonts(config);
+ const { config } = params || {};
+ return configureV3Fonts(config);
}
diff --git a/src/styles/overlay.tsx b/src/styles/overlay.tsx
index f9e6f8f9a5..050e0c06d1 100644
--- a/src/styles/overlay.tsx
+++ b/src/styles/overlay.tsx
@@ -2,7 +2,7 @@ import { Animated } from 'react-native';
import color from 'color';
-import { MD2DarkTheme } from './themes/v2/DarkTheme';
+import { MD3DarkTheme } from './themes';
export const isAnimatedValue = (
it: number | string | Animated.AnimatedInterpolation
@@ -10,7 +10,7 @@ export const isAnimatedValue = (
export default function overlay(
elevation: T,
- surfaceColor: string = MD2DarkTheme.colors?.surface
+ surfaceColor: string = MD3DarkTheme.colors.surface
): T extends number ? string : Animated.AnimatedInterpolation {
if (isAnimatedValue(elevation)) {
const inputRange = [0, 1, 2, 3, 8, 24];
diff --git a/src/styles/shadow.tsx b/src/styles/shadow.tsx
index dcc11e8b65..57cc3612de 100644
--- a/src/styles/shadow.tsx
+++ b/src/styles/shadow.tsx
@@ -1,73 +1,12 @@
import { Animated } from 'react-native';
-import * as MD2Colors from './themes/v2/colors';
import { MD3Colors } from './themes/v3/tokens';
-const SHADOW_COLOR = MD2Colors.black;
-const SHADOW_OPACITY = 0.24;
const MD3_SHADOW_OPACITY = 0.3;
const MD3_SHADOW_COLOR = MD3Colors.primary0;
-export default function shadow(
- elevation: number | Animated.Value = 0,
- isV3 = false
-) {
- return isV3 ? v3Shadow(elevation) : v2Shadow(elevation);
-}
-
-function v2Shadow(elevation: number | Animated.Value = 0) {
- if (elevation instanceof Animated.Value) {
- const inputRange = [0, 1, 2, 3, 8, 24];
-
- return {
- shadowColor: SHADOW_COLOR,
- shadowOffset: {
- width: new Animated.Value(0),
- height: elevation.interpolate({
- inputRange,
- outputRange: [0, 0.5, 0.75, 2, 7, 23],
- }),
- },
- shadowOpacity: elevation.interpolate({
- inputRange: [0, 1],
- outputRange: [0, SHADOW_OPACITY],
- extrapolate: 'clamp',
- }),
- shadowRadius: elevation.interpolate({
- inputRange,
- outputRange: [0, 0.75, 1.5, 3, 8, 24],
- }),
- };
- } else {
- if (elevation === 0) {
- return {};
- }
-
- let height, radius;
- switch (elevation) {
- case 1:
- height = 0.5;
- radius = 0.75;
- break;
- case 2:
- height = 0.75;
- radius = 1.5;
- break;
- default:
- height = elevation - 1;
- radius = elevation;
- }
-
- return {
- shadowColor: SHADOW_COLOR,
- shadowOffset: {
- width: 0,
- height,
- },
- shadowOpacity: SHADOW_OPACITY,
- shadowRadius: radius,
- };
- }
+export default function shadow(elevation: number | Animated.Value = 0) {
+ return v3Shadow(elevation);
}
function v3Shadow(elevation: number | Animated.Value = 0) {
diff --git a/src/styles/themes/DynamicTheme.android.tsx b/src/styles/themes/DynamicTheme.android.tsx
new file mode 100644
index 0000000000..b16b4bd040
--- /dev/null
+++ b/src/styles/themes/DynamicTheme.android.tsx
@@ -0,0 +1,502 @@
+import { Platform, PlatformColor } from 'react-native';
+
+import { MD3DarkTheme } from './v3/DarkTheme';
+import { MD3LightTheme } from './v3/LightTheme';
+import type { MD3Theme } from '../../types';
+
+const isApi34 = (Platform.Version as number) >= 34;
+const isApi31 = (Platform.Version as number) >= 31;
+
+const ac = (name: string) =>
+ PlatformColor(`@android:color/${name}`) as unknown as string;
+
+/**
+ * Picks the correct color value for the current Android API level.
+ * - API 34+: uses the named role resource (system_*_light/dark)
+ * - API 31-33: uses the tonal accent resource (system_accent*_NNN), or ref
+ * - API < 31: uses the reference palette string from the base theme
+ * @see https://github.com/material-components/material-components-android/blob/master/docs/theming/Color.md
+ */
+const pick = (api34: string, api31: string, ref: string): string =>
+ isApi34 ? ac(api34) : isApi31 && api31 != null ? ac(api31) : ref;
+
+// Known limitation: surface/container roles on API 31-33 use
+// @color/m3_ref_palette_dynamic_neutral_variant* (MCL resources that require a
+// native DynamicColors setup). No @android:color/ equivalent exists for those
+// slots. Reference palette values are used as fallback on API 31-33.
+
+const lightColors = {
+ primary: pick(
+ 'system_primary_light',
+ 'system_accent1_600',
+ MD3LightTheme.colors.primary
+ ),
+ onPrimary: pick(
+ 'system_on_primary_light',
+ 'system_accent1_0',
+ MD3LightTheme.colors.onPrimary
+ ),
+ primaryContainer: pick(
+ 'system_primary_container_light',
+ 'system_accent1_100',
+ MD3LightTheme.colors.primaryContainer
+ ),
+ onPrimaryContainer: pick(
+ 'system_on_primary_container_light',
+ 'system_accent1_900',
+ MD3LightTheme.colors.onPrimaryContainer
+ ),
+ inversePrimary: pick(
+ 'system_primary_dark',
+ 'system_accent1_200',
+ MD3LightTheme.colors.inversePrimary
+ ),
+ secondary: pick(
+ 'system_secondary_light',
+ 'system_accent2_600',
+ MD3LightTheme.colors.secondary
+ ),
+ onSecondary: pick(
+ 'system_on_secondary_light',
+ 'system_accent2_0',
+ MD3LightTheme.colors.onSecondary
+ ),
+ secondaryContainer: pick(
+ 'system_secondary_container_light',
+ 'system_accent2_100',
+ MD3LightTheme.colors.secondaryContainer
+ ),
+ onSecondaryContainer: pick(
+ 'system_on_secondary_container_light',
+ 'system_accent2_900',
+ MD3LightTheme.colors.onSecondaryContainer
+ ),
+ tertiary: pick(
+ 'system_tertiary_light',
+ 'system_accent3_600',
+ MD3LightTheme.colors.tertiary
+ ),
+ onTertiary: pick(
+ 'system_on_tertiary_light',
+ 'system_accent3_0',
+ MD3LightTheme.colors.onTertiary
+ ),
+ tertiaryContainer: pick(
+ 'system_tertiary_container_light',
+ 'system_accent3_100',
+ MD3LightTheme.colors.tertiaryContainer
+ ),
+ onTertiaryContainer: pick(
+ 'system_on_tertiary_container_light',
+ 'system_accent3_900',
+ MD3LightTheme.colors.onTertiaryContainer
+ ),
+ error: pick(
+ 'system_error_light',
+ MD3LightTheme.colors.error,
+ MD3LightTheme.colors.error
+ ),
+ onError: pick(
+ 'system_on_error_light',
+ MD3LightTheme.colors.onError,
+ MD3LightTheme.colors.onError
+ ),
+ errorContainer: pick(
+ 'system_error_container_light',
+ MD3LightTheme.colors.errorContainer,
+ MD3LightTheme.colors.errorContainer
+ ),
+ onErrorContainer: pick(
+ 'system_on_error_container_light',
+ MD3LightTheme.colors.onErrorContainer,
+ MD3LightTheme.colors.onErrorContainer
+ ),
+ onSurface: pick(
+ 'system_on_surface_light',
+ 'system_neutral1_900',
+ MD3LightTheme.colors.onSurface
+ ),
+ onBackground: pick(
+ 'system_on_background_light',
+ 'system_neutral1_900',
+ MD3LightTheme.colors.onBackground
+ ),
+ onSurfaceVariant: pick(
+ 'system_on_surface_variant_light',
+ 'system_neutral2_700',
+ MD3LightTheme.colors.onSurfaceVariant
+ ),
+ outline: pick(
+ 'system_outline_light',
+ 'system_neutral2_500',
+ MD3LightTheme.colors.outline
+ ),
+ outlineVariant: pick(
+ 'system_outline_variant_light',
+ 'system_neutral2_200',
+ MD3LightTheme.colors.outlineVariant
+ ),
+ inverseSurface: pick(
+ 'system_surface_dark',
+ 'system_neutral1_800',
+ MD3LightTheme.colors.inverseSurface
+ ),
+ inverseOnSurface: pick(
+ 'system_on_surface_dark',
+ 'system_neutral1_50',
+ MD3LightTheme.colors.inverseOnSurface
+ ),
+ surfaceContainerLowest: pick(
+ 'system_surface_container_lowest_light',
+ 'system_neutral2_0',
+ MD3LightTheme.colors.surfaceContainerLowest
+ ),
+ surfaceContainerLow: pick(
+ 'system_surface_container_low_light',
+ MD3LightTheme.colors.surfaceContainerLow,
+ MD3LightTheme.colors.surfaceContainerLow
+ ),
+ surfaceContainerHighest: pick(
+ 'system_surface_container_highest_light',
+ 'system_neutral2_100',
+ MD3LightTheme.colors.surfaceContainerHighest
+ ),
+ surface: pick(
+ 'system_surface_light',
+ MD3LightTheme.colors.surface,
+ MD3LightTheme.colors.surface
+ ),
+ surfaceDim: pick(
+ 'system_surface_dim_light',
+ MD3LightTheme.colors.surfaceDim,
+ MD3LightTheme.colors.surfaceDim
+ ),
+ surfaceBright: pick(
+ 'system_surface_bright_light',
+ MD3LightTheme.colors.surfaceBright,
+ MD3LightTheme.colors.surfaceBright
+ ),
+ surfaceContainer: pick(
+ 'system_surface_container_light',
+ MD3LightTheme.colors.surfaceContainer,
+ MD3LightTheme.colors.surfaceContainer
+ ),
+ surfaceContainerHigh: pick(
+ 'system_surface_container_high_light',
+ MD3LightTheme.colors.surfaceContainerHigh,
+ MD3LightTheme.colors.surfaceContainerHigh
+ ),
+ background: pick(
+ 'system_background_light',
+ MD3LightTheme.colors.background,
+ MD3LightTheme.colors.background
+ ),
+ surfaceVariant: pick(
+ 'system_surface_variant_light',
+ MD3LightTheme.colors.surfaceVariant,
+ MD3LightTheme.colors.surfaceVariant
+ ),
+ primaryFixed: pick(
+ 'system_primary_fixed',
+ 'system_accent1_100',
+ MD3LightTheme.colors.primaryFixed
+ ),
+ primaryFixedDim: pick(
+ 'system_primary_fixed_dim',
+ 'system_accent1_200',
+ MD3LightTheme.colors.primaryFixedDim
+ ),
+ onPrimaryFixed: pick(
+ 'system_on_primary_fixed',
+ 'system_accent1_900',
+ MD3LightTheme.colors.onPrimaryFixed
+ ),
+ onPrimaryFixedVariant: pick(
+ 'system_on_primary_fixed_variant',
+ 'system_accent1_700',
+ MD3LightTheme.colors.onPrimaryFixedVariant
+ ),
+ secondaryFixed: pick(
+ 'system_secondary_fixed',
+ 'system_accent2_100',
+ MD3LightTheme.colors.secondaryFixed
+ ),
+ secondaryFixedDim: pick(
+ 'system_secondary_fixed_dim',
+ 'system_accent2_200',
+ MD3LightTheme.colors.secondaryFixedDim
+ ),
+ onSecondaryFixed: pick(
+ 'system_on_secondary_fixed',
+ 'system_accent2_900',
+ MD3LightTheme.colors.onSecondaryFixed
+ ),
+ onSecondaryFixedVariant: pick(
+ 'system_on_secondary_fixed_variant',
+ 'system_accent2_700',
+ MD3LightTheme.colors.onSecondaryFixedVariant
+ ),
+ tertiaryFixed: pick(
+ 'system_tertiary_fixed',
+ 'system_accent3_100',
+ MD3LightTheme.colors.tertiaryFixed
+ ),
+ tertiaryFixedDim: pick(
+ 'system_tertiary_fixed_dim',
+ 'system_accent3_200',
+ MD3LightTheme.colors.tertiaryFixedDim
+ ),
+ onTertiaryFixed: pick(
+ 'system_on_tertiary_fixed',
+ 'system_accent3_900',
+ MD3LightTheme.colors.onTertiaryFixed
+ ),
+ onTertiaryFixedVariant: pick(
+ 'system_on_tertiary_fixed_variant',
+ 'system_accent3_700',
+ MD3LightTheme.colors.onTertiaryFixedVariant
+ ),
+};
+
+const darkColors = {
+ primary: pick(
+ 'system_primary_dark',
+ 'system_accent1_200',
+ MD3DarkTheme.colors.primary
+ ),
+ onPrimary: pick(
+ 'system_on_primary_dark',
+ 'system_accent1_800',
+ MD3DarkTheme.colors.onPrimary
+ ),
+ primaryContainer: pick(
+ 'system_primary_container_dark',
+ 'system_accent1_700',
+ MD3DarkTheme.colors.primaryContainer
+ ),
+ onPrimaryContainer: pick(
+ 'system_on_primary_container_dark',
+ 'system_accent1_100',
+ MD3DarkTheme.colors.onPrimaryContainer
+ ),
+ inversePrimary: pick(
+ 'system_primary_light',
+ 'system_accent1_600',
+ MD3DarkTheme.colors.inversePrimary
+ ),
+ secondary: pick(
+ 'system_secondary_dark',
+ 'system_accent2_200',
+ MD3DarkTheme.colors.secondary
+ ),
+ onSecondary: pick(
+ 'system_on_secondary_dark',
+ 'system_accent2_800',
+ MD3DarkTheme.colors.onSecondary
+ ),
+ secondaryContainer: pick(
+ 'system_secondary_container_dark',
+ 'system_accent2_700',
+ MD3DarkTheme.colors.secondaryContainer
+ ),
+ onSecondaryContainer: pick(
+ 'system_on_secondary_container_dark',
+ 'system_accent2_100',
+ MD3DarkTheme.colors.onSecondaryContainer
+ ),
+ tertiary: pick(
+ 'system_tertiary_dark',
+ 'system_accent3_200',
+ MD3DarkTheme.colors.tertiary
+ ),
+ onTertiary: pick(
+ 'system_on_tertiary_dark',
+ 'system_accent3_800',
+ MD3DarkTheme.colors.onTertiary
+ ),
+ tertiaryContainer: pick(
+ 'system_tertiary_container_dark',
+ 'system_accent3_700',
+ MD3DarkTheme.colors.tertiaryContainer
+ ),
+ onTertiaryContainer: pick(
+ 'system_on_tertiary_container_dark',
+ 'system_accent3_100',
+ MD3DarkTheme.colors.onTertiaryContainer
+ ),
+ error: pick(
+ 'system_error_dark',
+ MD3DarkTheme.colors.error,
+ MD3DarkTheme.colors.error
+ ),
+ onError: pick(
+ 'system_on_error_dark',
+ MD3DarkTheme.colors.onError,
+ MD3DarkTheme.colors.onError
+ ),
+ errorContainer: pick(
+ 'system_error_container_dark',
+ MD3DarkTheme.colors.errorContainer,
+ MD3DarkTheme.colors.errorContainer
+ ),
+ onErrorContainer: pick(
+ 'system_on_error_container_dark',
+ MD3DarkTheme.colors.onErrorContainer,
+ MD3DarkTheme.colors.onErrorContainer
+ ),
+ onSurface: pick(
+ 'system_on_surface_dark',
+ 'system_neutral1_100',
+ MD3DarkTheme.colors.onSurface
+ ),
+ onBackground: pick(
+ 'system_on_background_dark',
+ 'system_neutral1_100',
+ MD3DarkTheme.colors.onBackground
+ ),
+ onSurfaceVariant: pick(
+ 'system_on_surface_variant_dark',
+ 'system_neutral2_200',
+ MD3DarkTheme.colors.onSurfaceVariant
+ ),
+ outline: pick(
+ 'system_outline_dark',
+ 'system_neutral2_400',
+ MD3DarkTheme.colors.outline
+ ),
+ outlineVariant: pick(
+ 'system_outline_variant_dark',
+ 'system_neutral2_700',
+ MD3DarkTheme.colors.outlineVariant
+ ),
+ inverseSurface: pick(
+ 'system_surface_light',
+ 'system_neutral1_100',
+ MD3DarkTheme.colors.inverseSurface
+ ),
+ inverseOnSurface: pick(
+ 'system_on_surface_light',
+ 'system_neutral1_800',
+ MD3DarkTheme.colors.inverseOnSurface
+ ),
+ surfaceContainerLowest: pick(
+ 'system_surface_container_lowest_dark',
+ MD3DarkTheme.colors.surfaceContainerLowest,
+ MD3DarkTheme.colors.surfaceContainerLowest
+ ),
+ surfaceContainerLow: pick(
+ 'system_surface_container_low_dark',
+ 'system_neutral2_900',
+ MD3DarkTheme.colors.surfaceContainerLow
+ ),
+ surfaceContainerHighest: pick(
+ 'system_surface_container_highest_dark',
+ MD3DarkTheme.colors.surfaceContainerHighest,
+ MD3DarkTheme.colors.surfaceContainerHighest
+ ),
+ surface: pick(
+ 'system_surface_dark',
+ MD3DarkTheme.colors.surface,
+ MD3DarkTheme.colors.surface
+ ),
+ surfaceDim: pick(
+ 'system_surface_dim_dark',
+ MD3DarkTheme.colors.surfaceDim,
+ MD3DarkTheme.colors.surfaceDim
+ ),
+ surfaceBright: pick(
+ 'system_surface_bright_dark',
+ MD3DarkTheme.colors.surfaceBright,
+ MD3DarkTheme.colors.surfaceBright
+ ),
+ surfaceContainer: pick(
+ 'system_surface_container_dark',
+ MD3DarkTheme.colors.surfaceContainer,
+ MD3DarkTheme.colors.surfaceContainer
+ ),
+ surfaceContainerHigh: pick(
+ 'system_surface_container_high_dark',
+ MD3DarkTheme.colors.surfaceContainerHigh,
+ MD3DarkTheme.colors.surfaceContainerHigh
+ ),
+ background: pick(
+ 'system_background_dark',
+ MD3DarkTheme.colors.background,
+ MD3DarkTheme.colors.background
+ ),
+ surfaceVariant: pick(
+ 'system_surface_variant_dark',
+ MD3DarkTheme.colors.surfaceVariant,
+ MD3DarkTheme.colors.surfaceVariant
+ ),
+ primaryFixed: pick(
+ 'system_primary_fixed',
+ 'system_accent1_100',
+ MD3DarkTheme.colors.primaryFixed
+ ),
+ primaryFixedDim: pick(
+ 'system_primary_fixed_dim',
+ 'system_accent1_200',
+ MD3DarkTheme.colors.primaryFixedDim
+ ),
+ onPrimaryFixed: pick(
+ 'system_on_primary_fixed',
+ 'system_accent1_900',
+ MD3DarkTheme.colors.onPrimaryFixed
+ ),
+ onPrimaryFixedVariant: pick(
+ 'system_on_primary_fixed_variant',
+ 'system_accent1_700',
+ MD3DarkTheme.colors.onPrimaryFixedVariant
+ ),
+ secondaryFixed: pick(
+ 'system_secondary_fixed',
+ 'system_accent2_100',
+ MD3DarkTheme.colors.secondaryFixed
+ ),
+ secondaryFixedDim: pick(
+ 'system_secondary_fixed_dim',
+ 'system_accent2_200',
+ MD3DarkTheme.colors.secondaryFixedDim
+ ),
+ onSecondaryFixed: pick(
+ 'system_on_secondary_fixed',
+ 'system_accent2_900',
+ MD3DarkTheme.colors.onSecondaryFixed
+ ),
+ onSecondaryFixedVariant: pick(
+ 'system_on_secondary_fixed_variant',
+ 'system_accent2_700',
+ MD3DarkTheme.colors.onSecondaryFixedVariant
+ ),
+ tertiaryFixed: pick(
+ 'system_tertiary_fixed',
+ 'system_accent3_100',
+ MD3DarkTheme.colors.tertiaryFixed
+ ),
+ tertiaryFixedDim: pick(
+ 'system_tertiary_fixed_dim',
+ 'system_accent3_200',
+ MD3DarkTheme.colors.tertiaryFixedDim
+ ),
+ onTertiaryFixed: pick(
+ 'system_on_tertiary_fixed',
+ 'system_accent3_900',
+ MD3DarkTheme.colors.onTertiaryFixed
+ ),
+ onTertiaryFixedVariant: pick(
+ 'system_on_tertiary_fixed_variant',
+ 'system_accent3_700',
+ MD3DarkTheme.colors.onTertiaryFixedVariant
+ ),
+};
+
+export const DynamicLightTheme: MD3Theme = {
+ ...MD3LightTheme,
+ colors: { ...MD3LightTheme.colors, ...lightColors },
+};
+
+export const DynamicDarkTheme: MD3Theme = {
+ ...MD3DarkTheme,
+ colors: { ...MD3DarkTheme.colors, ...darkColors },
+};
diff --git a/src/styles/themes/DynamicTheme.tsx b/src/styles/themes/DynamicTheme.tsx
new file mode 100644
index 0000000000..6669c63a45
--- /dev/null
+++ b/src/styles/themes/DynamicTheme.tsx
@@ -0,0 +1,2 @@
+export { MD3DarkTheme as MD3DynamicDarkTheme } from './v3/DarkTheme';
+export { MD3LightTheme as MD3DynamicLightTheme } from './v3/LightTheme';
diff --git a/src/styles/themes/index.ts b/src/styles/themes/index.ts
index 3db1a460ad..f992ef7e73 100644
--- a/src/styles/themes/index.ts
+++ b/src/styles/themes/index.ts
@@ -1,4 +1,3 @@
export { MD3LightTheme } from './v3/LightTheme';
export { MD3DarkTheme } from './v3/DarkTheme';
-export { MD2LightTheme } from './v2/LightTheme';
-export { MD2DarkTheme } from './v2/DarkTheme';
+export { DynamicLightTheme, DynamicDarkTheme } from './DynamicTheme';
diff --git a/src/styles/themes/v2/DarkTheme.tsx b/src/styles/themes/v2/DarkTheme.tsx
deleted file mode 100644
index 9eaa576dcb..0000000000
--- a/src/styles/themes/v2/DarkTheme.tsx
+++ /dev/null
@@ -1,30 +0,0 @@
-import color from 'color';
-
-import { black, pinkA100, white } from './colors';
-import { MD2LightTheme } from './LightTheme';
-import type { Fonts, MD2Theme } from '../../../types';
-import configureFonts from '../../fonts';
-
-export const MD2DarkTheme: MD2Theme = {
- ...MD2LightTheme,
- dark: true,
- mode: 'adaptive',
- version: 2,
- isV3: false,
- colors: {
- ...MD2LightTheme.colors,
- primary: '#BB86FC',
- accent: '#03dac6',
- background: '#121212',
- surface: '#121212',
- error: '#CF6679',
- onSurface: '#FFFFFF',
- text: white,
- disabled: color(white).alpha(0.38).rgb().string(),
- placeholder: color(white).alpha(0.54).rgb().string(),
- backdrop: color(black).alpha(0.5).rgb().string(),
- notification: pinkA100,
- tooltip: 'rgba(230, 225, 229, 1)',
- },
- fonts: configureFonts({ isV3: false }) as Fonts,
-};
diff --git a/src/styles/themes/v2/LightTheme.tsx b/src/styles/themes/v2/LightTheme.tsx
deleted file mode 100644
index 8566bdcc40..0000000000
--- a/src/styles/themes/v2/LightTheme.tsx
+++ /dev/null
@@ -1,30 +0,0 @@
-import color from 'color';
-
-import { black, pinkA400, white } from './colors';
-import type { Fonts, MD2Theme } from '../../../types';
-import configureFonts from '../../fonts';
-
-export const MD2LightTheme: MD2Theme = {
- dark: false,
- roundness: 4,
- version: 2,
- isV3: false,
- colors: {
- primary: '#6200ee',
- accent: '#03dac4',
- background: '#f6f6f6',
- surface: white,
- error: '#B00020',
- text: black,
- onSurface: '#000000',
- disabled: color(black).alpha(0.26).rgb().string(),
- placeholder: color(black).alpha(0.54).rgb().string(),
- backdrop: color(black).alpha(0.5).rgb().string(),
- notification: pinkA400,
- tooltip: 'rgba(28, 27, 31, 1)',
- },
- fonts: configureFonts({ isV3: false }) as Fonts,
- animation: {
- scale: 1.0,
- },
-};
diff --git a/src/styles/themes/v3/DarkTheme.tsx b/src/styles/themes/v3/DarkTheme.tsx
index 9823e677bd..c8e21e8d46 100644
--- a/src/styles/themes/v3/DarkTheme.tsx
+++ b/src/styles/themes/v3/DarkTheme.tsx
@@ -1,10 +1,10 @@
import color from 'color';
import { MD3LightTheme } from './LightTheme';
-import { MD3Colors, tokens } from './tokens';
+import { tokens } from './tokens';
import type { MD3Theme } from '../../../types';
-const { palette, opacity } = tokens.md.ref;
+const { palette, stateOpacity } = tokens.md.ref;
export const MD3DarkTheme: MD3Theme = {
...MD3LightTheme,
@@ -19,13 +19,16 @@ export const MD3DarkTheme: MD3Theme = {
secondaryContainer: palette.secondary30,
tertiary: palette.tertiary80,
tertiaryContainer: palette.tertiary30,
- surface: palette.neutral10,
+ surface: palette.neutral6,
+ surfaceDim: palette.neutral6,
+ surfaceBright: palette.neutral24,
+ surfaceContainerLowest: palette.neutral4,
+ surfaceContainerLow: palette.neutral10,
+ surfaceContainer: palette.neutral12,
+ surfaceContainerHigh: palette.neutral17,
+ surfaceContainerHighest: palette.neutral22,
surfaceVariant: palette.neutralVariant30,
- surfaceDisabled: color(palette.neutral90)
- .alpha(opacity.level2)
- .rgb()
- .string(),
- background: palette.neutral10,
+ background: palette.neutral6,
error: palette.error80,
errorContainer: palette.error30,
onPrimary: palette.primary20,
@@ -36,10 +39,6 @@ export const MD3DarkTheme: MD3Theme = {
onTertiaryContainer: palette.tertiary90,
onSurface: palette.neutral90,
onSurfaceVariant: palette.neutralVariant80,
- onSurfaceDisabled: color(palette.neutral90)
- .alpha(opacity.level4)
- .rgb()
- .string(),
onError: palette.error20,
onErrorContainer: palette.error80,
onBackground: palette.neutral90,
@@ -48,19 +47,31 @@ export const MD3DarkTheme: MD3Theme = {
inverseSurface: palette.neutral90,
inverseOnSurface: palette.neutral20,
inversePrimary: palette.primary40,
+ primaryFixed: palette.primary90,
+ primaryFixedDim: palette.primary80,
+ onPrimaryFixed: palette.primary10,
+ onPrimaryFixedVariant: palette.primary30,
+ secondaryFixed: palette.secondary90,
+ secondaryFixedDim: palette.secondary80,
+ onSecondaryFixed: palette.secondary10,
+ onSecondaryFixedVariant: palette.secondary30,
+ tertiaryFixed: palette.tertiary90,
+ tertiaryFixedDim: palette.tertiary80,
+ onTertiaryFixed: palette.tertiary10,
+ onTertiaryFixedVariant: palette.tertiary30,
shadow: palette.neutral0,
scrim: palette.neutral0,
- backdrop: color(MD3Colors.neutralVariant20).alpha(0.4).rgb().string(),
+ stateLayerPressed: color(palette.neutral90)
+ .alpha(stateOpacity.pressed)
+ .rgb()
+ .string(),
elevation: {
level0: 'transparent',
- // Note: Color values with transparency cause RN to transfer shadows to children nodes
- // instead of View component in Surface. Providing solid background fixes the issue.
- // Opaque color values generated with `palette.primary80` used as background
- level1: 'rgb(37, 35, 42)', // palette.primary80, alpha 0.05
- level2: 'rgb(44, 40, 49)', // palette.primary80, alpha 0.08
- level3: 'rgb(49, 44, 56)', // palette.primary80, alpha 0.11
- level4: 'rgb(51, 46, 58)', // palette.primary80, alpha 0.12
- level5: 'rgb(52, 49, 63)', // palette.primary80, alpha 0.14
+ level1: palette.neutral10,
+ level2: palette.neutral12,
+ level3: palette.neutral17,
+ level4: palette.neutral17,
+ level5: palette.neutral22,
},
},
};
diff --git a/src/styles/themes/v3/LightTheme.tsx b/src/styles/themes/v3/LightTheme.tsx
index 99e0d11ab4..da0ece6476 100644
--- a/src/styles/themes/v3/LightTheme.tsx
+++ b/src/styles/themes/v3/LightTheme.tsx
@@ -1,10 +1,10 @@
import color from 'color';
-import { MD3Colors, tokens } from './tokens';
+import { tokens } from './tokens';
import type { MD3Theme } from '../../../types';
import configureFonts from '../../fonts';
-const { palette, opacity } = tokens.md.ref;
+const { palette, stateOpacity } = tokens.md.ref;
export const MD3LightTheme: MD3Theme = {
dark: false,
@@ -18,13 +18,16 @@ export const MD3LightTheme: MD3Theme = {
secondaryContainer: palette.secondary90,
tertiary: palette.tertiary40,
tertiaryContainer: palette.tertiary90,
- surface: palette.neutral99,
+ surface: palette.neutral98,
+ surfaceDim: palette.neutral87,
+ surfaceBright: palette.neutral98,
+ surfaceContainerLowest: palette.neutral100,
+ surfaceContainerLow: palette.neutral96,
+ surfaceContainer: palette.neutral94,
+ surfaceContainerHigh: palette.neutral92,
+ surfaceContainerHighest: palette.neutral90,
surfaceVariant: palette.neutralVariant90,
- surfaceDisabled: color(palette.neutral10)
- .alpha(opacity.level2)
- .rgb()
- .string(),
- background: palette.neutral99,
+ background: palette.neutral98,
error: palette.error40,
errorContainer: palette.error90,
onPrimary: palette.primary100,
@@ -35,10 +38,6 @@ export const MD3LightTheme: MD3Theme = {
onTertiaryContainer: palette.tertiary10,
onSurface: palette.neutral10,
onSurfaceVariant: palette.neutralVariant30,
- onSurfaceDisabled: color(palette.neutral10)
- .alpha(opacity.level4)
- .rgb()
- .string(),
onError: palette.error100,
onErrorContainer: palette.error10,
onBackground: palette.neutral10,
@@ -47,19 +46,31 @@ export const MD3LightTheme: MD3Theme = {
inverseSurface: palette.neutral20,
inverseOnSurface: palette.neutral95,
inversePrimary: palette.primary80,
+ primaryFixed: palette.primary90,
+ primaryFixedDim: palette.primary80,
+ onPrimaryFixed: palette.primary10,
+ onPrimaryFixedVariant: palette.primary30,
+ secondaryFixed: palette.secondary90,
+ secondaryFixedDim: palette.secondary80,
+ onSecondaryFixed: palette.secondary10,
+ onSecondaryFixedVariant: palette.secondary30,
+ tertiaryFixed: palette.tertiary90,
+ tertiaryFixedDim: palette.tertiary80,
+ onTertiaryFixed: palette.tertiary10,
+ onTertiaryFixedVariant: palette.tertiary30,
shadow: palette.neutral0,
scrim: palette.neutral0,
- backdrop: color(MD3Colors.neutralVariant20).alpha(0.4).rgb().string(),
+ stateLayerPressed: color(palette.neutral10)
+ .alpha(stateOpacity.pressed)
+ .rgb()
+ .string(),
elevation: {
level0: 'transparent',
- // Note: Color values with transparency cause RN to transfer shadows to children nodes
- // instead of View component in Surface. Providing solid background fixes the issue.
- // Opaque color values generated with `palette.primary99` used as background
- level1: 'rgb(247, 243, 249)', // palette.primary40, alpha 0.05
- level2: 'rgb(243, 237, 246)', // palette.primary40, alpha 0.08
- level3: 'rgb(238, 232, 244)', // palette.primary40, alpha 0.11
- level4: 'rgb(236, 230, 243)', // palette.primary40, alpha 0.12
- level5: 'rgb(233, 227, 241)', // palette.primary40, alpha 0.14
+ level1: palette.neutral96,
+ level2: palette.neutral94,
+ level3: palette.neutral92,
+ level4: palette.neutral92,
+ level5: palette.neutral90,
},
},
fonts: configureFonts(),
diff --git a/src/styles/themes/v3/tokens.tsx b/src/styles/themes/v3/tokens.tsx
index d008944d86..12486aca53 100644
--- a/src/styles/themes/v3/tokens.tsx
+++ b/src/styles/themes/v3/tokens.tsx
@@ -6,6 +6,7 @@ const ref = {
palette: {
primary100: 'rgba(255, 255, 255, 1)',
primary99: 'rgba(255, 251, 254, 1)',
+ primary98: 'rgba(254, 247, 255, 1)',
primary95: 'rgba(246, 237, 255, 1)',
primary90: 'rgba(234, 221, 255, 1)',
primary80: 'rgba(208, 188, 255, 1)',
@@ -19,6 +20,7 @@ const ref = {
primary0: 'rgba(0, 0, 0, 1)',
secondary100: 'rgba(255, 255, 255, 1)',
secondary99: 'rgba(255, 251, 254, 1)',
+ secondary98: 'rgba(254, 247, 255, 1)',
secondary95: 'rgba(246, 237, 255, 1)',
secondary90: 'rgba(232, 222, 248, 1)',
secondary80: 'rgba(204, 194, 220, 1)',
@@ -32,6 +34,7 @@ const ref = {
secondary0: 'rgba(0, 0, 0, 1)',
tertiary100: 'rgba(255, 255, 255, 1)',
tertiary99: 'rgba(255, 251, 250, 1)',
+ tertiary98: 'rgba(255, 248, 248, 1)',
tertiary95: 'rgba(255, 236, 241, 1)',
tertiary90: 'rgba(255, 216, 228, 1)',
tertiary80: 'rgba(239, 184, 200, 1)',
@@ -44,20 +47,32 @@ const ref = {
tertiary10: 'rgba(49, 17, 29, 1)',
tertiary0: 'rgba(0, 0, 0, 1)',
neutral100: 'rgba(255, 255, 255, 1)',
- neutral99: 'rgba(255, 251, 254, 1)',
- neutral95: 'rgba(244, 239, 244, 1)',
- neutral90: 'rgba(230, 225, 229, 1)',
- neutral80: 'rgba(201, 197, 202, 1)',
- neutral70: 'rgba(174, 170, 174, 1)',
- neutral60: 'rgba(147, 144, 148, 1)',
- neutral50: 'rgba(120, 117, 121, 1)',
- neutral40: 'rgba(96, 93, 98, 1)',
- neutral30: 'rgba(72, 70, 73, 1)',
- neutral20: 'rgba(49, 48, 51, 1)',
- neutral10: 'rgba(28, 27, 31, 1)',
+ neutral99: 'rgba(255, 251, 255, 1)',
+ neutral98: 'rgba(254, 247, 255, 1)',
+ neutral96: 'rgba(247, 242, 250, 1)',
+ neutral95: 'rgba(245, 239, 247, 1)',
+ neutral94: 'rgba(243, 237, 247, 1)',
+ neutral92: 'rgba(236, 230, 240, 1)',
+ neutral90: 'rgba(230, 224, 233, 1)',
+ neutral87: 'rgba(222, 216, 225, 1)',
+ neutral80: 'rgba(202, 197, 205, 1)',
+ neutral70: 'rgba(174, 169, 177, 1)',
+ neutral60: 'rgba(147, 143, 150, 1)',
+ neutral50: 'rgba(121, 118, 125, 1)',
+ neutral40: 'rgba(96, 93, 100, 1)',
+ neutral30: 'rgba(72, 70, 76, 1)',
+ neutral24: 'rgba(59, 56, 62, 1)',
+ neutral22: 'rgba(54, 52, 59, 1)',
+ neutral20: 'rgba(50, 47, 53, 1)',
+ neutral17: 'rgba(43, 41, 48, 1)',
+ neutral12: 'rgba(33, 31, 38, 1)',
+ neutral10: 'rgba(29, 27, 32, 1)',
+ neutral6: 'rgba(20, 18, 24, 1)',
+ neutral4: 'rgba(15, 13, 19, 1)',
neutral0: 'rgba(0, 0, 0, 1)',
neutralVariant100: 'rgba(255, 255, 255, 1)',
neutralVariant99: 'rgba(255, 251, 254, 1)',
+ neutralVariant98: 'rgba(253, 247, 255, 1)',
neutralVariant95: 'rgba(245, 238, 250, 1)',
neutralVariant90: 'rgba(231, 224, 236, 1)',
neutralVariant80: 'rgba(202, 196, 208, 1)',
@@ -71,6 +86,7 @@ const ref = {
neutralVariant0: 'rgba(0, 0, 0, 1)',
error100: 'rgba(255, 255, 255, 1)',
error99: 'rgba(255, 251, 249, 1)',
+ error98: 'rgba(255, 248, 247, 1)',
error95: 'rgba(252, 238, 238, 1)',
error90: 'rgba(249, 222, 220, 1)',
error80: 'rgba(242, 184, 181, 1)',
@@ -100,12 +116,19 @@ const ref = {
weightMedium: '500' as Font['fontWeight'],
},
- opacity: {
- level1: 0.08,
- level2: 0.12,
- level3: 0.16,
- level4: 0.38,
+ /** State layers opacity
+ * @see https://m3.material.io/foundations/interaction/states/state-layers
+ */
+ stateOpacity: {
+ dragged: 0.16,
+ pressed: 0.1,
+ focus: 0.1,
+ hover: 0.08,
+ disabled: 0.38,
+ enabled: 1.0,
},
+
+ scrimAlpha: 0.32,
};
const regularType = {
diff --git a/src/types.tsx b/src/types.tsx
index 175131cab3..fc10abf1a7 100644
--- a/src/types.tsx
+++ b/src/types.tsx
@@ -28,21 +28,6 @@ export type Fonts = {
type Mode = 'adaptive' | 'exact';
-export type MD2Colors = {
- primary: string;
- background: string;
- surface: string;
- accent: string;
- error: string;
- text: string;
- onSurface: string;
- disabled: string;
- placeholder: string;
- backdrop: string;
- notification: string;
- tooltip: string;
-};
-
export type MD3Colors = {
primary: string;
primaryContainer: string;
@@ -51,8 +36,14 @@ export type MD3Colors = {
tertiary: string;
tertiaryContainer: string;
surface: string;
+ surfaceDim: string;
+ surfaceBright: string;
+ surfaceContainerLowest: string;
+ surfaceContainerLow: string;
+ surfaceContainer: string;
+ surfaceContainerHigh: string;
+ surfaceContainerHighest: string;
surfaceVariant: string;
- surfaceDisabled: string;
background: string;
error: string;
errorContainer: string;
@@ -64,7 +55,6 @@ export type MD3Colors = {
onTertiaryContainer: string;
onSurface: string;
onSurfaceVariant: string;
- onSurfaceDisabled: string;
onError: string;
onErrorContainer: string;
onBackground: string;
@@ -73,46 +63,29 @@ export type MD3Colors = {
inverseSurface: string;
inverseOnSurface: string;
inversePrimary: string;
+ primaryFixed: string;
+ primaryFixedDim: string;
+ onPrimaryFixed: string;
+ onPrimaryFixedVariant: string;
+ secondaryFixed: string;
+ secondaryFixedDim: string;
+ onSecondaryFixed: string;
+ onSecondaryFixedVariant: string;
+ tertiaryFixed: string;
+ tertiaryFixedDim: string;
+ onTertiaryFixed: string;
+ onTertiaryFixedVariant: string;
shadow: string;
scrim: string;
- backdrop: string;
+ /** Pre-computed state layer color at press opacity (0.10).
+ * Used for ripple effects. Avoids runtime alpha manipulation
+ * which is incompatible with PlatformColor on Android.
+ * TODO: revisit after https://github.com/facebook/react-native/pull/56395
+ * @see https://m3.material.io/foundations/interaction/states/state-layers */
+ stateLayerPressed: string;
elevation: MD3ElevationColors;
};
-export type MD3AndroidColors = {
- primary: number;
- primaryContainer: number;
- secondary: number;
- secondaryContainer: number;
- tertiary: number;
- tertiaryContainer: number;
- surface: number;
- surfaceVariant: number;
- background: number;
- error: number;
- errorContainer: number;
- onPrimary: number;
- onPrimaryContainer: number;
- onSecondary: number;
- onSecondaryContainer: number;
- onTertiary: number;
- onTertiaryContainer: number;
- onSurface: number;
- onSurfaceVariant: number;
- onError: number;
- onErrorContainer: number;
- onBackground: number;
- outline: number;
- outlineVariant: number;
- inverseSurface: number;
- inverseOnSurface: number;
- inversePrimary: number;
- shadow: number;
- scrim: number;
-};
-
-export type MD3Palette = {};
-
export type ThemeProp = $DeepPartial;
export type ThemeBase = {
@@ -132,14 +105,7 @@ export type MD3Theme = ThemeBase & {
fonts: MD3Typescale;
};
-export type MD2Theme = ThemeBase & {
- version: 2;
- isV3: false;
- colors: MD2Colors;
- fonts: Fonts;
-};
-
-export type InternalTheme = MD2Theme | MD3Theme;
+export type InternalTheme = MD3Theme;
// MD3 types
export enum MD3TypescaleKey {
diff --git a/yarn.lock b/yarn.lock
index 3920e64583..9696c756fb 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3887,13 +3887,6 @@ __metadata:
languageName: node
linkType: hard
-"@material/material-color-utilities@npm:^0.2.7":
- version: 0.2.7
- resolution: "@material/material-color-utilities@npm:0.2.7"
- checksum: 10c0/7734f8d7cffe6a92d47fcca82b4846e39ffd79be9c057f3299466696dcdee5379b8a8a3aa6a9692d40bd6900905f689105d9a8ce47882ab22348df10621f70cd
- languageName: node
- linkType: hard
-
"@mdx-js/mdx@npm:^0.20.3":
version: 0.20.3
resolution: "@mdx-js/mdx@npm:0.20.3"
@@ -4317,20 +4310,6 @@ __metadata:
languageName: node
linkType: hard
-"@pchmn/expo-material3-theme@npm:^1.3.2":
- version: 1.3.2
- resolution: "@pchmn/expo-material3-theme@npm:1.3.2"
- dependencies:
- "@material/material-color-utilities": "npm:^0.2.7"
- color: "npm:^4.2.3"
- peerDependencies:
- expo: "*"
- react: "*"
- react-native: "*"
- checksum: 10c0/89aa0a65b04f4a7f709c35bbdc2f7830dff73e0335877d36a091c55fb174ce82e4b2c67690657978b03fc563ab4c20565ded0ed7faec94d0a384a9c5085dfe19
- languageName: node
- linkType: hard
-
"@polka/url@npm:^1.0.0-next.24":
version: 1.0.0-next.29
resolution: "@polka/url@npm:1.0.0-next.29"
@@ -20063,7 +20042,6 @@ __metadata:
"@babel/core": "npm:^7.25.2"
"@expo/vector-icons": "npm:^15.0.2"
"@expo/webpack-config": "npm:~19.0.1"
- "@pchmn/expo-material3-theme": "npm:^1.3.2"
"@react-native-async-storage/async-storage": "npm:2.2.0"
"@react-native-masked-view/masked-view": "npm:0.3.2"
"@react-navigation/bottom-tabs": "npm:^7.3.10"