Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pullDown设置为false有错误 #1

Open
LayGit opened this issue Jun 24, 2016 · 3 comments
Open

pullDown设置为false有错误 #1

LayGit opened this issue Jun 24, 2016 · 3 comments

Comments

@LayGit
Copy link

LayGit commented Jun 24, 2016

pullDown={false}
会导致错误:Cannot read property 'offsetHeight' of undefined

hopefuture added a commit that referenced this issue Jun 26, 2016
@hopefuture
Copy link
Contributor

该 bug 已修复,谢谢指正!请下载最新版本 0.3.1
同时添加了禁止向上和向下滑动相关逻辑,并给出了例子供参考
另外增加了属性 style 可以定制其样式

@LayGit
Copy link
Author

LayGit commented Jun 27, 2016

更新到 0.3.1 版本后 pullDown 问题验证已解决。
现在有另外一个问题:pullUp={false} 的时候,高度计算貌似有问题,此问题会导致无法滑动或者滑动距离不足,条数少的时候(如 i < 30)无法滑动,条数多的时候(如 i < 50)滑动高度不足
测试浏览器版本:Chrome 51.0.2704.84 (64-bit)
React 版本:15.1.0
Babel 版本:6.5.2
IScroll 版本:5.2.0
代码:

import React from 'react'
import iScroll from 'iscroll/build/iscroll-probe'
import ReactIScroll from 'reactjs-iscroll'

export default class Test extends React.Component {
  constructor (props) {
    super(props)
    this.state = {
      data: []
    }
  }

  componentWillMount() {
    const tempData = []

    for (var i = 0; i < 30; i++) {
      tempData.push({
        id: i,
        name: '测试_' + i
      })
    }

    this.setState({ data: tempData })
  }

  render () {
    return (
      <ReactIScroll iScroll={iScroll} pullDown={false} pullUp={false}>
        <ul>
          {this.state.data.map((item) =>
            <li key={item.id}>{item.name}</li>
          )}
        </ul>
      </ReactIScroll>
    )
  }
}

@hopefuture
Copy link
Contributor

该组件已不再维护,请用我最新的下拉刷新,上拉加载更多
https://github.com/reactjs-ui/reactjs-pull-refresh
也可用 https://github.com/reactjs-ui/reactjs-scroll,只处理滑动效果

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants