1 | import { useContext } from 'react';
|
2 | import { StyleSheet } from 'react-native';
|
3 | import { ThemeContext } from './ThemeProvider';
|
4 | export const useTheme = () => {
|
5 | return useContext(ThemeContext);
|
6 | };
|
7 | export const makeStyles = (styles) => (props = {}) => {
|
8 | const { theme } = useTheme();
|
9 | const css = typeof styles === 'function' ? styles(theme, props) : styles;
|
10 | return StyleSheet.create(css);
|
11 | };
|