@@ -10,12 +10,11 @@ import {
1010 useValue ,
1111 useComputedValue ,
1212 vec ,
13- Circle ,
1413 Group ,
15- Shadow ,
1614 PathCommand ,
1715} from '@shopify/react-native-skia'
1816import type { AnimatedLineGraphProps } from './LineGraphProps'
17+ import { SelectionDot as DefaultSelectionDot } from './SelectionDot'
1918import { createGraphPath } from './CreateGraphPath'
2019import Reanimated , {
2120 runOnJS ,
@@ -38,9 +37,9 @@ export function AnimatedLineGraph({
3837 onPointSelected,
3938 onGestureStart,
4039 onGestureEnd,
40+ SelectionDot = DefaultSelectionDot ,
4141 TopAxisLabel,
4242 BottomAxisLabel,
43- selectionDotShadowColor,
4443 ...props
4544} : AnimatedLineGraphProps ) : React . ReactElement {
4645 const [ width , setWidth ] = useState ( 0 )
@@ -163,11 +162,6 @@ export function AnimatedLineGraph({
163162 const circleX = useValue ( 0 )
164163 const circleY = useValue ( 0 )
165164 const pathEnd = useValue ( 0 )
166- const circleRadius = useValue ( 0 )
167- const circleStrokeRadius = useComputedValue (
168- ( ) => circleRadius . current * 6 ,
169- [ circleRadius ]
170- )
171165
172166 const setFingerX = useCallback (
173167 ( fingerX : number ) => {
@@ -188,18 +182,11 @@ export function AnimatedLineGraph({
188182 )
189183 const setIsActive = useCallback (
190184 ( active : boolean ) => {
191- runSpring ( circleRadius , active ? 5 : 0 , {
192- mass : 1 ,
193- stiffness : 1000 ,
194- damping : 50 ,
195- velocity : 0 ,
196- } )
197185 if ( ! active ) pathEnd . current = 1
198-
199186 if ( active ) onGestureStart ?.( )
200187 else onGestureEnd ?.( )
201188 } ,
202- [ circleRadius , onGestureEnd , onGestureStart , pathEnd ]
189+ [ onGestureEnd , onGestureStart , pathEnd ]
203190 )
204191 useAnimatedReaction (
205192 ( ) => x . value ,
@@ -260,24 +247,14 @@ export function AnimatedLineGraph({
260247 </ Path >
261248 </ Group >
262249
263- { enablePanGesture && (
264- < Group >
265- < Circle
266- opacity = { 0.05 }
267- cx = { circleX }
268- cy = { circleY }
269- r = { circleStrokeRadius }
270- color = { selectionDotShadowColor }
271- />
272- < Circle
273- cx = { circleX }
274- cy = { circleY }
275- r = { circleRadius }
276- color = { color }
277- >
278- < Shadow dx = { 0 } dy = { 0 } color = "rgba(0,0,0,0.5)" blur = { 4 } />
279- </ Circle >
280- </ Group >
250+ { SelectionDot != null && (
251+ < SelectionDot
252+ isActive = { isActive }
253+ color = { color }
254+ lineThickness = { lineThickness }
255+ circleX = { circleX }
256+ circleY = { circleY }
257+ />
281258 ) }
282259 </ Canvas >
283260 </ View >
0 commit comments