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

在手机屏幕下一半使用,该组件无效 #1

Open
xyy7260 opened this issue Sep 7, 2017 · 2 comments
Open

在手机屏幕下一半使用,该组件无效 #1

xyy7260 opened this issue Sep 7, 2017 · 2 comments

Comments

@xyy7260
Copy link

xyy7260 commented Sep 7, 2017

你好,
今天我在手机屏幕的下一半使用这组件,结果没得任何响应,数据也无法渲染
然后我在其他页面屏幕上半部份使用这组件有效果
我RN 版本
"react-native": "^0.46.4",
"react": "^16.0.0-alpha.12",
"react-native-rk-pull-to-refresh": "^1.1.7",

@JohnDn
Copy link

JohnDn commented Oct 18, 2017

你好,sectionlist怎么改才能支持自定义下拉刷新和上拉加载呢?

@hzl123456
Copy link
Owner

可以在Pullable的onShouldSetPanResponder方法里添加自己的判断
onShouldSetPanResponder = (e, gesture) => {
let y = 0
if (this.scroll instanceof ListView) { //ListView下的判断
y = this.scroll.scrollProperties.offset;
} else if (this.scroll instanceof FlatList) {//FlatList下的判断
y = this.scroll.getScrollMetrics().offset //这个方法需要自己去源码里面添加
}
//根据y的值来判断是否到达顶部
this.state.atTop = (y <= 0)
if (this.state.atTop && index.isDownGesture(gesture.dx, gesture.dy) && this.props.refreshable) {
this.lastY = this.state.pullPan.y._value;
return true;
}
return false;
}

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

3 participants