Skip to content

Commit 96678e0

Browse files
committed
fix: solve sliding flicker problem
1 parent 11b39b1 commit 96678e0

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

example/src/App.tsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,10 @@ export default function App() {
2525
>
2626
<View style={{ height: 300 }}>
2727
<Carousel<ImageSourcePropType>
28-
autoPlay
29-
autoPlayInterval={2000}
3028
ref={r}
3129
width={width}
3230
data={data}
3331
parallaxScrollingScale={0.8}
34-
onSnapToItem={(i) => {
35-
console.log('current index:', i);
36-
}}
3732
renderItem={(source) => (
3833
<View style={{ flex: 1 }}>
3934
<Image
@@ -46,16 +41,11 @@ export default function App() {
4641
</View>
4742
<View style={{ height: 300 }}>
4843
<Carousel<ImageSourcePropType>
49-
autoPlay
50-
autoPlayInterval={2000}
5144
ref={r}
5245
mode="parallax"
5346
width={width}
5447
data={data}
5548
parallaxScrollingScale={0.8}
56-
onSnapToItem={(i) => {
57-
console.log('current index:', i);
58-
}}
5949
renderItem={(source) => (
6050
<View style={{ flex: 1 }}>
6151
<Image

src/useOffsetX.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ export const useOffsetX = (opts: IOpts) => {
4848

4949
return interpolate(
5050
Math.round(handlerOffsetX.value),
51-
inputRange,
52-
outputRange,
51+
inputRange.map(Math.round),
52+
outputRange.map(Math.round),
5353
Extrapolate.CLAMP
5454
);
5555
}

0 commit comments

Comments
 (0)