Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/components/AnimatedPagedView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ type AnimatedPagedViewProps = {
children: React.ReactNode
}

// easiest way to allow other gestures to work, for example the scroll view
const MIN_DISTANCE_THRESHOLD = 30

export const AnimatedPagedView = forwardRef<AnimatedPagedScrollViewRef, AnimatedPagedViewProps>(
(props, ref) => {
const translateX = useSharedValue(0)
Expand All @@ -38,6 +41,7 @@ export const AnimatedPagedView = forwardRef<AnimatedPagedScrollViewRef, Animated
)

const gesture = Gesture.Pan()
.minDistance(MIN_DISTANCE_THRESHOLD)
.onStart(() => {
context.value = { x: translateX.value }
runOnJS(props.onScrollBeginDrag)()
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useManualScroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const useManualScroll = ({
const goToPage = useCallback(
(page: number, duration = 0, animation?: typeof DEFAULT_ANIMATION) => {
'worklet'
const to = page * slideWidth
const to = Math.round(page) * slideWidth
if (duration) {
manualScrollValue.value = {
value: animation ? animation(to, duration) : withTiming(to, { duration }),
Expand Down
Loading