-
Notifications
You must be signed in to change notification settings - Fork 2
/
RefreshView.tsx
47 lines (42 loc) · 1.05 KB
/
RefreshView.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import React, {Component} from "react";
import {Dimensions, StyleSheet, Text, View} from "react-native";
export interface RefreshProps {
title: string;
}
interface RefreshState {
}
export class RefreshView extends Component<RefreshProps, RefreshState> {
public render() {
return (
<View style={styles.RefreshContainer}>
<View style={styles.TextContainer}>
<Text style={styles.Title}>{this.props.title}</Text>
<Text style={styles.RefreshTime}>{this.getTimeString()}</Text>
</View>
</View>
);
}
private getTimeString(): string {
const now = new Date();
return `${now.getMonth() + 1}-${now.getDate()} ${now.getHours()}:${now.getMinutes()}`;
}
}
const styles = StyleSheet.create({
RefreshContainer: {
width: Dimensions.get("window").width,
flexDirection: "row",
justifyContent: "center",
},
TextContainer: {
marginTop: 10,
alignItems: "center",
},
Title: {
fontSize: 13,
color: "#454545",
},
RefreshTime: {
fontSize: 13,
color: "#9b9b9b",
},
});