Massive/mock-providers.tsx

31 lines
852 B
TypeScript
Raw Normal View History

2023-06-27 03:16:59 +00:00
import { NavigationContainer } from '@react-navigation/native'
2022-10-31 04:22:08 +00:00
import React from 'react'
2022-11-26 01:20:18 +00:00
import {
DarkTheme,
DefaultTheme,
Provider as PaperProvider,
} from 'react-native-paper'
2022-10-31 04:22:08 +00:00
import MaterialIcon from 'react-native-vector-icons/MaterialIcons'
2023-06-27 03:16:59 +00:00
import { ThemeContext } from './use-theme'
2022-10-29 23:56:58 +00:00
export const MockProviders = ({
children,
}: {
2022-10-31 04:22:08 +00:00
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,
darkColor: DarkTheme.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>
2022-10-31 04:22:08 +00:00
)