Skip to content

Commit 4189f4b

Browse files
feat: allow override of custom theme animation (#3645)
Co-authored-by: lukewalczak <[email protected]>
1 parent af0e940 commit 4189f4b

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/core/Provider.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ const Provider = (props: Props) => {
8686
...props.theme,
8787
version: themeVersion,
8888
animation: {
89+
...props.theme?.animation,
8990
scale: reduceMotionEnabled ? 0 : 1,
9091
},
9192
};

src/core/__tests__/Provider.test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,20 @@ describe('Provider', () => {
9696
);
9797
});
9898

99+
it('handles overriding animation with the custom one', () => {
100+
const { getByTestId } = render(
101+
createProvider({
102+
...MD3LightTheme,
103+
animation: { defaultAnimationDuration: 250 },
104+
})
105+
);
106+
107+
expect(getByTestId('provider-child-view').props.theme).toStrictEqual({
108+
...MD3LightTheme,
109+
animation: { scale: 1, defaultAnimationDuration: 250 },
110+
});
111+
});
112+
99113
it('should set AccessibilityInfo listeners, if there is no theme', async () => {
100114
mockAppearance();
101115
mockAccessibilityInfo();

0 commit comments

Comments
 (0)