Fixes to navigation swipes (#129)

* Nav swipe: increase the distance traveled in response to gesture movement.

This causes swipes to feel faster and more responsive.

* Fix: fully clamp the swipe against the edge

* Improve the performance of swipes by skipping the interaction manager
This commit is contained in:
Paul Frazee
2023-02-01 11:13:28 -06:00
committed by GitHub
parent ae6b5f0d20
commit 7b802da7b5
2 changed files with 4 additions and 1 deletions
+3
View File
@@ -90,6 +90,7 @@ export function HorzSwipe({
// swiping right // swiping right
(diffX < 0 && !canSwipeRight) (diffX < 0 && !canSwipeRight)
) { ) {
panX.setValue(0)
return return
} }
@@ -119,6 +120,7 @@ export function HorzSwipe({
toValue: final, toValue: final,
duration: 100, duration: 100,
useNativeDriver, useNativeDriver,
isInteraction: false,
}).start(() => { }).start(() => {
onSwipeEnd?.(final) onSwipeEnd?.(final)
panX.flattenOffset() panX.flattenOffset()
@@ -130,6 +132,7 @@ export function HorzSwipe({
toValue: 0, toValue: 0,
duration: 100, duration: 100,
useNativeDriver, useNativeDriver,
isInteraction: false,
}).start(() => { }).start(() => {
panX.flattenOffset() panX.flattenOffset()
panX.setValue(0) panX.setValue(0)
+1 -1
View File
@@ -353,7 +353,7 @@ export const MobileShell: React.FC = observer(() => {
/> />
<View style={[styles.innerContainer, {paddingTop: safeAreaInsets.top}]}> <View style={[styles.innerContainer, {paddingTop: safeAreaInsets.top}]}>
<HorzSwipe <HorzSwipe
distThresholdDivisor={1.5} distThresholdDivisor={2.5}
useNativeDriver useNativeDriver
panX={swipeGestureInterp} panX={swipeGestureInterp}
swipeEnabled swipeEnabled