react-native-elements
Version:
React Native Elements & UI Toolkit
12 lines (11 loc) • 405 B
JavaScript
import { useContext } from 'react';
import { StyleSheet } from 'react-native';
import { ThemeContext } from './ThemeProvider';
export const useTheme = () => {
return useContext(ThemeContext);
};
export const makeStyles = (styles) => (props = {}) => {
const { theme } = useTheme();
const css = typeof styles === 'function' ? styles(theme, props) : styles;
return StyleSheet.create(css);
};