
when init the ActivityIndicator 's animating atrribute to be false , it will never be show if you rerender it .
here is source code
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
ActivityIndicator,
View
} from 'react-native';
export default class AwesomeProject extends Component {
constructor(){
super()
this.state = {
isloading:false,
}
}
render() {
return (
<View style={{flex:1}}>
<Text onPress={()=>{
this.setState({isloading:!this.state.isloading })
}}>
click-isloading</Text>
<ActivityIndicator animating={this.state.isloading}/>
</View>
);
}
}
AppRegistry.registerComponent('AwesomeProject', () => AwesomeProject);
android 6.1 ,reactnative 0.39 锛宼he latest version
By default the ActivityIndicator hides when it is stopped. See "hidesWhenStopped": https://facebook.github.io/react-native/docs/activityindicator.html#hideswhenstopped
yeah,but when i setstate animating :true it is still hide . if you initial false it is will never show @johnryan
I have met similar bugs. It is not about activity indicator but how the scene is re-rendered. Interesting is that this rnplay works.
you can work around it by saying {this.state.isloading && <ActivityIndicator/>}
I have same problem. Any solution?
@knapeto have you tried what I suggested?
@vonovak great!!! ,thank you ,but why?
Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally!
If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:
If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.
I met the same problem on android device, but iphone not.
@vonovak your method is perfect.
Hey there ive some problem its want be loading event i change it on true when onPress or using other method ,,
Most helpful comment
yeah,but when i setstate
animating :trueit is still hide . if you initialfalseit is will never show @johnryan