reanimated-color-picker
Version:
A Pure JavaScript Color Picker for React Native
42 lines (41 loc) • 1.12 kB
JavaScript
import React from 'react';
import Animated, { useAnimatedStyle } from 'react-native-reanimated';
import { styles } from '../../../styles';
import { enableAndroidHardwareTextures, getStyle } from '../../../utils';
export default function Circle({
width,
height,
borderRadius,
adaptiveColor,
thumbAnimatedStyle,
innerStyle,
solidColor,
style,
}) {
const computedStyle = {
width,
height,
};
const circleStyle = {
borderRadius,
borderWidth: 1,
width: '100%',
height: '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: [circleStyle, styles.shadow, adaptiveColorStyle, solidColor, innerStyle],
}),
);
}