-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ActivityIndicator][Android] Indicator stays hidden if initialized as animating={false} #9023
Comments
@kulmajaba Which react-native version are you using ? |
@alannesta Using React Native 0.30. I've used the same workaround, rendering a separate loading view when needed. |
I have the opposite bug: it sometimes freezes instead of hiding |
Same issue on React Native 0.32 on Android 6.0.1 ActivityIndicator did not work so I went back to AndroidProgressBar which had yellow box warning under 0.32 for manually calling a React.PropTypes validation function. ActivityIndicator work-around was to use null when animating should be false
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
The simplest I did was
|
@raphkr i don't like that at all... Then it's always animating... not the best |
I'm seeing this bug on Android too (Android 7.1 emulator). The I think this issue needs to be reopened. |
This one is simple and background is not clickable when loading. Manage the loading icon using this.state.loading
and in styles
|
Can confirm this is still happening in Android RN: 0.51.0. |
This comment has been minimized.
This comment has been minimized.
Let's reopen it then. |
This comment has been minimized.
This comment has been minimized.
<ActivityIndicator
animating={true}
style = {{ opacity : this.state.animate ? 1 : 0 }}
/> |
This is still happening in 0.54.4. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
It's definitely a problem, however solution proposed by @esutton worked out for me |
This comment has been minimized.
This comment has been minimized.
This is still an issue to this day :( |
Is there any way to work around that bug ? |
Still running into this on react-native |
Just ran with this issue on react-native return <ActivityIndicator animating={loading} key={loading ? 'loading' : 'not-loading'} /> |
On Android, if the ActivityIndicator component is initially set to animate={false}, it does not display if later set to true. For some reason, the layout width/height of the associated ProgressBar remains 0, despite the parent layout having the correct width/height. I noticed that changing the visibility settings from View.GONE to View.INVISIBLE didn't have an impact on the React Native layout, and doing so appears to alleviate the issue. Related to: facebook#9023
I think I might have a fix for this here: #25354 Seems too trivial. Curious what others have to say. |
I have the latest version of RN, still getting this issue. |
Still getting this issue with RN 0.61.4 |
…NE to hide ActivityIndicator (facebook#25354) Summary: On Android, if the ActivityIndicator component is initially set to `animate={false}`, it does not display if later set to `true` (facebook#9023) For some reason, the layout width/height of the associated ProgressBar remains 0, despite the parent layout having the correct width/height: ![image](https://user-images.githubusercontent.com/590904/59955251-f8d2ef00-943d-11e9-8019-0977e19186b3.png) I wasn't able to determine why this is the case, but I did notice that changing the visibility settings from `View.GONE` to `View.INVISIBLE` fixes the issue while not (as far as I can tell) having an impact on the React Native layout: #### Before: ![before](https://user-images.githubusercontent.com/590904/59955177-a1cd1a00-943d-11e9-80da-876c99b7d5bf.gif) #### After: ![after](https://user-images.githubusercontent.com/590904/59955183-a7c2fb00-943d-11e9-952b-892bdc23bd48.gif) Using `View.INVISIBLE` appears to alleviate the issue. This should fix facebook#9023 ## Changelog [Android][fixed] - ActivityIndicator appears as expected when `animated={false}` is later set to `true`. Pull Request resolved: facebook#25354 Test Plan: Link this branch to a new React native project with the following App.js class: ```javascript import React, { Component } from "react"; import { StyleSheet, Text, Button, View, ActivityIndicator, TouchableHighlight } from "react-native"; export default class App extends Component { constructor() { super(); this.state = { show: false }; } hide = () => { this.setState({ show: false }); }; show = () => { this.setState({ show: true }); }; render() { return ( <View> <ActivityIndicator animating={this.state.show} size="large" style={styles.indicator} /> <ActivityIndicator animating={this.state.show} size="small" style={styles.indicator} /> <View style={{ flexDirection: "row" }}> <Button title="Hide" style={styles.button} onPress={this.hide} /> <Button title="Show" style={styles.button} onPress={this.show} /> </View> <Text>Showing ? {this.state.show.toString()}</Text> </View> ); } } const styles = StyleSheet.create({ indicator: { borderColor: "red", borderWidth: 1 }, button: { marginRight: 8 } }); ``` Differential Revision: D15963366 Pulled By: cpojer fbshipit-source-id: ee3df3fd84acbff342599dc6f4f4a391704876fa
Originally discovered on http://stackoverflow.com/questions/38579665/reactnative-activityindicator-not-showing-when-animating-property-initiate-false
If
ActivityIndicator
is initialized withanimating={false}
, the Indicator will stay hidden even when changinganimating
totrue
. When initialized as animating the changes behave as expected.Tested on Android emulator and Device, running Android 6.0 and 6.0.1. Also tested on iOS device which works as expected. Testing done with Windows 8.1.
The text was updated successfully, but these errors were encountered: