|
| 1 | +--- |
| 2 | +title: "Create a circular carousel with parallax effect in React Native" |
| 3 | +description: "Let's see how it is possible to create a circular carousel with parallax effect in React Native." |
| 4 | +date: 2024-12-30 |
| 5 | +image: ../images/posts/daily-deals-featured.jpg |
| 6 | +tags: [react native, swift, ios, apple, android, java, mobile application development, javascript, typescript, expo] |
| 7 | +comments: true |
| 8 | +math: false |
| 9 | +authors: [fabrizio_duroni] |
| 10 | +--- |
| 11 | + |
| 12 | +*Let's see how it is possible to create a circular carousel with parallax effect in React Native.* |
| 13 | + |
| 14 | +--- |
| 15 | + |
| 16 | +Recently, during a one-to-one meeting with my engineering manager, [Luca D'antona](https://www.linkedin.com/in/lucadantona/), |
| 17 | +we discussed some exciting animations we’d like to bring to our mobile apps at [lastminute.com](https://corporate.lastminute.com). |
| 18 | +In particular, Luca pointed out how captivating the carousel on the home screen of the official |
| 19 | +[Apple TV app](https://www.apple.com/apple-tv-app/) is. This carousel stands out for its stunning parallax animation. |
| 20 | +Essentially, as you scroll through the images of TV shows/movies, the images shift based on the scroll position, |
| 21 | +adding a dynamic sense of motion to the entire experience. |
| 22 | +In our apps we have been using [React Native](/2018/07/04/react-native-typescript-existing-app/) for quite some |
| 23 | +time, but animations often have a bad reputation within this framework. |
| 24 | +Luca challenged the team, asking: “Do you think it’s possible to implement such a cool animation on our daily deals carousel? ChatGPT says it should be possible!” |
| 25 | +I took this challenge personally because I’m passionate about animations—a natural consequence of my love for |
| 26 | +[computer graphics](/2017/08/25/how-to-calculate-reflection-vector/)). |
| 27 | +And here I am today, having successfully implemented the challenge and enhanced our daily deals carousel with this |
| 28 | +new, beautiful parallax effect. |
| 29 | +In this post, I’ll show you how to create a stunning full-screen circular carousel (that you can scroll endlessly) |
| 30 | +with a parallax effect on the images and an opacity animation for the text descriptions of each item. Below, you can |
| 31 | +find a video of the final result. |
| 32 | + |
| 33 | +`youtube: https://youtu.be/ECjX8bXVXzU` |
| 34 | + |
| 35 | +To develop this carousel we will use: |
| 36 | + |
| 37 | +* Expo |
| 38 | +* React Native Reanimated |
| 39 | +* Expo Linear Gradient |
| 40 | + |
| 41 | +#### Implementation |
| 42 | + |
| 43 | +Let's start from the implementation of the main carousel component, `ParallaxCarousel`. |
| 44 | +This component is the one responsible for displaying the items and managing the scroll. |
| 45 | +In particular, it has the responsibility to simulate the circular endless loop during the scroll. |
| 46 | + |
| 47 | + |
| 48 | +#### Conclusion |
| 49 | + |
| 50 | +You can find the full implementation of what I described above in this [github repo](https://github.com/chicio/React-Native-Parallax-Carousel). |
| 51 | +It was quite funny to implement this carousel and the parallax animation. |
| 52 | +I hope I can add more animation during my FriYaY to improve our apps UX :heart:. |
0 commit comments