Display SVGs from URLs in React Native #2797
Replies: 1 comment
-
💬 ConfirmationI can confirm this issue — I’ve experienced the same behavior on a Samsung S24 Ultra (Android 16). The app crashes once around 20+ remote SVGs are rendered simultaneously in a The crash log points to 🧩 Technical AnalysisFrom what I can tell, this happens because So, when many SVGs are displayed in a list, memory usage scales linearly with the number of SVG nodes — instead of staying roughly constant as it would with rasterized images. For simple “display-only” use cases (no dynamic color or shape manipulation), it would be extremely helpful to have an option to render remote SVGs as native images — for example, by pre-rasterizing or caching them on the native side, similar to how 📱 Device Behavior Summary
💡 SuggestionWould be great to know if there are any plans for a lightweight rendering mode — e.g., a native image-based renderer for static SVGs — or if there’s a recommended caching/rasterization approach for large lists of remote SVGs. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I’m running into a performance issue when displaying multiple remote SVGs (coming as URLs from the backend) inside a FlatList. Once I load around 20+ items, the Android app crashes — likely due to how react-native-svg renders SVGs.
From what I understand, the library parses the SVG XML into a hierarchy of React Native components (Path, Rect, etc.), which are then rendered in native code. That means each SVG is not treated as a single image, but as multiple native view elements.
I’m wondering — why does the library use this approach instead of rendering the SVG directly as a native image (similar to how
handles PNGs or JPGs)?
Specifically:
Is there a technical reason we can’t just load and render the SVG as a single native image instead of parsing it into a React component tree?
Are there any plans or existing APIs in the library to support this more lightweight “native image” rendering path for remote SVGs?
Here’s a simplified example of what I’m doing:
I understand the current approach allows dynamic SVG manipulation (changing fills, strokes, etc.), but for simple “display-only” use cases, a native image rendering mode would be much more efficient — especially for lists.
Would love to know if this is by design or if there are any plans to support direct native rendering of SVGs from URLs.
Beta Was this translation helpful? Give feedback.
All reactions