UNPKG

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