schovi / react-iscroll

React component for wrapping iScroll http://iscrolljs.com/
MIT License
236 stars 60 forks source link

ease options with scrollToElement #66

Open edencorbin opened 6 years ago

edencorbin commented 6 years ago

I'm struggling applying a custom ease to scrollToElement, here is my relevant code bits. How would I apply a custom easing style or function to the scrollToElement?

var iScroll = require('iscroll/build/iscroll-probe')

      this.scrollRef[0].withIScroll((iScroll) => {
            iScroll.scrollToElement(this.refDict[ref], 500, 0, 0, false)
        })

                            <ReactIScroll ref={el => this.scrollRef[0] = el} iScroll={iScroll}
                                options={{
                                    scrollX: false,
                                    scrollY: true,
                                    probeType: 2,
                                    disableTouch: false,
                                    disablePointer: true,
                                    disableMouse: false,
                                    momentum: true,
                                    deceleration: 0.01,
                                    tap: true,
                                    mouseWheel: true,
                                    useTransition: true
                                }}
                                onScrollEnd={this.onScrollEnd}
                                onRefresh={this.initializeDonorRefs}
                            >