Capturing two views of different sizes fails randomly (FYI: do not use v2.5 or v2.6)
See original GitHub issuebug 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
├── react-native@0.59.8
└── react-native-view-shot@2.6.0
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
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top GitHub Comments
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?
@m-pol I have solved it. PR: #222