rn-custom-style-sheet
Version:
React Native component to select a specific value from a range of values.
34 lines • 734 B
JavaScript
import hyphenate from 'hyphenate-style-name';
import { MediaQueryProps } from '../../Components';
function negate(cond) {
return `not ${cond}`;
}
function keyVal(k, v) {
const realKey = hyphenate(k);
// px shorthand
if (typeof v === 'number') {
v = `${v}px`;
}
if (v === true) {
return realKey;
}
if (v === false) {
return negate(realKey);
}
return `(${realKey}: ${v})`;
}
function join(conditions) {
return conditions.join(' and ');
}
function toQuery(obj) {
const rules = [];
Object.keys(MediaQueryProps.all).forEach(k => {
const v = obj[k];
if (v != null) {
rules.push(keyVal(k, v));
}
});
return join(rules);
}
export default toQuery;
//# sourceMappingURL=ToQuery.js.map