import React, { Component } from 'react'; import { StyleSheet, Text, View, ActivityIndicator, Dimensions, Image } from 'react-native'; const { width, height } = Dimensions.get('window'); _this = null; class Loading extends Component { constructor(props) { super(props); _this = this; this.state = { show: false }; } static show = () => { _this.setState({ show: true }); }; static hide = () => { _this.setState({ show: false }); }; render() { if (this.state.show) { return ( {/* 正在加载... */} {/* */} ); } else { return ; } } } export default Loading; const styles = StyleSheet.create({ LoadingPage: { position: 'absolute', left: 0, top: 0, backgroundColor: 'rgba(0,0,0,0)', width: width, height: height, justifyContent: 'center', alignItems: 'center' } });