dohooo / react-native-reanimated-carousel

🎠 React Native swiper/carousel component, fully implemented using reanimated v2, support to iOS/Android/Web. (Swiper/Carousel)
https://react-native-reanimated-carousel.vercel.app
MIT License
2.83k stars 328 forks source link

how to have the padding on both side? #470

Open Bob-MYMC opened 1 year ago

Bob-MYMC commented 1 year ago

The design requires padding 16px on the left and right side, and each card has 16px gap as well. However I can only manage to set the padding on the left side and gap between, could not find a way to add the padding on the right with option overscrollEnabled: false

Could you please advise a solution?

image image
ser-emejia commented 9 months ago

The design requires padding 16px on the left and right side, and each card has 16px gap as well. However I can only manage to set the padding on the left side and gap between, could not find a way to add the padding on the right with option overscrollEnabled: false

Could you please advise a solution?

image image

You can add a marginRight to last item of the array.

Something like this

{
   marginRight: index === yourArray.length - 1 ? 16 : 0
}
dosubot[bot] commented 9 months ago

🤖

I understand you're trying to add padding to both sides of the carousel and maintain a gap between each card. However, I'm unable to find a direct solution within the react-native-reanimated-carousel repository.

To better assist you, could you please provide more details about your current implementation? Specifically, it would be helpful to know how you're currently setting the padding and gap, and any relevant code snippets or configurations you're using. This will help me understand the context and potentially identify a solution.

Also, could you please confirm if you're using any specific styling or layout properties that might be affecting the padding on the right side?

Looking forward to your response.


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.