react-native - React Native 中的进度对话框

标签 react-native

我对 ReactNative 世界很陌生。我正在努力寻找在 React Native 中显示如下进度对话框的 API 或库。我相信 ActivityIndi​​cator 可以使用,但它不会显示为叠加。任何人都可以帮助我如何使用样式显示为叠加层,或者是否有很好的库来实现这一点。

谢谢

enter image description here

enter image description here

最佳答案

这是打开 Prgressbar 的代码:

import React from 'react';
import { Modal, View, Text, ActivityIndicator, Button } from 'react-native';

export default class App extends React.Component {
  constructor(props) {
    super(props);
    this.state = { isProgress: false }
  }
  openProgressbar = () => {
    this.setState({ isProgress: true })
  }
  render() {
    return (
      this.state.isProgress ?
        <CustomProgressBar />
        :
        <View style={{ flex: 1, backgroundColor: '#fff', alignItems: 'center', justifyContent: 'center' }}>
          <Button title="Please click here to Open ProgressBar" onPress={this.openProgressbar} />
        </View>
    );
  }
}

const CustomProgressBar = ({ visible }) => (
  <Modal onRequestClose={() => null} visible={visible}>
    <View style={{ flex: 1, backgroundColor: '#dcdcdc', alignItems: 'center', justifyContent: 'center' }}>
      <View style={{ borderRadius: 10, backgroundColor: 'white', padding: 25 }}>
        <Text style={{ fontSize: 20, fontWeight: '200' }}>Loading</Text>
        <ActivityIndicator size="large" />
      </View>
    </View>
  </Modal>
);

现场演示的世博网址
https://snack.expo.io/@jitendra.mca13/progress-bar-demo

关于react-native - React Native 中的进度对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48219810/

相关文章:

linux - 我无法在 Ubuntu 上安装 xde expo

javascript - 如何在 <Image> 上呈现复选框(React Native)

javascript - 单击 React Native 中的项目时如何关闭模式并从 flatlist 返回值?

react-native - 导航器 this.props.navigator.push

javascript - 登录成功后如何跳转?在 native + 世博会

react-native - 有没有办法限制 React-Native 中 TextInput 的长度?

javascript - 有没有办法避免 navigator.geolocation.getCurrentPosition 被缓存?

react-native - React Native - 开发服务器返回响应代码 : 503

ssl - 无法使用 react-native-xmpp 连接 openfire

javascript - 如何将连接、组件和功能导出到一处? (只需要建议)