Skip to content

Commit d4845c7

Browse files
committed
fix: adapt Toolbar to Surface rework
1 parent 0631f64 commit d4845c7

6 files changed

Lines changed: 2616 additions & 2362 deletions

File tree

‎src/components/IconButton/IconButton.tsx‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import ActivityIndicator from '../ActivityIndicator';
1616
import CrossFadeIcon from '../CrossFadeIcon';
1717
import Icon from '../Icon';
1818
import type { IconSource } from '../Icon';
19-
import Surface from '../Surface';
2019
import {
2120
resolveIconColors as resolveToolbarIconColors,
2221
ToolbarColorContext,

‎src/components/Toolbar/Toolbar.tsx‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import type { ColorScheme, Orientation, Variant } from './tokens';
99
import { ToolbarColorContext } from './ToolbarColorContext';
1010
import { getSpacing, resolveContainerColor, resolveElevation } from './utils';
1111
import { useInternalTheme } from '../../core/theming';
12+
import type { ThemeProp } from '../../theme/types';
1213
import { resolveCornerRadius } from '../../theme/utils/shape';
13-
import type { ThemeProp } from '../../types';
1414
import Surface from '../Surface';
1515

1616
export type Props = {
@@ -183,11 +183,9 @@ const Toolbar = ({
183183
<Surface
184184
ref={isDocked ? undefined : ref}
185185
elevation={elevation}
186+
backgroundColor={backgroundColor}
187+
borderRadius={borderRadius}
186188
style={[
187-
{
188-
backgroundColor,
189-
borderRadius,
190-
},
191189
isDocked && styles.dockedFill,
192190
styles.content,
193191
!isDocked && style,

‎src/components/Toolbar/ToolbarColorContext.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { ColorValue } from 'react-native';
33

44
import { ToolbarTokens } from './tokens';
55
import type { ColorScheme } from './tokens';
6-
import type { InternalTheme } from '../../types';
6+
import type { InternalTheme } from '../../theme/types';
77

88
export const resolveColors = (colorScheme: ColorScheme) =>
99
colorScheme === 'vibrant'

‎src/components/Toolbar/utils.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { ToolbarTokens } from './tokens';
44
import type { ColorScheme, Variant } from './tokens';
55
import { resolveColors } from './ToolbarColorContext';
66
import type { Elevation } from '../../theme/types';
7-
import type { InternalTheme } from '../../types';
7+
import type { InternalTheme } from '../../theme/types';
88

99
/** Resolve the container (background) color; an explicit `containerColor` wins over `colorScheme`. */
1010
export const resolveContainerColor = ({

‎src/components/__tests__/Toolbar.test.tsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ it("applies `style` directly to the floating pill's outer (position) layer", asy
8787
</Toolbar>
8888
);
8989

90-
expect(screen.getByTestId('floating-outer-layer')).toHaveStyle({
90+
expect(screen.getByTestId('floating')).toHaveStyle({
9191
position: 'absolute',
9292
top: 5,
9393
});
@@ -102,7 +102,7 @@ it("lets `style` override the floating pill's internal container styles", async
102102
</Toolbar>
103103
);
104104

105-
expect(screen.getByTestId('floating-outer-layer')).toHaveStyle({
105+
expect(screen.getByTestId('floating')).toHaveStyle({
106106
height: 200,
107107
});
108108
});
@@ -388,7 +388,7 @@ it("leaves a Button child's explicit textColor/buttonColor untouched", async ()
388388
// `theme.colors` values are `rgba(r, g, b, 1)` strings convert to hex to
389389
// compare against the design spec's hex values directly.
390390
const toHex = (rgba: unknown) => {
391-
const [r, g, b] = String(rgba).match(/\d+/g)!.map(Number);
391+
const [r, g, b] = (String(rgba).match(/\d+/g) ?? []).map(Number);
392392
return (
393393
'#' +
394394
[r, g, b]

0 commit comments

Comments
 (0)