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

Text/TSpan setNativeProps doesn't work with x or y #1376

Closed
Taylor123 opened this issue May 11, 2020 · 2 comments
Closed

Text/TSpan setNativeProps doesn't work with x or y #1376

Taylor123 opened this issue May 11, 2020 · 2 comments
Labels

Comments

@Taylor123
Copy link

Bug

Unexpected behavior

I've tried using setNativeProps on both Text and TSpan to update the positioning of the text, but when setting x or y using setNativeProps the text disappears. Similar behavior happens when updating children of Text with a string, but a workaround for that is to and and update the children of TSpan

Environment info

Library version: 12.1.0

Short, Self Contained, Correct (Compilable), Example

Here's a snack to reproduce https://snack.expo.io/@taylor123/rnsvg-text-setnativeprops

@stale
Copy link

stale bot commented Jul 11, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You may also mark this issue as a "discussion" and I will leave this open.

@stale stale bot added the stale label Jul 11, 2020
@bohdanprog bohdanprog added bug and removed stale labels Jun 14, 2024
@bohdanprog
Copy link
Member

Hello, it seems like you attempted to change the x and y values, and as a result, it moved your component out of the viewBox. A better approach for moving elements is to use useState, react-native Animated, or react-native-reanimated. Just as a heads up, in fabric architecture, using setNativeProps can cause components to rerender. You can find more information about this in this thread.

I'm closed the issue, but if you have any other questions feel free to ask.
Thank you.

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

No branches or pull requests

2 participants