Love Trivedi
Love Trivedi

Reputation: 4046

react-native-progress-circle not progressing on android devices

I am using react-native-progress-circle in my app it doesn't show progress in the progress bar on android devices, works fine in 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 

Upvotes: 0

Views: 927

Answers (1)

kisakye gordon
kisakye gordon

Reputation: 31

Could be an issue with react-native-progress referencing the native ART module from react-native which doesn't work well with it.

You could try to install the community version with yarn add @react-native-community/art - Link.

Then clean the rebuild with cd android && ./gradlew clean

Upvotes: 1

Related Questions