You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ActivityIndicatorIOS doesn't hide initially in 0.27 #7987
There seems to be a bug with ActivityIndicatorIOS in the latest stable release.
Set animating={false}dynamically works as expected (ActivityIndicatorIOS is hidden)
Set animation={false} as initial prop won't hide it.
Reproduce
I assume that HMR is enabled for steps 3-5. Otherwise just use the template below.
Fresh project: react-native init helloWorld
Add <ActivityIndicatorIOS animating={false} /> to index.ios.js
Run the simulator, e.g. via react-native run-ios --> Is shown and not animated
Change prop to <ActivityIndicatorIOS animating={true} /> --> Is shown and animated
Change prop back to <ActivityIndicatorIOS animating={false} /> --> Is hidden as it should
Template
...
import{AppRegistry,ActivityIndicatorIOS,StyleSheet,Text,TouchableOpacity,View,}from'react-native';
...
classhelloWorldextendsComponent{constructor(props){super(props);this.state={animateActivityIndicatorIOS: false,}}render(){return(<Viewstyle={styles.container}><TouchableOpacityonPress={()=>this.setState({animateActivityIndicatorIOS: !this.state.animateActivityIndicatorIOS})}><Text>Toggle ActivityIndicatorIOS</Text></TouchableOpacity><Text>{'\n'}This ActivityIndicatorIOS should be shown initially, although animating=false:{'\n'}</Text><ActivityIndicatorIOSanimating={this.state.animateActivityIndicatorIOS}/></View>);}}
It seems like calling UIActivityIndicator.stopAnimating doesn't work before the view has been layed out. I had a similar issue with RefreshControl and what I ended up doing is calling it in the first call you layoutSubviews. If someone wants to submit a PR to fix this it would be great as I'm pretty busy at the moment :)
ghost added a commit that references this issue on Jun 28, 2016
Activity
charpeni commentedon Jun 7, 2016
cc @janicduplessis
Seems related to #7976.
janicduplessis commentedon Jun 13, 2016
It seems like calling
UIActivityIndicator.stopAnimatingdoesn't work before the view has been layed out. I had a similar issue withRefreshControland what I ended up doing is calling it in the first call youlayoutSubviews. If someone wants to submit a PR to fix this it would be great as I'm pretty busy at the moment :)Fixes ActivityIndicatorIOS doesn't hide initially
Fixes ActivityIndicatorIOS doesn't hide initially
timjacobi commentedon Jul 15, 2016
Can this be closed?