@@ -8,7 +8,7 @@ import Svg, {
88 Color ,
99 NumberProp ,
1010} from 'react-native-svg' ;
11- import { View , Platform } from 'react-native' ;
11+ import { View , Platform , StyleSheet } from 'react-native' ;
1212import type { RadialSliderProps } from './types' ;
1313import { styles } from './styles' ;
1414import { Colors } from '../../theme' ;
@@ -44,6 +44,8 @@ const RadialSlider = (props: RadialSliderProps & typeof defaultProps) => {
4444 isHideTailText,
4545 isHideButtons,
4646 isHideLines,
47+ leftIconStyle,
48+ rightIconStyle,
4749 } = props ;
4850
4951 const { panResponder, value, setValue, curPoint, currentRadian } =
@@ -55,12 +57,25 @@ const RadialSlider = (props: RadialSliderProps & typeof defaultProps) => {
5557 startPoint,
5658 endPoint,
5759 startRadian,
58- leftButtonStyle,
59- rightButtonStyle,
6060 radianValue,
6161 isRadialCircleVariant,
62+ centerValue,
6263 } = useRadialSlider ( props ) ;
6364
65+ const leftButtonStyle = StyleSheet . flatten ( [
66+ leftIconStyle ,
67+ ( disabled || min === value ) && {
68+ opacity : 0.5 ,
69+ } ,
70+ ] ) ;
71+
72+ const rightButtonStyle = StyleSheet . flatten ( [
73+ rightIconStyle ,
74+ ( disabled || max === value ) && {
75+ opacity : 0.5 ,
76+ } ,
77+ ] ) ;
78+
6479 const onLayout = ( ) => {
6580 const ref = containerRef . current as any ;
6681 if ( ref ) {
@@ -76,6 +91,14 @@ const RadialSlider = (props: RadialSliderProps & typeof defaultProps) => {
7691 }
7792 } ;
7893
94+ const circleXPosition = isRadialCircleVariant
95+ ? centerValue < value
96+ ? - 7
97+ : 4
98+ : 0 ;
99+
100+ const strokeLinecap = isRadialCircleVariant ? 'square' : 'round' ;
101+
79102 return (
80103 < View
81104 onLayout = { onLayout }
@@ -112,7 +135,7 @@ const RadialSlider = (props: RadialSliderProps & typeof defaultProps) => {
112135 strokeWidth = { sliderWidth }
113136 stroke = { sliderTrackColor }
114137 fill = "none"
115- strokeLinecap = "round"
138+ strokeLinecap = { strokeLinecap }
116139 d = { `M${ startPoint . x } ,${ startPoint . y } A ${ radius } ,${ radius } ,0,${
117140 startRadian - radianValue >= Math . PI ? '1' : '0'
118141 } ,1,${ endPoint . x } ,${ endPoint . y } `}
@@ -121,13 +144,13 @@ const RadialSlider = (props: RadialSliderProps & typeof defaultProps) => {
121144 strokeWidth = { sliderWidth }
122145 stroke = "url(#gradient)"
123146 fill = "none"
124- strokeLinecap = "round"
147+ strokeLinecap = { strokeLinecap }
125148 d = { `M${ startPoint . x } ,${ startPoint . y } A ${ radius } ,${ radius } ,0,${
126149 startRadian - currentRadian >= Math . PI ? '1' : '0'
127150 } ,1,${ curPoint . x } ,${ curPoint . y } `}
128151 />
129152 < Circle
130- cx = { curPoint . x }
153+ cx = { curPoint . x + circleXPosition }
131154 cy = { curPoint . y }
132155 r = { thumbRadius }
133156 fill = { thumbColor || thumbBorderColor }
0 commit comments