From 96678e0d3c03ea6f6bc9a40534c1bb732475e102 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=9D=B1=E6=BE=94?= Date: Sun, 31 Oct 2021 14:45:59 +0800 Subject: [PATCH] fix: solve sliding flicker problem --- example/src/App.tsx | 10 ---------- src/useOffsetX.ts | 4 ++-- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/example/src/App.tsx b/example/src/App.tsx index bfaf631a..35c19cb3 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -25,15 +25,10 @@ export default function App() { > - autoPlay - autoPlayInterval={2000} ref={r} width={width} data={data} parallaxScrollingScale={0.8} - onSnapToItem={(i) => { - console.log('current index:', i); - }} renderItem={(source) => ( - autoPlay - autoPlayInterval={2000} ref={r} mode="parallax" width={width} data={data} parallaxScrollingScale={0.8} - onSnapToItem={(i) => { - console.log('current index:', i); - }} renderItem={(source) => ( { return interpolate( Math.round(handlerOffsetX.value), - inputRange, - outputRange, + inputRange.map(Math.round), + outputRange.map(Math.round), Extrapolate.CLAMP ); }