This repository has been archived by the owner on Oct 19, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
38 additions
and
50 deletions.
There are no files selected for viewing
50 changes: 0 additions & 50 deletions
50
.yarn/patches/@mattermost-react-native-paste-input-npm-0.6.2-e109419dfb.patch
This file was deleted.
Oops, something went wrong.
38 changes: 38 additions & 0 deletions
38
.yarn/patches/react-native-reanimated-zoom-npm-0.3.3-bbb8d84109.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
diff --git a/src/zoom.tsx b/src/zoom.tsx | ||
index 70ce1c8d6a43e711f06b93d1eda3b44a3ad9a659..cdc2713470f2d332b8bf3e9c97e38fd9b78281df 100644 | ||
--- a/src/zoom.tsx | ||
+++ b/src/zoom.tsx | ||
@@ -4,6 +4,7 @@ import Animated, { | ||
useSharedValue, | ||
useAnimatedStyle, | ||
useDerivedValue, | ||
+ withDecay, | ||
withTiming, | ||
cancelAnimation, | ||
runOnJS, | ||
@@ -120,11 +121,22 @@ export function Zoom(props: Props) { | ||
} | ||
} | ||
}) | ||
- .onEnd(() => { | ||
+ .onEnd((event) => { | ||
if (isPinching.value || !isZoomed.value) return; | ||
|
||
- panTranslateX.value = 0; | ||
- panTranslateY.value = 0; | ||
+ const maxTranslateX = (viewWidth.value / 2) * scale.value - viewWidth.value / 2; | ||
+ const minTranslateX = -maxTranslateX; | ||
+ translationX.value = withDecay({ | ||
+ velocity: event.velocityX, | ||
+ clamp: [minTranslateX, maxTranslateX] | ||
+ }); | ||
+ | ||
+ const maxTranslateY = (viewHeight.value / 2) * scale.value - viewHeight.value / 2; | ||
+ const minTranslateY = -maxTranslateY; | ||
+ translationY.value = withDecay({ | ||
+ velocity: event.velocityY, | ||
+ clamp: [minTranslateY, maxTranslateY] | ||
+ }); | ||
}); | ||
|
||
const pinch = Gesture.Pinch() |