From 4616336b768fe5082f7ba9ab7cde1c5b10c128f1 Mon Sep 17 00:00:00 2001 From: Szymon Rybczak Date: Thu, 1 Sep 2022 14:46:02 +0200 Subject: [PATCH] fix: move onIndexChange (#1384) --- src/PanResponderAdapter.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/PanResponderAdapter.tsx b/src/PanResponderAdapter.tsx index 3d1964a9..b99b732d 100644 --- a/src/PanResponderAdapter.tsx +++ b/src/PanResponderAdapter.tsx @@ -81,6 +81,8 @@ export default function PanResponderAdapter({ const { timing, ...transitionConfig } = DefaultTransitionSpec; + onIndexChangeRef.current(index); + Animated.parallel([ timing(panX, { ...transitionConfig, @@ -89,7 +91,6 @@ export default function PanResponderAdapter({ }), ]).start(({ finished }) => { if (finished) { - onIndexChangeRef.current(index); pendingIndexRef.current = undefined; } });