A NativeScript plugin to provide the Pull to Refresh control on any view.
npm install nativescript-akylas-pulltorefresh---
tns plugin add @nstudio/nativescript-pulltorefresh
#### Android - _SwipeRefreshLayout_
| Android | iOS |
| ---------------------------------------------- | -------------------------------------- |
| !Android Sample | !iOS Sample |
#### XML
``xml`
loaded="pageLoaded">
#### JS
`javascript
function refreshList(args) {
// Get reference to the PullToRefresh component;
var pullRefresh = args.object;
// Do work here... and when done call set refreshing property to false to stop the refreshing
loadItems().then(
resp => {
// ONLY USING A TIMEOUT TO SIMULATE/SHOW OFF THE REFRESHING
setTimeout(() => {
pullRefresh.refreshing = false;
}, 1000);
},
err => {
pullRefresh.refreshing = false;
}
);
}
exports.refreshList = refreshList;
`
`typescript
import { registerElement } from "nativescript-angular/element-registry";
registerElement("PullToRefresh", () => require("@nstudio/nativescript-pulltorefresh").PullToRefresh);
refreshList(args) {
const pullRefresh = args.object;
setTimeout(function () {
pullRefresh.refreshing = false;
}, 1000);
}
`
#### HTML
`html`
`javascript
import Vue from 'nativescript-vue';
Vue.registerElement(
'PullToRefresh',
() => require('@nstudio/nativescript-pulltorefresh').PullToRefresh
);
`
#### Component
`vue
``
- refresh : function _required_
- refreshing: boolean - Notifies the widget that the refresh state has
changed.