react-native-skia icon indicating copy to clipboard operation
react-native-skia copied to clipboard

[Android] makeImageFromView takes a snapshot of the flatlist, the result has padding on it

Open Rakha112 opened this issue 2 years ago • 3 comments

Description

Hey, When I try to take a snapshot of a View that has a Flatlist using makeImageFromView, if I scroll down the Flatlist, then take a snapshot, the result of the snapshot will have padding on it, this happens only on Android works fine on iOS. Please see the GIF below Thank You

Demo

Version

0.1.229

Steps to reproduce

  1. Clone the Repo
  2. Run The App
  3. Scroll then press the SNAPSHOT button
  4. See the snapshot result

Snack, code example, screenshot, or link to a repository

https://github.com/Rakha112/BugMakeImageFromView

Rakha112 avatar Dec 15 '23 02:12 Rakha112

Experiencing this as well

TrevPennington avatar Jan 11 '24 17:01 TrevPennington

This might be down to how a FlatList renders on React Native. It's derived from VirtualizedList, which as they say in the docs:

Virtualization massively improves memory consumption and performance of large lists by maintaining a finite render window of active items and replacing all items outside of the render window with appropriately sized blank space

louix avatar Jan 17 '24 21:01 louix

Hey @louix thank you for your explanation. So, is this the expected behavior ? And is there a workaround for it?

Rakha112 avatar Jan 18 '24 14:01 Rakha112

The underlying problem is not attributed to padding but to snapshots being captured from the top part of the FlatList, which may have already unmounted some components due to scroll offset. Should be solved by #2306

Nodonisko avatar Mar 21 '24 20:03 Nodonisko

Hey @Nodonisko, thank you for your explanation. I hope that PR will be included in the next release. Thank you very much.

Rakha112 avatar Mar 28 '24 02:03 Rakha112

Hey @Nodonisko, after updating Skia to version 1.0.5, this issue has been fixed. Thank you very much.

Rakha112 avatar Apr 03 '24 08:04 Rakha112