Giter VIP home page Giter VIP logo

Comments (1)

trolit avatar trolit commented on May 29, 2024

Hi. If you still consider that feature, I'm afraid that it's not possible within provided version unless you accept big cons of workaround mentioned below.

I've tried to attach to organicArrows stateful variable and change it on particular slide:

import React, { useState, Component } from 'react';

const [isActive, setActive] = useState(true);

<AutoplaySlider
      organicArrows={isActive}
      onTransitionEnd={e => {
         if (e.currentIndex === 1) {
            setActive(false);
         }
   }}
>

but slider hangs out as soon as setActive(false) is called . I've tested that approach on bullets prop and for that particular prop, slider works as intended (check gif below)

bullets behaviour preview gif - bullets show/hide

You can achieve small progress(no arrows at given slide & working slider) by doing reverse thing, that is

  • setting isActive as false when defining stateful variable
const [isActive, setActive] = useState(false);
  • changing onTransitionEnd
onTransitionEnd={e => {
   if (e.currentIndex === 1) {
         setActive(false);
      } else {
         setActive(true);
      }
   }
}

but you will face 2 problems:

  • you won't see default arrows on the first slide (onFirstMount won't help)
  • slide where you don't want to have default arrows will work but ONLY for the first time. On the second loop (or if you go backwards), once you call setActive(false), slider stops working again

So with that package you can achieve requested behaviour but only once and with poor side effect unless you dive into slider code, debug what's going on with organicArrows and fix it to fit your needs.

from react-awesome-slider.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.