react-native-progress icon indicating copy to clipboard operation
react-native-progress copied to clipboard

IOS the progress bar, progress is not increasing when lock the phone

Open ManishKumarPandia opened this issue 5 years ago • 0 comments

This is working fine in case of andriod , but stuck the percentage when scanning is in progress and lock the phone .

Here is my working code :

showProgress() { if (!this.state.indeterminateState) { if (this.progressTextCounter <= 100) { return (Math.ceil(this.progressTextCounter)) + "%"; } else { CoolRBackgroundTimer.clearInterval(scanTimeIntervalId); this.setState({ isDisplaySpinner: false }); return "100%"; } } }

startScanProgress() {
    this.progressTextCounter = 0;
    let prefScanTimeOut = Preference.get('ScanTimeout');
    this.setState({ scanProgress: 0, isDisplaySpinner: true });
    let scanTimeOut = (100 / (prefScanTimeOut ? prefScanTimeOut : utils.ScanTimeout_Default));
    let scanProgressValue = scanTimeOut / 100;
    this.increaseProgress(scanTimeOut, scanProgressValue);
}
increaseProgress(timeOutScan, progressValue) {
    let me = this;
    CoolRBackgroundTimer.clearInterval(scanTimeIntervalId);
    scanTimeIntervalId = CoolRBackgroundTimer.setInterval(function scatime() {
        let stateObj = { scanProgress: (me.state.scanProgress + progressValue), indeterminateState: false };
        me.progressTextCounter = (me.progressTextCounter + timeOutScan);
        me.setState(stateObj);
        return scatime;
    }(), 1000);
}

render() {
    return (
        <View>
            {this.state.isDisplaySpinner && SyncService.currentStep == SyncService.processStep.scanDevices ? <Progress.Circle progress={this.state.scanProgress} indeterminate={this.state.indeterminateState} size={40} formatText={this.showProgress} showsText={true} color={'white'} textStyle={styles.progressLoader} /> : null}
        </View>

ManishKumarPandia avatar Mar 29 '19 06:03 ManishKumarPandia