schovi / react-iscroll

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

ReactIScroll: options.zoom is set, but iscroll-zoom version is not required. Zoom feature won't work properly. #56

Closed terminalqo closed 7 years ago

terminalqo commented 7 years ago
import React from 'react'
import ReactIScroll from 'react-iscroll'
import iScroll from 'iscroll'

export default class SeatMap extends React.Component {
  constructor(props){
    super(props);
    this.state = {
      options: {
        zoom: true,
        mouseWheel: true,
        wheelAction: 'zoom',
        scrollbars: true,
        scrollX: true,
        scrollY: true
      }
    }
  }

  onZoomStart(){
    console.log('onZoomStart')
  }

  onZoomEnd(){
    console.log('onZoomEnd')
  }

  onScrollStart() {
    console.log("iScroll starts scrolling")
  }

  render(){
    var i = 0, len = 100, listOfLi = [];

    for(i; i < len; i++) {
      listOfLi.push(<li key={i}>Row {i+1}</li>)
    }

    return (
      <div style={{height: '300px'}}>
        <ReactIScroll iScroll={iScroll}
                      options={this.state.options}
                      onScrollStart={this.onScrollStart}
                      onZoomStart={this.onZoomStart}
                      onZoomEnd={this.onZoomEnd}
        >
          <ul>
            {listOfLi}
          </ul>
        </ReactIScroll>
      </div>
    )
  }
}

ReactIScroll: options.zoom is set, but iscroll-zoom version is not required. Zoom feature won't work properly.

I dont konw how to fix it ,please tell me ,thx!

terminalqo commented 7 years ago

fixed

import iScroll from 'iscroll/build/iscroll-zoom'
schovi commented 7 years ago

@weishijun14 Just question. Did you noticed warning in console? https://github.com/schovi/react-iscroll/blob/master/src/prop_types.js#L34 I am thinking about switching it from warning to error. Same for onScroll event and probe version. There is so many issues about that.