forked from ww8007/KPU_AUTO_RN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLoading.js
61 lines (55 loc) · 1.52 KB
/
Loading.js
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import React, { Component } from "react";
import { StyleSheet, View } from "react-native";
import AnimateLoadingButton from "react-native-animate-loading-button";
export default class LoadingButton extends Component {
render() {
return (
<View style={styles.container}>
<AnimateLoadingButton
ref={(c) => (this.loadingButton1 = c)}
width={300}
height={50}
title="BUTTON 1"
titleFontSize={16}
titleColor="rgb(255,255,255)"
backgroundColor="rgb(29,18,121)"
borderRadius={4}
onPress={this._onPressBotton1Handler.bind(this)}
/>
<View style={{ height: 20 }} />
<AnimateLoadingButton
ref={(c) => (this.loadingButton2 = c)}
width={300}
height={50}
title="BUTTON 2"
titleFontSize={16}
titleColor="rgb(255,255,255)"
backgroundColor="rgb(29,18,121)"
borderRadius={4}
onPress={this._onPressBotton2Handler.bind(this)}
/>
</View>
);
}
_onPressBotton1Handler() {
this.loadingButton1.showLoading(true);
// mock
setTimeout(() => {
this.loadingButton1.showLoading(false);
}, 2000);
}
_onPressBotton2Handler() {
this.loadingButton2.showLoading(true);
// mock
setTimeout(() => {
this.loadingButton2.showLoading(false);
}, 2000);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "rgb(255,255,255)",
justifyContent: "center",
},
});