Loading.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import React, { Component } from 'react';
  2. import { StyleSheet, Text, View, ActivityIndicator, Dimensions, Image } from 'react-native';
  3. const { width, height } = Dimensions.get('window');
  4. _this = null;
  5. class Loading extends Component {
  6. constructor(props) {
  7. super(props);
  8. _this = this;
  9. this.state = {
  10. show: false
  11. };
  12. }
  13. static show = () => {
  14. _this.setState({ show: true });
  15. };
  16. static hide = () => {
  17. _this.setState({ show: false });
  18. };
  19. render() {
  20. if (this.state.show) {
  21. return (
  22. <View style={styles.LoadingPage}>
  23. {/* <View
  24. style={{
  25. width: 100,
  26. height: 100,
  27. backgroundColor: 'rgba(0,0,0,0.6)',
  28. opacity: 1,
  29. justifyContent: 'center',
  30. alignItems: 'center',
  31. borderRadius: 7
  32. }}
  33. >
  34. <ActivityIndicator size="large" color="#FFF" />
  35. <Text style={{ marginLeft: 10, color: '#FFF', marginTop: 10 }}>正在加载...</Text> */}
  36. {/* </View> */}
  37. <Image source={require('../images/common/loading.gif')} />
  38. </View>
  39. );
  40. } else {
  41. return <View />;
  42. }
  43. }
  44. }
  45. export default Loading;
  46. const styles = StyleSheet.create({
  47. LoadingPage: {
  48. position: 'absolute',
  49. left: 0,
  50. top: 0,
  51. backgroundColor: 'rgba(0,0,0,0)',
  52. width: width,
  53. height: height,
  54. justifyContent: 'center',
  55. alignItems: 'center'
  56. }
  57. });