UNPKG

react-native-reanimated

Version:

More powerful alternative to Animated library for React Native.

39 lines (36 loc) • 1.06 kB
'use strict'; export const ERROR_MESSAGES = { unsupportedVerticalAlign(value) { 'worklet'; return `Unsupported verticalAlign: ${value}. Expected one of: auto, top, bottom, middle.`; } }; const VERTICAL_ALIGN_TO_TEXT_ALIGN_VERTICAL = { auto: 'auto', top: 'top', bottom: 'bottom', middle: 'center' }; const TEXT_ALIGN_VERTICAL_TO_VERTICAL_ALIGN = { auto: 'auto', top: 'top', bottom: 'bottom', center: 'middle' }; export const processVerticalAlign = value => { 'worklet'; if (!Object.prototype.hasOwnProperty.call(VERTICAL_ALIGN_TO_TEXT_ALIGN_VERTICAL, value)) { throw new Error(`[Reanimated] ${ERROR_MESSAGES.unsupportedVerticalAlign(value)}`); } return { textAlignVertical: VERTICAL_ALIGN_TO_TEXT_ALIGN_VERTICAL[value] }; }; export function unprocessVerticalAlign(props) { const verticalAlign = TEXT_ALIGN_VERTICAL_TO_VERTICAL_ALIGN[props.textAlignVertical]; if (verticalAlign !== undefined) { // @ts-ignore props is readonly props.verticalAlign = verticalAlign; } } //# sourceMappingURL=text.js.map