@@ -10,8 +10,7 @@ import Animated, {
1010 useAnimatedReaction ,
1111 useAnimatedStyle ,
1212 useDerivedValue ,
13- useSharedValue ,
14- withTiming ,
13+ useSharedValue
1514} from 'react-native-reanimated' ;
1615
1716import { LineTime } from './line-time' ;
@@ -73,33 +72,7 @@ export const CircularDraggableSlider = forwardRef<
7372 ) ;
7473 } , [ listWidth ] ) ;
7574
76- const overlayStyle = useAnimatedStyle ( ( ) => {
77- const angleStep = ( 2 * Math . PI ) / linesAmount ;
78- const hourIndexRatio = progressRadiants . value / ( angleStep * bigLineIndexOffset ) ;
79- const boundedHourIndex = Math . max (
80- 1 ,
81- Math . min ( HOUR_LABELS_AMOUNT , Math . round ( hourIndexRatio ) ) ,
82- ) ;
83- const requestedTickIndex = boundedHourIndex * bigLineIndexOffset ;
84- if ( requestedTickIndex > linesAmount ) {
85- return { opacity : 0 } ;
86- }
87-
88- const targetTickIndex = Math . min ( linesAmount - 1 , requestedTickIndex ) ;
89- const labelRadius = radius + LABEL_RADIUS_OFFSET ;
90- const angle = angleStep * targetTickIndex - progressRadiants . value ;
91- const x = Math . cos ( angle ) * labelRadius ;
92- const y = Math . sin ( angle ) * labelRadius ;
93-
94- return {
95- opacity : 1 ,
96- transform : [
97- { translateX : x - LABEL_WIDTH / 2 } ,
98- { translateY : y - LABEL_HEIGHT / 2 } ,
99- ] ,
100- } ;
101- } , [ bigLineIndexOffset , linesAmount , radius ] ) ;
102-
75+
10376 useAnimatedReaction (
10477 ( ) => selectedDuration ?. value ?? null ,
10578 duration => {
@@ -115,7 +88,8 @@ export const CircularDraggableSlider = forwardRef<
11588 const targetProgress = - distanceBetweenTwoTicks * targetIndex ;
11689
11790 cancelAnimation ( progress ) ;
118- progress . value = withTiming ( targetProgress , { duration : 250 } ) ;
91+ // Use immediate update for real-time synchronization during scroll
92+ progress . value = targetProgress ;
11993 } ,
12094 [ bigLineIndexOffset , distanceBetweenTwoTicks , selectedDuration ] ,
12195 ) ;
@@ -190,26 +164,6 @@ export const CircularDraggableSlider = forwardRef<
190164 />
191165 ) ;
192166 } ) }
193- < Animated . View
194- pointerEvents = "none"
195- style = { [ styles . hourLabelOverlay , overlayStyle ] }
196- >
197- < LinearGradient
198- start = { {
199- x : 0 ,
200- y : 0
201- } }
202- end = { {
203- x : 0 ,
204- y : 1
205- } }
206- colors = { [ 'transparent' , '#00000080' , '#000000' , '#000000' , '#000000' , '#00000080' , 'transparent' ] }
207- style = { {
208- height : "100%" ,
209- width : "100%" ,
210- } }
211- />
212- </ Animated . View >
213167 </ Animated . View >
214168 < LinearGradient
215169 colors = { [ '#000000' , '#000000' , '#000000' , '#00000070' , 'transparent' ] }
@@ -308,7 +262,7 @@ const styles = StyleSheet.create({
308262 position : 'absolute' ,
309263 width : LABEL_WIDTH ,
310264 height : LABEL_HEIGHT ,
311- backgroundColor : '#000 ' ,
265+ // backgroundColor: 'red ',
312266 borderRadius : LABEL_HEIGHT / 2 ,
313267 zIndex : 1 ,
314268 left : 10 ,
0 commit comments