Skip to content
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

RN 0.63.1: ActivityIndicator disapearing #29378

Closed
ptgamr opened this issue Jul 15, 2020 · 15 comments
Closed

RN 0.63.1: ActivityIndicator disapearing #29378

ptgamr opened this issue Jul 15, 2020 · 15 comments

Comments

@ptgamr
Copy link

ptgamr commented Jul 15, 2020

Description

With the default usage of <ActivityIndicator />, the indicators are all disappearing. But when I add the color prop, <ActivityIndicator color="red" />, I can then see the indicator again.

React Native version:

System:
OS: Linux 5.4 Ubuntu 20.04 LTS (Focal Fossa)
CPU: (6) x64 Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz
Memory: 4.74 GB / 15.59 GB
Shell: 5.8 - /usr/bin/zsh
Binaries:
Node: 12.14.1 - ~/.nvm/versions/node/v12.14.1/bin/node
Yarn: 1.22.4 - /usr/bin/yarn
npm: 6.13.4 - ~/.nvm/versions/node/v12.14.1/bin/npm
Watchman: Not Found
SDKs:
Android SDK:
API Levels: 23, 25, 26, 28
Build Tools: 28.0.3, 29.0.2
System Images: android-24 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: Not Found
Languages:
Java: 1.8.0_252 - /usr/bin/javac
Python: 2.7.18 - /usr/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.13.1 => 16.13.1
react-native: 0.63.1 => 0.63.1
npmGlobalPackages:
react-native: Not Found

Steps To Reproduce

Any usage of <ActivityIndicator /> inside the source code is not working. Can reproduce with the starter project:

npx react-native init RN063

Expected Results

The indicator should be visible with the default color if the color props is not specified

Snack, code example, screenshot, or link to a repository:

N/A

@Ashoat
Copy link
Contributor

Ashoat commented Jul 15, 2020

Is this for iOS, Android, or both?

@ptgamr
Copy link
Author

ptgamr commented Jul 15, 2020

@Ashoat sorry I forgot to mentioned in the description. It's happening only on Android.

@geniuscva
Copy link

having the same problem with RN 0.63.1

@hamaron
Copy link
Contributor

hamaron commented Jul 29, 2020

Confirmed the same behavior on RN 0.63.2

1 similar comment
@vamvoukas
Copy link

Confirmed the same behavior on RN 0.63.2

@mattijsf
Copy link
Contributor

mattijsf commented Aug 1, 2020

Even though it is a different component it feels somewhat related to #29412 It seems that in 0.63.x the way tinting is handled is flaky on Android.

@CDBridger
Copy link

CDBridger commented Aug 13, 2020

I'm getting this as well (on android), additionally, when I do specify a colour, the component shows, but it is not animating, it just shows a static icon. I'm running 0.63.2, it worked fine when I was running 0.62.x

EDIT: Turns out the indicator not animating was somehow my android developer options had defaulted to no animation (0x)

@Mayaela
Copy link

Mayaela commented Sep 10, 2020

I have a similar issue and the last version of RN as well. Some of my images are starting to disappear on android. The png files I use do have colors and show up correctly on ios. The image takes up the space it's supposed to but it isn't visible unless I give it an explicit tint color.

@nzjoel1234
Copy link

This is also happening on my S20 version 0.63.3

@jasperkuperus
Copy link

Indeed, same issue on Android 0.63.3. Thanks for the workaround with the color prop @ptgamr. That's a lifesaver 😊

Ashoat added a commit to CommE2E/comm that referenced this issue Oct 28, 2020
Summary:
This is a follow-up to the RN0.63 upgrade. Full context is in [this issue](facebook/react-native#29378).

Basically, there is a regression in RN0.63 for Android where if you don't set `color` for an `ActivityIndicator`, it won't display.

Test Plan: I tested both callsites in the Android emulator. Before this diff the `ActivityIndicator` was invisible, and after this diff it was visible. For the `MoreScreen` case, since it was theme-dependent I tested for both light and dark themes.

Reviewers: palys-swm

Reviewed By: palys-swm

Subscribers: KatPo, zrebcu411, Adrian

Differential Revision: https://phabricator.ashoat.com/D330
@cromatikap
Copy link

Apparently #29830 is the universal PR to fix this but it's been blocked since almost 2 months now.
Is there any way other than adding a color prop to each ActivityIndicator component sitting in my code to solve it before the PR get merged?

@niktechnopro
Copy link

niktechnopro commented Dec 4, 2020

adding prop fixed the issue for me

@fabOnReact
Copy link
Contributor

as explained in #29412 (comment) I believe pr #29830 would fix also #29412 Thanks

@cromatikap
Copy link

as explained in #29412 (comment) I believe pr #29830 would fix also #29412 Thanks

Thank you for your update @fabriziobertoglio1987
Do you have any information regarding my #29378 (comment) ?

@AlexanderMelchers
Copy link

+1 on this issue: ActivityIndicator not showing up on Android without specifying the color-attribute.

kelset pushed a commit that referenced this issue Aug 19, 2021
…or instead of transparent (#29830)

Summary:
This pr:
- Fixes: #30183
- Fixes: #30056
- Fixes: #29950
- Fixes: #29717
- Fixes: #29495
- Fixes: #29412
- Fixes: #29378

Because most of ReactProps(name = ViewProps.COLOR) accept @ Nullable Integer.
For example:
https://github.com/facebook/react-native/blob/abb6433f506851430dffb66f0dd34c1e70a223fe/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.java#L472-L479

After update to react-native 0.63.2 to make PlatformColor work, there is a new ColorPropSetter.
https://github.com/facebook/react-native/blob/abb6433f506851430dffb66f0dd34c1e70a223fe/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagersPropertyCache.java#L194-L215

But ColorPropSetter won't return an nullable value with getValueOrDefault, it will always return it's defaultValue which is 0.
And 0 is equal to TRANSPARENT, will cause <Text /> disappear.
## Changelog

[Android] [Fixed] - ColorProps with value null should be defaultColor instead of transparent

Pull Request resolved: #29830

Test Plan:
Please initiated a new project and replaced the app with the following code:
```
import * as React from 'react';
import {Text, View, TouchableOpacity, PlatformColor} from 'react-native';

export default function App() {
  const [active, setActive] = React.useState(false);

  return (
    <View>
      <Text style={active ? {color: 'green'} : null}>Example</Text>
      <Text
        style={
          active ? {color: PlatformColor('android:color/holo_purple')} : null
        }>
        Example2
      </Text>
      <TouchableOpacity onPress={() => setActive(!active)}>
        <Text>Toggle Active</Text>
      </TouchableOpacity>
    </View>
  );
}
```

Thanks you so much for your code review!

Reviewed By: JoshuaGross

Differential Revision: D30209262

Pulled By: lunaleaps

fbshipit-source-id: bc223f84a92f742266cb7b40eb26722551940d76
@facebook facebook locked as resolved and limited conversation to collaborators Aug 18, 2022
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Aug 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet