Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
559
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.14 KB | None | 0 0
  1. import React, { PureComponent } from 'react';
  2. import { View, Text, Animated, StyleSheet, Modal } from 'react-native';
  3. import { CL_ORANGE, CL_MODALOVERLAY, CL_W, CL_RED, CL_BLUE } from 'styles/common';
  4. import { IcAnalyze } from 'components/svg';
  5.  
  6. class LoadAnimated extends PureComponent {
  7. constructor(props) {
  8. super(props);
  9. this.state = {
  10. loadingOpacity: new Animated.Value(0)
  11. }
  12. }
  13.  
  14. componentDidMount() {
  15. this._fadeAnimation();
  16. }
  17.  
  18. render() {
  19. const { show, visible } = this.props;
  20. return (
  21. <Modal transparent onRequestClose={() => {}} visible={visible}>
  22. <View style={styles.loading}>
  23. <View style={[styles.containerView]}>
  24. {this._test()}
  25. {/* <Animated.View style={show ? styles.outerCircle60 : styles.outerCircle60} />
  26. <View style={{position: 'absolute', top: 0, left: 0, right: 0, bottom: 0, justifyContent: 'center', alignItems: 'center'}}>
  27. <IcAnalyze />
  28. </View> */}
  29. </View>
  30. <View style={styles.textLoadWrap}>
  31. <Text style={styles.loadingText}>Sedang melakukan</Text>
  32. <Text style={styles.loadingText}>verifikasi…</Text>
  33. </View>
  34. </View>
  35. </Modal>
  36. );
  37. }
  38.  
  39. _fadeAnimation = () => {
  40. const {loadingOpacity} = this.state;
  41. loadingOpacity.setValue(0);
  42. Animated.sequence([
  43. Animated.timing(
  44. loadingOpacity,
  45. {
  46. toValue: 1,
  47. duration: 500
  48. }
  49. ),
  50. Animated.timing(
  51. loadingOpacity,
  52. {
  53. toValue: 0,
  54. duration: 500
  55. }
  56. )
  57. ]).start(() => this._fadeAnimation());
  58. }
  59.  
  60. _test = () => {
  61. return(
  62. <View style={styles.containerView}>
  63. <View style={styles.outerCircle120} />
  64. <View style={styles.outerCircle90} />
  65. <IcAnalyze />
  66. </View>
  67. )
  68. }
  69.  
  70. }
  71.  
  72. const styles = StyleSheet.create({
  73. loading: {
  74. flex: 1,
  75. backgroundColor: CL_MODALOVERLAY,
  76. justifyContent: 'center',
  77. alignItems: 'center',
  78. padding: 32
  79. },
  80. loadingText: {
  81. fontFamily: 'Lato-Regular',
  82. fontSize: 16,
  83. lineHeight: 20,
  84. letterSpacing: 0.0,
  85. textAlign: 'center',
  86. color: CL_W
  87. },
  88. textLoadWrap: {
  89. paddingTop: 32,
  90. paddingHorizontal: 16
  91. },
  92. outerCircle90: {
  93. backgroundColor: CL_RED,
  94. width: 90,
  95. height: 90,
  96. borderRadius: 50,
  97. justifyContent: 'center',
  98. alignItems: 'center',
  99. // opacity: 0.25,
  100. position: 'absolute',
  101. },
  102. outerCircle120: {
  103. backgroundColor: CL_ORANGE,
  104. width: 120,
  105. height: 120,
  106. borderRadius: 70,
  107. justifyContent: 'center',
  108. alignItems: 'center',
  109. // opacity: 0.25,
  110. position: 'absolute',
  111. },
  112. outerCircle40: {
  113. backgroundColor: CL_BLUE,
  114. width: 40,
  115. height: 40,
  116. borderRadius: 50,
  117. justifyContent: 'center',
  118. alignItems: 'center',
  119. // opacity: 0.25,
  120. position: 'absolute',
  121. },
  122. containerView: {
  123. flexDirection: 'column',
  124. justifyContent: 'center',
  125. alignItems: 'center',
  126. },
  127. });
  128.  
  129. export default LoadAnimated;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement