Problem
We’re rendering SVGs using react-native-svg library which is not intended for displaying static images from web or assets. It affects our performance hugely, as rendering big SVGs might take a long time - for BackkgroundImage on Android debug build I’ve seen times like 380ms on pretty powerful Pixel 7
Solution
We should display all SVG images on UI thread using native libraries.
Currently, we have react-native-fast-image in place for displaying PNGs. Unfortunately it does not support SVGs.
We could either migrate to another image library (like expo-image) or add SVG support for react-native-fast-image
For the sake of benchmarking, adding basic support for SVGs in react-native-fast-image on android and comparing its performance to react-native-svg shows HUGE results!
For smaller SVGs, namely for Icons on Settings page (which are mostly one path) it also reduces render time hugely, but since base time is small (2-4 ms) it’s not that huge of a deal.
Problem
We’re rendering SVGs using react-native-svg library which is not intended for displaying static images from web or assets. It affects our performance hugely, as rendering big SVGs might take a long time - for BackkgroundImage on Android debug build I’ve seen times like 380ms on pretty powerful Pixel 7
Solution
We should display all SVG images on UI thread using native libraries.
Currently, we have react-native-fast-image in place for displaying PNGs. Unfortunately it does not support SVGs.
We could either migrate to another image library (like expo-image) or add SVG support for react-native-fast-image
For the sake of benchmarking, adding basic support for SVGs in react-native-fast-image on android and comparing its performance to react-native-svg shows HUGE results!
For smaller SVGs, namely for Icons on Settings page (which are mostly one path) it also reduces render time hugely, but since base time is small (2-4 ms) it’s not that huge of a deal.