Move the theme object to be inline for mock-providers

This way we get better auto completion
This commit is contained in:
Brandon Presley 2023-01-01 14:19:15 +13:00
parent 21773e3b4f
commit 13e1d4cc21
1 changed files with 9 additions and 10 deletions

View File

@ -8,22 +8,21 @@ import {
import MaterialIcon from 'react-native-vector-icons/MaterialIcons' import MaterialIcon from 'react-native-vector-icons/MaterialIcons'
import {ThemeContext} from './use-theme' import {ThemeContext} from './use-theme'
export const theme = {
theme: 'system',
setTheme: jest.fn(),
lightColor: DefaultTheme.colors.primary,
darkColor: DarkTheme.colors.primary,
setLightColor: jest.fn(),
setDarkColor: jest.fn(),
}
export const MockProviders = ({ export const MockProviders = ({
children, children,
}: { }: {
children: JSX.Element | JSX.Element[] children: JSX.Element | JSX.Element[]
}) => ( }) => (
<PaperProvider settings={{icon: props => <MaterialIcon {...props} />}}> <PaperProvider settings={{icon: props => <MaterialIcon {...props} />}}>
<ThemeContext.Provider value={theme}> <ThemeContext.Provider
value={{
theme: 'system',
setTheme: jest.fn(),
lightColor: DefaultTheme.colors.primary,
darkColor: DarkTheme.colors.primary,
setLightColor: jest.fn(),
setDarkColor: jest.fn(),
}}>
<NavigationContainer>{children}</NavigationContainer> <NavigationContainer>{children}</NavigationContainer>
</ThemeContext.Provider> </ThemeContext.Provider>
</PaperProvider> </PaperProvider>