react-native-progress-circle在Android设备上未进行

问题描述

我在我的应用程序中使用react-native-progress-circle,它在android设备上的进度栏中没有显示进度,在ios上工作正常

 constructor(props) {
    super(props);

    this.state = {
      progress: 100,fadeAnim: new Animated.Value(0),percent: 100
    };
  }
  Progress() {
    timeLeft = this.props.data.time_left;
    totalTime = this.props.data.total_time;
    if (interval) {
      clearInterval(interval);
    }
    interval = setInterval(() => {
      timeLeft = timeLeft - 1;
      console.log(timeLeft,"time" )
      const percentageLeft = (timeLeft / totalTime) * 100;
      this.setState({ progress: parseInt(percentageLeft) },() => {
        console.log(this.state.progress,"pro")
      });
      if (percentageLeft <= 1) {
        clearInterval(interval);
      }
    },1000);
  }
  componentDidMount() {
    console.log("object!!!")
    this.Progress();
    setInterval(() => {
      console.log(this.state.percent,'one more interval')
      this.setState({ percent: 50},()=> {console.log("fghfg")})
    },1000);
    
  }
  componentDidUpdate(prevProps) {
    if (prevProps.socket.checkin_users !== this.props.socket.checkin_users) {
      this.Progress();
    }
  }
  <ProgressCircle
            percent={this.state.progress}
            radius={20}
            borderWidth={4}
            color="#3399FF"
            shadowColor="#eee"
            bgColor="#fff"
          >
            <Svg  width={40} height={30}>
            <Image
              source={{
                uri: renderImage(this.props.data.profile_image,"user"),}}
              style={styles.image}
            />
            </Svg>
            
          </ProgressCircle>  



this my code,anyone has any solution? trying from past 2 days can't find anything 

解决方法

react-native-progress引用了ART中的本机react-native模块,可能无法解决问题。

您可以尝试使用以下命令安装社区版本 yarn add @react-native-community/art-Link

然后用cd android && ./gradlew clean清理重建

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...