Skip to content

Commit b77c920

Browse files
committed
update example
1 parent 3eb35d5 commit b77c920

File tree

2 files changed

+80
-69
lines changed

2 files changed

+80
-69
lines changed

.idea/workspace.xml

Lines changed: 58 additions & 65 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/App.js

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,22 @@ const instructions = Platform.select({
2323
android: 'Double tap R on your keyboard to reload,\n' +
2424
'Shake or press menu button for dev menu',
2525
});
26-
26+
Date.prototype.Format = function (fmt) { // author: meizz
27+
var o = {
28+
"M+": this.getMonth() + 1, // 月份
29+
"d+": this.getDate(), // 日
30+
"h+": this.getHours(), // 小时
31+
"m+": this.getMinutes(), // 分
32+
"s+": this.getSeconds(), // 秒
33+
"q+": Math.floor((this.getMonth() + 3) / 3), // 季度
34+
"S": this.getMilliseconds() // 毫秒
35+
};
36+
if (/(y+)/.test(fmt))
37+
fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
38+
for (var k in o)
39+
if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
40+
return fmt;
41+
}
2742
type Props = {};
2843
export default class App extends Component<Props> {
2944
state = {
@@ -39,6 +54,8 @@ export default class App extends Component<Props> {
3954
<SmartRefreshControl
4055
ref={ref=>this._refreshc = ref}
4156
onRefresh={()=>{
57+
console.log('onRefresh'+((new Date()).Format("yyyy-MM-dd hh:mm:ss.S")))
58+
4259
setTimeout(()=>{
4360
this._refreshc && this._refreshc.finishRefresh();
4461
},1000)
@@ -55,11 +72,12 @@ export default class App extends Component<Props> {
5572
}).start()
5673
}
5774
}
58-
onHeaderReleased={()=>{
75+
onHeaderReleased={(e)=>{
76+
console.log('onHeaderReleased'+((new Date()).Format("yyyy-MM-dd hh:mm:ss.S")))
5977
this.setState({
6078
refreshing:true,
6179
text:'正在刷新'
62-
})
80+
});
6381
}}
6482
onReleaseToRefresh={()=>{
6583
this.setState({
@@ -83,7 +101,7 @@ export default class App extends Component<Props> {
83101
transform:[{
84102
rotate:this.state.rotate.interpolate({
85103
inputRange:[0,1],
86-
outputRange:['0deg','180deg']
104+
outputRange:['180deg','0deg']
87105
})
88106
}]
89107
}} name="md-arrow-up" color="#2783cf" size={24}/>}

0 commit comments

Comments
 (0)