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.

react component inside SVG

See original GitHub issue

In svg we have <ForeignObject> that can render html content inside svg. It is very useful for complex layout elements. I think in react-native we need something like <ForeignObject> that can render react components (<View>, <Text> …) inside svg.

@msand What do you think? Is it possible?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:14

github_iconTop GitHub Comments

1reaction
msandcommented, Jan 19, 2018

Fixing this would probably allow nesting Svg elements inside each other as well, which I’m not sure why it doesn’t work, haven’t investigated it properly yet. @magicismight @brentvatne @dustinsavery you have any ideas?

0reactions
msandcommented, Dec 9, 2018

Closing this, as nesting svg inside svg works, and another issue is already open for foreignObject support: https://github.com/react-native-community/react-native-svg/issues/447

Read more comments on GitHub >

github_iconTop Results From Across the Web

React component inside an SVG element - Stack Overflow
I want to embed a custom react component inside an SVG but it's not working. Is it even allowed in an SVG? if...
Read more >
How to use SVGs in React - LogRocket Blog
SVGs can be imported and used directly as a React component in your React code. The image is not loaded as a separate...
Read more >
Building SVG Components with React.js and d3.js - pganalyze
The mechanics of using SVG elements in React are straightforward: Just write a standard component and return an SVG tag instead of an...
Read more >
How to use SVGs in React | Sanity.io guide
There are a few ways to use an SVG in a React app: Use it as a regular image; Import it as a...
Read more >
React SVG: How to use SVGs best in React - CopyCat Blog
Importing SVG in React as JSX ... Another way to import SVG in react with full control of its customization is by converting...
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