Capturing two views of different sizes fails randomly (FYI: do not use v2.5 or v2.6)
bug report
Capturing two views of different sizes at or around the same time seems to make one of the resulting images take on the dimensions of the other.
See gif below. There's an orange square view and a purple square view of different sizes. Pressing each button runs captureRef on the corresponding view and displays the generated img next to it.
Version & Platform
├── [email protected]
└── [email protected]
Platform: Android
Expected behavior
In this example, running captureRef on the orange square should always produce an image of size 131x132, and running it on the purple square should always produce 262x262.
Actual behavior
Running captureRef on the orange square sometimes uses the purple square's dimensions, if the purple square has been captured before.
Steps to reproduce the behavior
Clone this repo and run on an Android emulator (or device) to see
git clone https://github.com/m-pol/ReactNativeViewShotBug.git
cd ReactNativeViewShotBug
npm install
react-native run-android
2.4.0 doesn't seem to have the issue.
have the same problem in v2.6.0. how do you solve it?
I think the reason for this problem is cache. it's always happened in multiple captures. And two description about optimized in README. 1.reusable images, that reduce load on GC; 2.reusable arrays/buffers that also reduce load on GC;
tip: just in Android, ios is great. @gre can you help me?
@EternalChildren I just reverted to 2.4.0, which does not have the problem.
By the way, #210 is the same issue.
@gre This is a pretty serious issue; it makes the library unusable for anyone trying to use multiple ViewShots. 2.5.0 and 2.6.0 are affected.
@m-pol I have solved it. PR: #222