Skip to content

Commit

Permalink
Touchable: Restore underlayColor={null} Behavior
Browse files Browse the repository at this point in the history
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 37d8440
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Libraries/Components/Touchable/TouchableHighlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
};
}

Expand Down

0 comments on commit 37d8440

Please sign in to comment.