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.

parity with web svg and usage with React Native Web

See original GitHub issue

Hey everyone, I’m working on a React Native Web project and am porting various vectors I made in React Native using this package to React Native Web, and the thing is my simple vectors almost port perfectly.

What I first did was create a package that renames standard HTML components provided by React to uppercaseFirst versions, eg:

export const Svg = 'svg';
export const Circle = 'circle';
export const Path = 'path';

So, as I said, my vectors are pretty simple. The first challenge I ran into was that instead of scale={1.5} it needs to be transform="scale(1.5)", which is exceedingly small of a an interface change. So I’m wondering why react-native-svg didn’t try to preserve the web’s interface? And, if there are any attempts to do so or what hurdles people see in making it happen??

For my small svgs, I can pretty much wrap react-native-svg and give it the same interface as you have in the web. Given the large number of properties, I’m assuming at some point, achieving feature parity becomes burdensome. I’m wondering if anyone has gone this route or thought about this and where the breakdown is? From where I’m currently standing it seems like an achievable goal and one that should happen, whether in this package or another.

Issue Analytics

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

github_iconTop GitHub Comments

10reactions
3rd-Edencommented, Mar 16, 2017

https://github.com/godaddy/svgs

It’s a project I wrote to work around this limitation. It uses the same syntax for syntax that react-native-svg uses for web. This allows you to use one module (in this case svgs) for both react and react-native based svgs.

0reactions
msandcommented, Feb 11, 2018

It now supports the transform attributes and is much more spec conformant. But there are lots of features in the spec, with varying support in the ever-green browsers, but missing from react-native-svg still. PRs very welcome 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

parity with web svg and usage with React Native Web #155
Hey everyone, I'm working on a React Native Web project and am porting various vectors I made in React Native using this package...
Read more >
React Native Web Storybook | by Danny Williams
Storybook is a UI development workshop for components and pages. You can develop components in isolation, run visual tests and more.
Read more >
Scaling SVG loaded from the web in React Native?
I managed to solve my issue by modifying all the svgs using the following script I cobbled together. const fs = require("fs"); const...
Read more >
Getting started with React - Learn web development | MDN
For instance, React Native can be used to build mobile applications. To build for the web, developers use React in tandem with ReactDOM....
Read more >
Performance Overview - React Native
A compelling reason for using React Native instead of WebView-based tools is to achieve 60 frames per second and a native look and...
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