@fruits-chain/react-native-xiaoshu
Version:
🌈 React Native UI library
22 lines (19 loc) • 484 B
JavaScript
const StyleMap = new Map();
export const createStyle = (componentVar, creator, tokens) => {
let myStyle;
for (let [key, value] of StyleMap) {
if (key[1] === creator) {
if (key[0] === componentVar) {
myStyle = value;
} else {
StyleMap.delete(key);
}
}
}
if (!myStyle) {
myStyle = creator(componentVar, tokens);
StyleMap.set([componentVar, creator], myStyle);
}
return myStyle;
};
//# sourceMappingURL=create-style.js.map