Skip to content

TouchableOpacity initial opacity bug #5932

Description

@jdmunro

I've noticed a bug where if you have an opacity set in a style that is used by a TouchableOpacity: the opacity will not be seen until the component has been tapped once. See gif below for an example:

bug

In this example the TouchableOpacity has an opacity specified in a style as 0.2 (to represent a disabled state), however the button must be pressed before the initial opacity is set correctly. You could argue not to use a TouchableOpacity if the component within is disabled however there may be more valid cases for having a different initial opacity.

I believe this could be the source of the bug: https://github.com/facebook/react-native/blob/33d8db599ef8eb85dc27150e04c71719be6ffd26/Libraries/Components/Touchable/TouchableOpacity.js#L72

The default opacity is always set to 1 for the animation. I believe it should take the value from the style if this is possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions