Skip to content

How can i close the space on the left of the carousel wihen it loads and how to manually move the index on button click ? #544

Answered by dosubot bot
djokhar05 asked this question in Q&A
Discussion options

You must be logged in to vote

🤖

Hey @djokhar05! Great to see you back here, hope you're doing awesome. 😄

To start the carousel from a specific index, you can use the defaultIndex prop in the Carousel component. In your case, if you want to start from index 2, you can do it like this:

<Carousel
  defaultIndex={2}
  // other props
/>

For moving the carousel's index to the next item using a button click, you can use the next function from the carouselController. Here's how you can do it:

import { Carousel } from 'react-native-reanimated-carousel';

// Assuming you have a carouselController from useCarouselController
const { next } = carouselController;

// Your Carousel component
<Carousel
  defaultIndex={2}
  carouselCo…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@djokhar05
Comment options

Answer selected by djokhar05
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant