go back gesture, tweak header copy

This commit is contained in:
Hailey
2024-06-22 13:15:40 -07:00
parent 0a0c738790
commit 48ef612c4c
6 changed files with 214 additions and 143 deletions
@@ -0,0 +1,28 @@
import React from 'react'
import {Gesture, GestureDetector} from 'react-native-gesture-handler'
import {runOnJS} from 'react-native-reanimated'
export function BackGestureDetector({
onBack,
children,
}: {
onBack: () => void
children: React.ReactNode
}) {
const swipeGesture = Gesture.Pan()
.maxPointers(1)
.onEnd(({translationX, translationY, velocityX}) => {
if (
// Make sure it isn't a scrollview
translationX > translationY &&
translationY <= 10 &&
translationX >= 25 &&
// Shouldn't be a really slow swipe
velocityX >= 300
) {
runOnJS(onBack)()
}
})
return <GestureDetector gesture={swipeGesture}>{children}</GestureDetector>
}
@@ -0,0 +1,11 @@
import React from 'react'
export function BackGestureDetector({
onBack: _onBack,
children,
}: {
onBack: () => void
children: React.ReactNode
}) {
return children
}