Skip to content

Commit

Permalink
removed pull-to-refresh for android temporailty
Browse files Browse the repository at this point in the history
  • Loading branch information
jihopark committed Feb 2, 2016
1 parent 60ad617 commit a8abca7
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions components/PlainListView.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ var {
PixelRatio,
Image,
Platform,
PullToRefreshViewAndroid,
RefreshControl,
ScrollView,
} = React;

var PlainListView = React.createClass({
Expand Down Expand Up @@ -82,6 +83,7 @@ var PlainListView = React.createClass({
getOffer={this.props.getOffer}
getConversation={this.props.getConversation}
user={this.props.user}
scrollListDown={this.scrollListDown}
/>
{card["Merged"] == "Top" || card["Merged"] == "Mid" ?
<Divider margin={styles.mergedCardDivider} /> : null}
Expand All @@ -92,9 +94,13 @@ var PlainListView = React.createClass({
P.log("onRefreshListView", "Refresh Screen");
this.props.refreshScreen();
},
scrollListDown: function(){
P.log("scrollListDown",this.refs.listView==undefined);
P.log("scrollListDown",this.refs.listView.getScrollResponder()==undefined);
this.refs.listView.getScrollResponder().scrollTo(300);
},
render: function() {
var listView;

if (this.props.invertList) {
var InvertibleScrollView = require('react-native-invertible-scroll-view');

Expand All @@ -108,28 +114,24 @@ var PlainListView = React.createClass({
}
else {
listView = (<ListView
ref="listView"
style={this.props.hasBackgroundColor ? styles.background: null}
dataSource={new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}).cloneWithRows(this.props.cards)}
renderRow={this.renderCards}
onEndReached={this.props.onEndReached}
refreshControl={Platform.OS == 'ios' ? (<RefreshControl
refreshing={this.props.isRefreshing}
onRefresh={this.onRefreshListView}
tintColor="#33cc66"
title="Pull to refresh"
colors={['#33cc66']}
/>) : null}
/>);
}

return (
<View style={styles.listContainer}>

{Platform.OS == 'ios' ? listView :
(
<PullToRefreshViewAndroid
style={{flex:1}}
enabled={this.props.isRefreshingEnabled}
refreshing={this.props.isRefreshing}
onRefresh={this.onRefreshListView}
>
{listView}
</PullToRefreshViewAndroid>
)
}
{listView}
</View>
);
}
Expand Down

1 comment on commit a8abca7

@jihopark
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turkey had a problem of react-native pull-to-refresh-android and listview scroll events clashing. So I tried to do:

  1. Change Pull-To-Refresh-Android to RefreshControl (since it also applies for iOS) but the problem is never solved.
  2. I had to upgrade to react-native 0.19 (this took me awhile too)
  3. I tried to use the ListView to Scroll down or handle gestures with https://facebook.github.io/react-native/docs/panresponder.html#content but i couldn't.
  4. I tried to manipulate the react-native-picker-android but i couldn't.

apparently there is a problem with onPanResponderTerminationRequest in react-library, so i'm seeing if i they solve it facebook/react-native#5696

For now i just disabled pull-to-refresh-for android.

Please sign in to comment.