0.0.6 • Published 4 years ago

tiny-swiper-react v0.0.6

Weekly downloads
20
License
-
Repository
-
Last release
4 years ago

Tiny Swiper React (need react v16+)

spec

  • No dependency. (Only react)
  • Swiping can be used only on mobile.

Get started

import { TinySwiper } from './tiny-swiper-react'

const App = ()=>{
    const [ items ] = useState([
        <img src="/img1.jpg" alt="imag1" />,
        <img src="/img2.jpg" alt="imag2" />,
        <img src="/img3.jpg" alt="imag3" />,
        <div>jsx</div>
    ])

    const beforeTest = ({prevIndex, nextIndex})=>{
        console.log('beforeTest prevIndex : ', prevIndex)
        console.log('beforeTest nextIndex : ', nextIndex)
    }
    const afterTest = ({selectedIndex})=>{
        console.log('afterTest selectedIndex : ', selectedIndex)
    }
    const swipingTest = ({start, event,index})=>{
        console.log('swipingTest start : ', start)
        console.log('swipingTest event : ', event)
        console.log('swipingTest index : ', index)
    }
    
    return (
        <YourApp>
            <TinySwiper
                items={items}
                useIndicator={true}
                useDirector={true}
                indicatorClass={"override"}
                directorLeftClass={"override"}
                directorRightClass={"override"}
                before={beforeTest}
                after={afterTest}
                swiping={swipingTest}
            />
        </YourApp>
    )
}

options

  • items : Array

  • useIndicator : Boolean

  • useDirector : Boolean

  • indicatorClass : String

  • directorLeftClass : String

  • directorRightClass : String

  • before : Function({prevIndex:Number nextIndex:Number}). Before swping hook

  • after : Function({currentIndex:Number}). After swping hook

  • swiping : Function({ start:{clientX:Number, clientY:Number}, event:Event, index:Number, }). Swping hook

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago