Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Animate TextPath when usePathValue is used #2322

Open
davidruisinger opened this issue Mar 28, 2024 · 2 comments
Open

Animate TextPath when usePathValue is used #2322

davidruisinger opened this issue Mar 28, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@davidruisinger
Copy link

davidruisinger commented Mar 28, 2024

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 davidruisinger added the enhancement New feature or request label Mar 28, 2024
@wcandillon
Copy link
Collaborator

wcandillon commented Apr 3, 2024

do you have standable reproducible example? This looks interesting.

@davidruisinger
Copy link
Author

davidruisinger commented Apr 3, 2024

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants