question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SVG translate not working with react-native@0.30.0 react-native-svg@4.0.0-rc

See original GitHub issue

I there…

I am using react-native-svg to render charts but there seems to be problem with the svg translate attribute… as it doesn’t work.

Here is my package.json:

"react": "^15.2.0",
"react-native": "^0.29.0",
"react-native-svg": "^3.0.0"

Here is my render method:

render() {
  return (
      <View >
        <Svg height="640" width="360">
          <Circle transform="translate(200, 200)"
              cx="50"
              cy="50"
              r="45"
              stroke="blue"
              strokeWidth="2.5"
              fill="green"
          />
          <Rect translate="rotate(45)"
              x="15"
              y="15"
              width="70"
              height="70"
              stroke="red"
              strokeWidth="2"
              fill="yellow"
            />
        </Svg>
      </View>
    );
  }

I made sure everything is in place for react-native@0.29.0 in line with https://github.com/magicismight/react-native-svg/issues/50#issuecomment-222893637

And here is a screenshot: screenshot_2016-07-27-09-11-06_com getease

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5

github_iconTop GitHub Comments

11reactions
magicismightcommented, Jul 27, 2016

Thanks for reporting this. transform prop have been fixed in 4.0.0-rc. And we have changed transform prop to something like this

          <Circle
              transform={{scale:0.5,translate:'200, 200'}}
              cx="50"
              cy="50"
              r="45"
              stroke="blue"
              strokeWidth="2.5"
              fill="green"
          />

or this can do the same
          <Circle
              scale="0.5"
              translate="200, 200"
              cx="50"
              cy="50"
              r="45"
              stroke="blue"
              strokeWidth="2.5"
              fill="green"
          />
3reactions
carly-litchfield-zocdoccommented, Sep 29, 2017

I had this problem too, and using transform={{ translate:'200, 200' }} instead of transform="translate(200, 200)" fixed it 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

SVG translate not working with react-native@0.30.0 ... - GitHub
I am using react-native-svg to render charts but there seems to be problem with the svg translate attribute.. as it doesn't work.
Read more >
SVG transformation not working in Web Version of a React ...
The answer for that, after trying A LOT of stuff is that, theres a bug on the library on the transform property here:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found