Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pull to refresh for Android and Phonegap

We are building multi-platform mobile app using Cordova, html, css. For some of our screen, we need pull to refresh functionality. I tried Damien's solution (http://damien.antipa.at/2012/10/16/ios-pull-to-refresh-in-mobile-safari-with-native-scrolling/) and iScroll for iOS and it works great for iOS platforms. But none of the methods works for android platform. Can someone please help me with this? How can i build pull To Refresh for Android platform.

like image 868
user3233772 Avatar asked Feb 11 '14 18:02

user3233772


2 Answers

You should be able to do that with iscroll.js : http://iscrolljs.com/

Or you can read Christophe Coenraets's blog article.

like image 134
QuickFix Avatar answered Sep 28 '22 16:09

QuickFix


I enjoy the simplicity of this if you're also using React.js

https://www.npmjs.com/package/react-pull-to-refresh

An example :

<ReactPullToRefresh
  onRefresh={this.handleRefresh}
  className="your-own-class-if-you-want"
  style={{
    textAlign: 'center'
  }}>
  <h3>Pull down to refresh</h3>
  <div>{items}</div>
  <div>etc.</div>
</ReactPullToRefresh>
like image 28
Trip Avatar answered Sep 28 '22 15:09

Trip