1
- import React from " react" ;
2
- import PropTypes from " prop-types" ;
3
- import { Animated , Easing } from " react-native" ;
4
- import { Surface , Group } from " @react-native-community/art" ;
5
- import AnimatedCircle from " ../animated/AnimatedCircle" ;
6
- import { color } from " ../const" ;
1
+ import React from ' react' ;
2
+ import PropTypes from ' prop-types' ;
3
+ import { Animated , Easing } from ' react-native' ;
4
+ import { Surface , Group } from ' @react-native-community/art' ;
5
+ import AnimatedCircle from ' ../animated/AnimatedCircle' ;
6
+ import { color } from ' ../const' ;
7
7
8
8
export default class RotationCircleLoader extends React . PureComponent {
9
9
static propTypes = {
10
10
size : PropTypes . number ,
11
- color : PropTypes . string
11
+ color : PropTypes . string ,
12
12
} ;
13
13
14
14
static defaultProps = {
15
15
size : 50 ,
16
- color
16
+ color,
17
17
} ;
18
18
19
19
state = {
20
20
degree : new Animated . Value ( 0 ) ,
21
- scales : [ new Animated . Value ( 0 ) , new Animated . Value ( 0 ) ]
21
+ scales : [ new Animated . Value ( 0 ) , new Animated . Value ( 0 ) ] ,
22
22
} ;
23
23
timers = [ ] ;
24
24
@@ -34,7 +34,7 @@ export default class RotationCircleLoader extends React.PureComponent {
34
34
35
35
componentWillUnmount ( ) {
36
36
this . unmounted = true ;
37
- this . timers . forEach ( id => {
37
+ this . timers . forEach ( ( id ) => {
38
38
clearTimeout ( id ) ;
39
39
} ) ;
40
40
}
@@ -44,8 +44,8 @@ export default class RotationCircleLoader extends React.PureComponent {
44
44
Animated . timing ( this . state . degree , {
45
45
toValue : 360 ,
46
46
duration : 2000 ,
47
- easing : Easing . linear
48
- } )
47
+ easing : Easing . linear ,
48
+ } ) ,
49
49
] ) . start ( ( ) => {
50
50
if ( ! this . unmounted ) {
51
51
this . state . degree . setValue ( 0 ) ;
@@ -54,10 +54,10 @@ export default class RotationCircleLoader extends React.PureComponent {
54
54
} ) ;
55
55
} ;
56
56
57
- _animationCircles = i => {
57
+ _animationCircles = ( i ) => {
58
58
Animated . sequence ( [
59
59
Animated . timing ( this . state . scales [ i ] , { toValue : 1 , duration : 1000 } ) ,
60
- Animated . timing ( this . state . scales [ i ] , { toValue : 0.05 , duration : 1000 } )
60
+ Animated . timing ( this . state . scales [ i ] , { toValue : 0.05 , duration : 1000 } ) ,
61
61
] ) . start ( ( ) => {
62
62
! this . unmounted && this . _animationCircles ( i ) ;
63
63
} ) ;
@@ -67,13 +67,13 @@ export default class RotationCircleLoader extends React.PureComponent {
67
67
const { size, color } = this . props ;
68
68
const degree = this . state . degree . interpolate ( {
69
69
inputRange : [ 0 , 360 ] ,
70
- outputRange : [ " 0deg" , " 360deg" ]
70
+ outputRange : [ ' 0deg' , ' 360deg' ] ,
71
71
} ) ;
72
72
return (
73
73
< Animated . View
74
74
style = { {
75
75
transform : [ { rotate : degree } ] ,
76
- backgroundColor : " rgba(0,0,0,0)"
76
+ backgroundColor : ' rgba(0,0,0,0)' ,
77
77
} }
78
78
>
79
79
< Surface width = { size } height = { size } >
0 commit comments