-
Notifications
You must be signed in to change notification settings - Fork 67
Open
Description
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
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
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)
Metadata
Metadata
Assignees
Labels
No labels