twrnc
Version:
simple, expressive API for tailwindcss + react-native
46 lines (45 loc) • 1.48 kB
JavaScript
import { complete, parseStyleVal, parseUnconfigged } from '../helpers';
const ALLOWED_STYLE_VALUES = [`dotted`, `dashed`];
export function outlineStyle(value) {
if (!ALLOWED_STYLE_VALUES.includes(value))
return null;
return complete({
outlineStyle: value,
});
}
export function outlineWidth(value, config) {
const configValue = config === null || config === void 0 ? void 0 : config[value];
if (configValue) {
const parsedConfigValue = parseStyleVal(configValue);
if (parsedConfigValue !== null) {
return complete({
outlineWidth: parsedConfigValue,
});
}
}
const parsedValue = parseUnconfigged(value);
if (parsedValue !== null) {
return complete({
outlineWidth: parsedValue,
});
}
return null;
}
export function outlineOffset(value, isNegative, config) {
const configValue = config === null || config === void 0 ? void 0 : config[value];
if (configValue) {
const parsedConfigValue = parseStyleVal(configValue);
if (parsedConfigValue !== null) {
return complete({
outlineOffset: isNegative ? -parsedConfigValue : parsedConfigValue,
});
}
}
const parsedValue = parseUnconfigged(value);
if (parsedValue !== null) {
return complete({
outlineOffset: isNegative ? -parsedValue : parsedValue,
});
}
return null;
}