Authored by 孙凯

add RN 下拉刷新完成回调 review by hongmo

... ... @@ -274,6 +274,12 @@ var ListView = React.createClass({
}
},
yh_updateVisibleSubViews: function() {
if (this._scrollComponent && this._scrollComponent.yh_updateVisibleSubViews) {
this._scrollComponent.yh_updateVisibleSubViews();
}
},
setNativeProps: function(props: Object) {
if (this._scrollComponent) {
this._scrollComponent.setNativeProps(props);
... ...
... ... @@ -335,6 +335,7 @@ const ScrollView = React.createClass({
enablePullToRefresh: PropTypes.bool,
isOnPullToRefresh: PropTypes.bool,
onRefreshData: PropTypes.func,
onFinishRefreshData: PropTypes.func,
/**
... ... @@ -346,6 +347,12 @@ const ScrollView = React.createClass({
mixins: [ScrollResponder.Mixin],
yh_updateVisibleSubViews: function() {
RCTScrollViewManager.yh_updateVisibleSubViews(
ReactNative.findNodeHandle(this)
);
},
startPullToRefresh: function() {
RCTScrollViewManager.startPullToRefresh(
ReactNative.findNodeHandle(this)
... ...
... ... @@ -653,7 +653,7 @@ export default class Home extends Component {
let rowIndexs = Object.keys(visibleRows[targetSection]);
if (rowIndexs.length > 0) {
selectedIndex = rowIndexs[0];
}
}
if (rowIndexs.length > 3) {
selectedIndex = rowIndexs[2];
}
... ... @@ -721,6 +721,9 @@ export default class Home extends Component {
onRefreshData={() => {
this.props.onRefresh && this.props.onRefresh();
}}
onFinishRefreshData={() => {
this.listView && this.listView.yh_updateVisibleSubViews();
}}
onEndReached={() => {
this.props.onEndReached && this.props.onEndReached();
}}
... ...