Skip to content

Commit

Permalink
fix: solve sliding flicker problem
Browse files Browse the repository at this point in the history
  • Loading branch information
dohooo committed Oct 31, 2021
1 parent 11b39b1 commit 96678e0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
10 changes: 0 additions & 10 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,10 @@ export default function App() {
>
<View style={{ height: 300 }}>
<Carousel<ImageSourcePropType>
autoPlay
autoPlayInterval={2000}
ref={r}
width={width}
data={data}
parallaxScrollingScale={0.8}
onSnapToItem={(i) => {
console.log('current index:', i);
}}
renderItem={(source) => (
<View style={{ flex: 1 }}>
<Image
Expand All @@ -46,16 +41,11 @@ export default function App() {
</View>
<View style={{ height: 300 }}>
<Carousel<ImageSourcePropType>
autoPlay
autoPlayInterval={2000}
ref={r}
mode="parallax"
width={width}
data={data}
parallaxScrollingScale={0.8}
onSnapToItem={(i) => {
console.log('current index:', i);
}}
renderItem={(source) => (
<View style={{ flex: 1 }}>
<Image
Expand Down
4 changes: 2 additions & 2 deletions src/useOffsetX.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ export const useOffsetX = (opts: IOpts) => {

return interpolate(
Math.round(handlerOffsetX.value),
inputRange,
outputRange,
inputRange.map(Math.round),
outputRange.map(Math.round),
Extrapolate.CLAMP
);
}
Expand Down

0 comments on commit 96678e0

Please sign in to comment.