@@ -18,24 +18,14 @@ import { LineTime } from './line-time';
1818
1919
2020export type DraggableSliderProps = {
21- // Total number of lines in the slider
2221 linesAmount : number ;
23- // Maximum height of a line
2422 maxLineHeight : number ;
25- // Minimum height of a line
2623 minLineHeight : number ;
27- // Optional: Offset for determining big lines, defaults to 10
28- // That means that every 10th line will be a big line
2924 bigLineIndexOffset ?: number ;
30- // Optional: The width of each line, defaults to 1.5
3125 lineWidth ?: number ;
32- // Optional: Shared value representing the color of the indicator line
3326 indicatorColor ?: string ;
34- // Optional: The color of the lines (default is #c6c6c6)
3527 lineColor ?: string ;
36- // Optional: The color of the big lines (default is #c6c6c6)
3728 bigLineColor ?: string ;
38- // Optional: The color of the medium lines (default is #c6c6c6)
3929 mediumLineColor ?: string ;
4030 selectedDuration ?: SharedValue < number > ;
4131} ;
@@ -69,13 +59,10 @@ export const CircularDraggableSlider = forwardRef<
6959 ) => {
7060 const progress = useSharedValue ( 0 ) ;
7161 const isTimerEnabled = useSharedValue ( false ) ;
72- const distanceBetweenTwoTicksRad = ( 2 * Math . PI ) / linesAmount ;
7362 const diameter = 2 * Math . PI * radius ;
7463 const distanceBetweenTwoTicks = diameter / linesAmount ;
7564 const listWidth = diameter ;
7665
77-
78- // Offset set to 0 for 90-degree rotation (indicator at right side)
7966 const offset = 0 ;
8067 const progressRadiants = useDerivedValue ( ( ) => {
8168 return interpolate (
@@ -85,15 +72,6 @@ export const CircularDraggableSlider = forwardRef<
8572 ) ;
8673 } , [ listWidth ] ) ;
8774
88- useAnimatedReaction (
89- ( ) => progressRadiants . value ,
90- radiants => {
91- const amountOfSeconds = Math . round (
92- ( radiants - offset ) / distanceBetweenTwoTicksRad ,
93- ) ;
94- } ,
95- ) ;
96-
9775 useAnimatedReaction (
9876 ( ) => selectedDuration ?. value ?? null ,
9977 duration => {
@@ -122,7 +100,7 @@ export const CircularDraggableSlider = forwardRef<
122100 {
123101 height : radius * 2 ,
124102 width : radius * 2 ,
125- right : 50 ,
103+ right : 60 ,
126104 transform : [
127105 {
128106 translateY : WindowHeight / 2 - radius - 36 ,
@@ -134,17 +112,10 @@ export const CircularDraggableSlider = forwardRef<
134112 < Animated . View pointerEvents = "none" >
135113
136114 { new Array ( linesAmount ) . fill ( 0 ) . map ( ( _ , index ) => {
137- // Determine line type based on position
138115 const isBigLine = index % bigLineIndexOffset === 0 ;
139-
140- // Calculate the midpoint between consecutive big lines
141116 const midpointOffset = bigLineIndexOffset / 2 ;
142117 const isMediumLine = ! isBigLine && index % bigLineIndexOffset === midpointOffset ;
143-
144- // Calculate medium line height as the average of max and min
145118 const mediumLineHeight = ( maxLineHeight + minLineHeight ) / 2 ;
146-
147- // Determine height based on line type
148119 let height : number ;
149120 let color : string ;
150121
@@ -193,21 +164,20 @@ export const CircularDraggableSlider = forwardRef<
193164 } ) }
194165 </ Animated . View >
195166 < LinearGradient
196- // Background Linear Gradient
197- colors = { [ 'rgba(0,0,0,1)' , 'rgba(0,0,0,0.9)' , 'transparent' ] }
167+ colors = { [ '#000000' , '#000000' , '#000000' , '#00000070' , 'transparent' ] }
198168 start = { {
199169 x : 0 ,
200170 y : 0
201171 } }
202172 end = { {
203- x : 1 ,
173+ x : 1.1 ,
204174 y : 0
205175 } }
206176 style = { {
207177 position : 'absolute' ,
208178 height : radius * 2 + 94 ,
209- width : radius + 20 ,
210- left : - 30 ,
179+ width : radius * 2 + 94 ,
180+ left : - 220 ,
211181 top : - ( WindowHeight / 2 - radius + 8 ) ,
212182 // backgroundColor: 'red',
213183 borderRadius : 1000
@@ -284,11 +254,11 @@ const styles = StyleSheet.create({
284254 height : LABEL_HEIGHT ,
285255 alignItems : 'center' ,
286256 justifyContent : 'center' ,
257+ left : 10
287258 } ,
288259 hourLabelText : {
289260 color : '#d8d8d8' ,
290261 fontFamily : 'SF-Pro-Rounded-Bold' ,
291262 fontSize : 20 ,
292- left : 10
293263 } ,
294264} ) ;
0 commit comments