Massive/mock-providers.tsx

31 lines
865 B
TypeScript
Raw Normal View History

import { NavigationContainer } from "@react-navigation/native";
import React from "react";
2022-11-26 01:20:18 +00:00
import {
DefaultTheme,
2023-07-20 02:55:19 +00:00
MD3DarkTheme,
2022-11-26 01:20:18 +00:00
Provider as PaperProvider,
} from "react-native-paper";
import MaterialIcon from "react-native-vector-icons/MaterialIcons";
import { ThemeContext } from "./use-theme";
2022-10-29 23:56:58 +00:00
export const MockProviders = ({
children,
}: {
children: JSX.Element | JSX.Element[];
2022-10-29 23:56:58 +00:00
}) => (
2023-06-27 03:16:59 +00:00
<PaperProvider settings={{ icon: (props) => <MaterialIcon {...props} /> }}>
<ThemeContext.Provider
value={{
theme: "system",
setTheme: jest.fn(),
lightColor: DefaultTheme.colors.primary,
2023-07-15 02:38:46 +00:00
darkColor: MD3DarkTheme.colors.primary,
setLightColor: jest.fn(),
setDarkColor: jest.fn(),
2023-06-27 03:16:59 +00:00
}}
>
2022-11-01 05:30:23 +00:00
<NavigationContainer>{children}</NavigationContainer>
</ThemeContext.Provider>
</PaperProvider>
);