Skip to content

ActivityIndicatorIOS doesn't hide initially in 0.27 #7987

Closed

Description

@Purii

There seems to be a bug with ActivityIndicatorIOS in the latest stable release.

  1. Set animating={false} dynamically works as expected (ActivityIndicatorIOS is hidden)
  2. 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.

  1. Fresh project: react-native init helloWorld
  2. Add <ActivityIndicatorIOS animating={false} /> to index.ios.js
  3. Run the simulator, e.g. via react-native run-ios --> Is shown and not animated
  4. Change prop to <ActivityIndicatorIOS animating={true} /> --> Is shown and animated
  5. Change prop back to <ActivityIndicatorIOS animating={false} /> --> Is hidden as it should

Template

...
import {
  AppRegistry,
  ActivityIndicatorIOS,
  StyleSheet,
  Text,
  TouchableOpacity,
  View,
} from 'react-native';
...
class helloWorld extends Component {
  constructor(props) {
    super(props);
    this.state = {
      animateActivityIndicatorIOS: false,
    }
  }
  render() {
    return (
      <View style={styles.container}>
        <TouchableOpacity onPress={() => this.setState({animateActivityIndicatorIOS: !this.state.animateActivityIndicatorIOS})}>
          <Text>Toggle ActivityIndicatorIOS</Text>
        </TouchableOpacity>
        <Text>{'\n'}This ActivityIndicatorIOS should be shown initially, although animating=false:{'\n'}</Text>
        <ActivityIndicatorIOS animating={this.state.animateActivityIndicatorIOS} />
      </View>
    );
  }
}

Activity

  1. charpeni commented on Jun 7, 2016

    @charpeni
    Contributor

    cc @janicduplessis

    Seems related to #7976.

  2. added
    Good first issueInterested in collaborating? Take a stab at fixing one of these issues.
    Help Wanted :octocat:Issues ideal for external contributors.
    on Jun 13, 2016
  3. janicduplessis commented on Jun 13, 2016

    @janicduplessis
    Contributor

    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 :)

  4. ghost added a commit that references this issue on Jun 28, 2016
  5. timjacobi commented on Jul 15, 2016

    @timjacobi

    Can this be closed?

  6. locked as resolved and limited conversation to collaborators on Jul 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Good first issueInterested in collaborating? Take a stab at fixing one of these issues.Help Wanted :octocat:Issues ideal for external contributors.Platform: iOSiOS applications.Resolution: LockedThis issue was locked by the bot.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions