react-native-skia icon indicating copy to clipboard operation
react-native-skia copied to clipboard

Animate TextPath when `usePathValue` is used

Open davidruisinger opened this issue 10 months ago • 2 comments

Description

I have an array of points where each point's x and y value is a SharedValue<number>. I use the points within usePathValue to create my path. This path is consumed by a <TextPath /> and a <Path />. When I update the path values from within my GestureDetector, the <Path /> is updated but the <TextPath /> does not seem to handle the updates. Only after updating the text property on <TextPath />, the new path is adapted.

const linePath = usePathValue((path) => {
  "worklet";
  ...
  path.cubicTo(
    points[1].x.value,
    ...
  );
  ...
});

return (
  <Group>
    <TextPath path={linePath} ... />
    <Path path={linePath} ... />
    ...
  </Group>
);

demo

davidruisinger avatar Mar 28 '24 21:03 davidruisinger

do you have standable reproducible example? This looks interesting.

wcandillon avatar Apr 03 '24 13:04 wcandillon

@wcandillon does this help? It's a super simple example without gestures, but same issue: The <TextPath /> does not re-render with an updated path from usePathValue, whereas the <Path /> component re-renders as expected.

davidruisinger avatar Apr 03 '24 18:04 davidruisinger