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

@vx/text doesn't work with 0 as a number #813

Closed
ilariaventurini opened this issue Sep 26, 2020 · 0 comments · Fixed by #814
Closed

@vx/text doesn't work with 0 as a number #813

ilariaventurini opened this issue Sep 26, 2020 · 0 comments · Fixed by #814
Labels

Comments

@ilariaventurini
Copy link
Contributor

ilariaventurini commented Sep 26, 2020

Example:

<svg x={0} y={0} width={200} height={200}>
  {/* doesn't work */}
  <Text x={0} y={10} fill="black">
    {0}
  </Text>

  {/* works */}
  <Text x={0} y={10} fill="black">
    0
  </Text>
</svg>

The result is:

<svg x="0" y="0" width="200" height="200">
  <svg x="0" y="0" style="overflow: visible;">
    <text x="0" y="10" fill="black" text-anchor="start">
      <tspan x="0" dy="0em"></tspan> // <-- no child element
    </text>
  </svg>
  <svg x="0" y="0" style="overflow: visible;">
    <text x="0" y="10" fill="black" text-anchor="start">
      <tspan x="0" dy="0em">0</tspan>
    </text>
  </svg>
</svg>

PR #814 should fix this problem.

ilariaventurini added a commit to ilariaventurini/visx that referenced this issue Sep 26, 2020
ilariaventurini added a commit to ilariaventurini/visx that referenced this issue Oct 7, 2020
This reverts commit 9f98551.

# Conflicts:
#	packages/visx-text/src/Text.tsx
#	packages/visx-text/test/Text.test.tsx
williaster added a commit that referenced this issue Oct 8, 2020
* fix(demo/text): render 0 as number (#813)

* fix(demo/text): check improvement removing negated conditions

* fix(demo/text): use single quote to avoid prettier problem

Co-authored-by: Chris Williams <williaster@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants