I'm working with office 365 progress bar . I got data for it (percents) from websocket. Now I have next code:
export default class NotificationBar extends Component {
constructor(props) {
super(props);
this._async = new Async(this);
}
render(){
let { process } = this.props;// this object I get from flux store, it refreshes when web socket updates
return (
<ProgressIndicator
percentComplete={ this._getProgress() } />
)
};
_getProgress = () => {
let { process } = this.props;//here this.props.process.percent updates
return process.percent;
};
}
After page load progress bar becomes 100% and doesnt change, though I get percents from method. I tried to experiment and put in component's render:
What can be the reason of such behavior? Where I made the mistake?
That's because percentComplete
must be a number between 0 and 1. If you use more than 1 it will count as 100%.
In programming this behavior is widely used, as 50%
is just 50/100 = 0.5
, for example.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.