From 49713d2bb1f43049d7491b792e8d52914cacccd8 Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 24 Jun 2019 02:04:04 -0700 Subject: [PATCH] Possible fix for #9023: Use View.INVISIBLE instead of View.GONE to hide ActivityIndicator (#25354) Summary: On Android, if the ActivityIndicator component is initially set to `animate={false}`, it does not display if later set to `true` (https://github.com/facebook/react-native/issues/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 https://github.com/facebook/react-native/issues/9023 ## Changelog [Android][fixed] - ActivityIndicator appears as expected when `animated={false}` is later set to `true`. Pull Request resolved: https://github.com/facebook/react-native/pull/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 (