@fruits-chain/react-native-xiaoshu
Version:
🌈 React Native UI library
20 lines (18 loc) • 581 B
JavaScript
import React, { useMemo, useContext, createContext, memo } from 'react';
import TOKENS from './tokens-mix';
const ThemeTokensContext = /*#__PURE__*/createContext(TOKENS);
export const useThemeTokens = () => useContext(ThemeTokensContext);
const ThemeProvider = _ref => {
let {
children,
theme
} = _ref;
const state = useMemo(() => ({ ...TOKENS,
...theme
}), [theme]);
return /*#__PURE__*/React.createElement(ThemeTokensContext.Provider, {
value: state
}, children);
};
export default /*#__PURE__*/memo(ThemeProvider);
//# sourceMappingURL=theme.js.map