react-native-reanimated-carousel icon indicating copy to clipboard operation
react-native-reanimated-carousel copied to clipboard

Differ interval for each slide

Open serveyk0-work opened this issue 1 year ago • 1 comments

Hi) In my project, the duration of the display for each slide comes from the backend, can I somehow dynamically set the interval for different slides? Thank you)

serveyk0-work avatar Mar 22 '23 15:03 serveyk0-work

you can implement it using onSnapToItem prop and removing autoPlay

  const onSnapToItem = (index: number) => {
    const seconds = item[index].seconds;

    setTimeout(() => {
      ref.current?.next();
    }, seconds * 1000); // ms
  };

EstivenGonzalez avatar Apr 06 '23 19:04 EstivenGonzalez