UNPKG

reanimated-color-picker

Version:
32 lines (31 loc) 1.11 kB
import React from 'react'; import Animated, { useAnimatedStyle } from 'react-native-reanimated'; import { styles } from '../../../styles'; import { enableAndroidHardwareTextures, getStyle } from '../../../utils'; export default function Rect({ width, height, adaptiveColor, thumbAnimatedStyle, innerStyle, style, vertical, solidColor }) { const computedStyle = { width, height, }; const pillStyle = { borderWidth: 1, width: vertical ? '100%' : 14, height: vertical ? 14 : '100%', }; const borderColor = getStyle(innerStyle, 'borderColor'); const adaptiveColorStyle = useAnimatedStyle(() => { return { borderColor: borderColor ?? adaptiveColor.value, }; }, [borderColor, adaptiveColor]); return /*#__PURE__*/ React.createElement( Animated.View, { style: [styles.handle, style, computedStyle, thumbAnimatedStyle], renderToHardwareTextureAndroid: enableAndroidHardwareTextures, }, /*#__PURE__*/ React.createElement(Animated.View, { style: [pillStyle, styles.shadow, adaptiveColorStyle, solidColor, innerStyle], }), ); }