import React , { PureComponent } from 'react'; import { View } from 'react-native'; import ProgressBarDialog from './ProgressBarDialog'; class Upload extends PureComponent { constructor(props) { this.state = { progress: 0, progressModalVisible: false }; } refProgressBar = (view) => { this.progressBar = view; } showProgressBar = () => { this.setState({ progressModalVisible: true }); } dismissProgressBar = () => { this.setState({ progress: 0, progressModalVisible: false }); } setProgressValue = (progress) => { this.setState({ progress }); } onProgressRequestClose = () => { this.dismissProgressBar(); } canclePress = () => { this.dismissProgressBar(); } render() { return ( <View> <ProgressBarDialog ref={this.refProgressBar} progress={this.state.progress} progressModalVisible={this.state.progressModalVisible} onRequestClose={this.onProgressRequestClose} canclePress={this.canclePress} needCancle={true} /> </View> ) } } export default Upload;
React Native实现进度条弹框的示例代码(2)
内容版权声明:除非注明,否则皆为本站原创文章。