Svg crashes App when camvas is bigger than <unknown>

  1. SDK Version: 36
  2. Platforms(Android/iOS/web/all): Android

Hi,

Is there any Expo alternatives to the existing Svg implementation?

It seems the existing one is not really vector based and draws a bitmap instead of just dealing with vectors. And that becomes a memory problem on Android (not iPhone) because of the way they implemented their memory limits by throwing an error making the app using the current Svg application crash.

The guy doing the Svg component thinks the error is drawing big Svg’s. Currently I can draw something 5 times bigger than the screen. But it is variable. Not like a fixed number of pixels or RAM being used causing the error.

Are there other options NOT drawing a bitmap on Android? Or is there any kind of willingness from the Expo team to have a fully functional Svg implementation?

I previously used WebView for making charts, but as Apple is closing that one down I’m trying to do something similar just coding it myself.

More info here:

Best,
Andy

I can’t speak for them, but I would be shocked to see dueling React Native SVG implementations. It’s a huge spec and a huge problem space managing it between two platforms. I think the maintainer’s advice is good in this scenario- the performance thresholds on Android are a good bit tighter than on iOS, especially considering the old/ lower-end hardware that’s out there in the field, so you’ll always want to minimize the rendering of complex components offscreen, SVG or otherwise.

Curious what you mean by webviews not working on iOS- I’m aware of them deprecating an older web view API, but that’s been replaced. We use WebViews and plan to do so well into the future.

1 Like

I’m still getting a notice when I upload to The Apple App Store about the deprecated WebView. That was one of the reasons for moving to Svg. I might have done something wrong. Will look into it.

The other reason is to be able to show Graphs offline. But I guess I could just render Svg inside a VebView by injecting HTML and not using Googles JavaScript Graph API as I did before. Google do not allow caching their JavaScript. And the rendering is not super nice.

I actually do think I do the right thing by rendering the full graph selected by the user. I think it works pretty well that way. It is live already. Works fine on iPhone and on Android I scaled down the size of the graph if it is too big. But I would prefer to have the graph in full size no matter what the user chooses. I will give it a try next time I come around to it.

The link is somewhere in the forums but that warning has nothing to do with react-native-webview and will be fixed in SDK 37, if not earlier. You’ll be able to keep using webviews.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.