LoadingView.js 841 B

1234567891011121314151617181920212223242526272829303132
  1. import React, {Component} from 'react';
  2. import {ActivityIndicator, Modal, StyleSheet, Text, View} from 'react-native';
  3. export default class LoadingView extends Component {
  4. render() {
  5. var loadingText = this.props.loadingText == null ? "加载中..." : this.props.loadingText;
  6. return (
  7. <Modal
  8. transparent={true}
  9. onRequestClose={() => this.props.cancel()}>
  10. <View style={styles.loading}>
  11. <ActivityIndicator size='large' color='#FFFFFF'/>
  12. <Text style={styles.loadingText}>{loadingText}</Text>
  13. </View>
  14. </Modal>
  15. );
  16. }
  17. }
  18. const styles = StyleSheet.create({
  19. loading: {
  20. flex: 1,
  21. justifyContent: 'center',
  22. alignItems: 'center',
  23. backgroundColor: 'rgba(0, 0, 0, 0.5)'
  24. },
  25. loadingText: {
  26. marginTop: 10,
  27. fontSize: 16,
  28. color: '#FFFFFF'
  29. }
  30. });