Skip to content
Permalink
Browse files
Touchable: Restore underlayColor={null} Behavior
Summary:
The former implementations of `TouchableHighlight` used `defaultProps` for `underlayColor`. However, the newly landed implementations use `??` which falls back to the default behavior if the prop is `null`.

This restores the former behavior so that, for example, supplying `underlayColor={null}` to `TouchableHighlight` will not fallback to black. (It probably should always have, but the intention of my rewrite was not to introduce a breaking change.)

Changelog:
[General] [Fixed] - Restore behavior for `underlayColor={null}` in `TouchableHighlight`.

Reviewed By: zackargyle

Differential Revision: D18806494

fbshipit-source-id: 4d33810e2f754f980385d76d81dc0f34006f4337
  • Loading branch information
yungsters authored and facebook-github-bot committed Dec 4, 2019
1 parent 15e2dcf commit 37d8440a8e35a53b81914e429502db527790b3cd
Showing 1 changed file with 6 additions and 1 deletion.
@@ -237,7 +237,12 @@ class TouchableHighlight extends React.Component<Props, State> {
_createExtraStyles(): ExtraStyles {
return {
child: {opacity: this.props.activeOpacity ?? 0.85},
underlay: {backgroundColor: this.props.underlayColor ?? 'black'},
underlay: {
backgroundColor:
this.props.underlayColor === undefined
? 'black'
: this.props.underlayColor,
},
};
}

0 comments on commit 37d8440

Please sign in to comment.