-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
95 lines (88 loc) · 2.62 KB
/
index.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/**
* @format
* @flow
*/
import React from 'react';
import { View, Modal } from 'react-native';
import PropTypes from 'prop-types';
import DefaultLoader from './src/defaultSpinner';
import DefaultText from './src/defaultText';
import LinesLoader from './src/barsLoader';
import DotsLoader from './src/dotsLoader';
import BlinkWithSizeText from './src/blinkWithSizeText';
import BlinkText from './src/blinkText';
import TextSequence from './src/textSequence';
class Spinner extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<Modal
animationType={this.props.modalAnimation}
transparent={true}
visible={this.props.visible}
>
<View
style={{
flex: 1,
alignItems: 'center',
justifyContent: 'center',
backgroundColor: this.props.backgroundColor,
}}
>
{Boolean(this.props.loaderType) &&
this.props.loaderType === 'default' && (
<DefaultLoader {...this.props} />
)}
{Boolean(this.props.loaderType) &&
this.props.loaderType === 'bars' && <LinesLoader {...this.props} />}
{Boolean(this.props.loaderType) &&
this.props.loaderType === 'dots' && <DotsLoader {...this.props} />}
{Boolean(this.props.textType) &&
this.props.textType === 'blinkGrow' && (
<BlinkWithSizeText {...this.props} />
)}
{Boolean(this.props.textType) &&
this.props.textType === 'characterGrow' && (
<TextSequence {...this.props} />
)}
{Boolean(this.props.textType) && this.props.textType === 'blink' && (
<BlinkText {...this.props} />
)}
{Boolean(this.props.textType) &&
this.props.textType === 'default' && (
<DefaultText {...this.props} />
)}
{this.props.children}
</View>
</Modal>
);
}
}
Spinner.defaultProps = {
colorLoader: 'white',
colorText: 'white',
modalAnimation: 'none',
sizeLoader: 'large',
sizeText: 25,
textLoader: 'LOADING',
visible: false,
loaderType: 'default',
textType: 'default',
backgroundColor: '#00000088',
};
Spinner.propTypes = {
colorLoader: PropTypes.string,
colorText: PropTypes.string,
modalAnimation: PropTypes.string,
sizeLoader: PropTypes.string,
sizeText: PropTypes.number,
visible: PropTypes.bool,
textLoader: PropTypes.string,
children: PropTypes.element,
loaderType: PropTypes.string,
textType: PropTypes.string,
backgroundColor: PropTypes.string,
};
export default Spinner;