Open doublelam opened 1 month ago
@doublelam Use sharedValue if you don't want to rerender entire screen:
const currentPath = useSharedValue(Skia.Path.Make());
const panGesture = useMemo(
() =>
Gesture.Pan()
.onBegin(e => {
'worklet';
currentPath.modify((v) => {
const coords = getRelativeCoords(viewRef as any, e.absoluteX, e.absoluteY);
v.lineTo(coords.x || 0, coords.y || 0);
return v;
});
})
.onUpdate(e => {
'worklet';
const coords = getRelativeCoords(viewRef as any, e.absoluteX, e.absoluteY);
currentPath.modify((v) => {
const coords = getRelativeCoords(viewRef as any, e.absoluteX, e.absoluteY);
v.lineTo(coords.x || 0, coords.y || 0);
return v;
});
})
[],
);
..... // next code stays same
@wcandillon issue can be closed
Ok now it works, but I need to use derived value or it does not work
const derived = useDerivedValue(() => {
return pathSharedVal.value.toSVGString()
});
Thank you!
Description
it doesn't work. how can I change Path without rerendering?
Version
1.3.11
Steps to reproduce
Above code
Snack, code example, screenshot, or link to a repository
no