react-native-unistyles
Version:
Level up your React Native StyleSheet
22 lines (21 loc) • 728 B
JavaScript
;
import * as unistyles from '../web/services';
import { checkForAnimated } from '../web/utils';
export const getClassName = (unistyle, forChild) => {
if (!unistyle) {
return undefined;
}
const flattenedStyles = Array.isArray(unistyle) ? unistyle.flat(Number.POSITIVE_INFINITY) : [unistyle];
const animatedStyles = flattenedStyles.filter(checkForAnimated);
const regularStyles = flattenedStyles.filter(style => !checkForAnimated(style));
const {
hash,
injectedClassName
} = unistyles.services.shadowRegistry.addStyles(regularStyles, forChild);
return hash ? [{
$$css: true,
hash,
injectedClassName
}, animatedStyles] : undefined;
};
//# sourceMappingURL=getClassname.js.map