React-native: bug in android on ActivityIndicator!!

Created on 30 Dec 2016  路  9Comments  路  Source: facebook/react-native

image

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

Locked

Most helpful comment

yeah,but when i setstate animating :true it is still hide . if you initial false it is will never show @johnryan

All 9 comments

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:

  • Does the issue still reproduce on the latest release candidate? Post a comment with the version you tested.
  • If so, is there any information missing from the bug report? Post a comment with all the information required by the issue template.
  • Is there a pull request that addresses this issue? Post a comment with the PR number so we can follow up.

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 ,,

Was this page helpful?
0 / 5 - 0 ratings

Related issues

josev55 picture josev55  路  3Comments

anchetaWern picture anchetaWern  路  3Comments

grabbou picture grabbou  路  3Comments

oney picture oney  路  3Comments

despairblue picture despairblue  路  3Comments