meliorence / meliorence/react-native-snap-carousel
Carousel slide animations not working when inside a Animated.View
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.5k
- Forks
- 2.3k
- PR merge metrics
- No merged PRs in 30d
Description
Is this a bug report, a feature request, or a question?
bug
Have you followed the required steps before opening a bug report?
(Check the step you've followed - put an x character between the square brackets ([]).)
- I have read the guidelines regarding bug report.
- I have reviewed the documentation in its entirety, including the dedicated documentations 📚.
- I have searched for existing issues and made sure that the problem hasn't already been reported.
- I am using the latest plugin version.
- I am following the issue template closely in order to produce a useful bug report.
Have you made sure that it wasn't a React Native bug?
Yes
Is the bug specific to iOS or Android? Or can it be reproduced on both platforms?
IOS works flawlessly, but on Android it doesn't work at all, just one animation at time
Is the bug reproductible in a production environment (not a debug one)?
The app crashes at production, but on debug you can see that the animations doesn't work
Environment
"react": "16.8.3",
"react-native": "0.59.8",
"react-native-snap-carousel": "^3.8.0",
Target Platform:
Android (9.0)
iOS (12)
Expected Behavior
Expected to have a translateY animation for the entire carousel, and the slide animation of the carousel itself
Actual Behavior
If I put the Carousel inside a Animated.View with a translateY with pointerEvents: 'box-only' the translateY works, but, if I set pointerEvets: 'box-none' only the carousel animation work normally, the animations didn't work together
Reproducible Demo
<PanGestureHandler
onGestureEvent={animatedEvent}
onHandlerStateChange={onHandlerStateChanged}
>
<Animated.View
pointerEvents='auto'
style={{
flex: 1,
borderRadius: 5,
position: 'absolute',
height: '100%',
left: 0,
right: 0,
transform: [{
translateY: translateY.interpolate({
inputRange: [0, 350],
outputRange: [0, 350],
extrapolate: 'clamp',
}),
}],
}}
>
<Carousel
layout="default"
useScrollView={false}
data={data}
itemWidth={(Platform.OS === 'ios') ? totalWidth(width) - 40 : totalWidth(width)}
sliderWidth={width}
renderItem={({ item, index }) => (
<DataCard
key={index}
>
<CardImage>
<Image source={logo} />
</CardImage>
<CardFooter>
<Title>{item.title.toUpperCase()}</Title>
<Subtitle>{item.subtitle}</Subtitle>
</CardFooter>
</DataCard>
)}
/>
</Animated.View>
</PanGestureHandler>
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the supplied PanGestureHandler, Animated.View, and Carousel example on Android with pointerEvents set to box-none, then compare it with iOS behavior. Confirm whether the translateY and carousel animations can run together without the production crash; use the reported React Native and react-native-snap-carousel versions when testing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react-native
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100