Open arslc opened 1 month ago
Hello, can anyone create PR with this changes?
https://github.com/pavelbabenko/react-native-awesome-gallery/blob/main/src/index.tsx?plain=1#L236
Original code has problem this performance (update every image even if they are already set to their target values)
Hello, can anyone create PR with this changes?
https://github.com/pavelbabenko/react-native-awesome-gallery/blob/main/src/index.tsx?plain=1#L236
Original
```js const resetValues = (animated = true) => { 'worklet'; scale.value = animated ? withTiming(1) : 1; offset.x.value = animated ? withTiming(0) : 0; offset.y.value = animated ? withTiming(0) : 0; translation.x.value = animated ? withTiming(0) : 0; translation.y.value = animated ? withTiming(0) : 0; }; ```Modified
```js const resetValues = (animated = true) => { 'worklet'; const resetProperty = (prop, target) => { if (prop.value !== target) prop.value = animated ? withTiming(target) : target; }; resetProperty(scale, 1); resetProperty(offset.x, 0); resetProperty(offset.y, 0); resetProperty(translation.x, 0); resetProperty(translation.y, 0); }; ```Original code has problem this performance (update every image even if they are already set to their target values)