-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Out of Memory exception in android #926
Comments
What width and height values do you give your Svg element? I suspect it might be too big to fit in memory. |
@msand thanks for the response. as i need a scrollbar, the width increases dynamically. after increasing width thrice app is crashing. for getting scrollbars, i am giving more width and overflow scroll to get a scrollbar. is that the right approach, kindly suggest. |
I would recommend striving to have the svg width and height to be at most as big as the native screen resolution on the device, and transform the content in response to pan/touch. Or, you might have use for what I've suggested here: #573 (comment) and the excellent videos made by @wcandillon https://www.youtube.com/watch?v=KrsBXKr6gdg The technique boils down to using absolute positioning, to place a scrollview above the svg content that covers it completely, and placing an empty view inside the scrollview with the size set to the amount of overscroll you want available for scrolling in different directions. Finally, connecting the scroll events to transform the svg content below. Alternatively, you can use something like https://www.npmjs.com/package/zoomable-svg If you allow your svg root size to grow, it'll keep eating more memory and make rendering slower as it needs to paint more pixels. So I would avoid having large bitmaps, unless the content is static and only needs to be rendered once and also fits in memory safely. In that case it can be the best performing way, as the scrolling merely needs to transform the bitmap around, rather than render vector graphics for each frame. |
getting the below exception when trying to do a swipe and load some more data in to the svg
I have a bar graph with timeline, on swipe i am adding some more bars(Rects). after approx. 52 Rects app is crashing with the above exception. tried profiling in android studio. approx. after storage reaches 250 MB app is getting crashed.
React Native Info:
react-native-cli: 2.0.1
react-native-svg: latest version
how to manage to load more data in react native svg? Any help would be highly appreciated.
on a separate note, here is what i am facing issue with
The text was updated successfully, but these errors were encountered: