import React from 'react'; import hoistNonReactStatics from 'hoist-non-react-statics'; import { TNavigationOptions } from './definitions/navigationTypes'; import { IThemePreference } from './definitions/ITheme'; interface IThemeContextProps { theme: string; themePreferences?: IThemePreference; setTheme?: (newTheme?: {}) => void; } export const ThemeContext = React.createContext({ theme: 'light' }); export function withTheme(Component: React.ComponentType & TNavigationOptions): typeof Component { const ThemedComponent = (props: T) => ( {contexts => } ); hoistNonReactStatics(ThemedComponent, Component); return ThemedComponent; } export const useTheme = (): IThemeContextProps => React.useContext(ThemeContext);