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

Unable to trim white spaces with <Transform/> #665

Open
alexgorbatchev opened this issue Jun 27, 2024 · 0 comments
Open

Unable to trim white spaces with <Transform/> #665

alexgorbatchev opened this issue Jun 27, 2024 · 0 comments

Comments

@alexgorbatchev
Copy link

alexgorbatchev commented Jun 27, 2024

I'm trying to display multiple lines of text so that when they wrap, there's no leading white space. I don't fully understand why this doesn't work:

<Transform transform={(str) => str.trim()}>
  <Text color="white">{text}</Text>
</Transform>

If I add - in front of str.trim(), I see the dash. If I return hello from the transformer, I see hello for each line. But for whatever reason, removing leading white space doesn't have any effect. .trim() and .replace(/^\s*) don't have any effect.

As far as I understand, .trim() supposed to work with unicode white spaces as well, so I don't understand why this wouldn't work. What am I doing wrong?

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

No branches or pull requests

1 participant