Skip to content

Commit 37d8440

Browse files
yungstersfacebook-github-bot
authored andcommitted
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
1 parent 15e2dcf commit 37d8440

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Libraries/Components/Touchable/TouchableHighlight.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,12 @@ class TouchableHighlight extends React.Component<Props, State> {
237237
_createExtraStyles(): ExtraStyles {
238238
return {
239239
child: {opacity: this.props.activeOpacity ?? 0.85},
240-
underlay: {backgroundColor: this.props.underlayColor ?? 'black'},
240+
underlay: {
241+
backgroundColor:
242+
this.props.underlayColor === undefined
243+
? 'black'
244+
: this.props.underlayColor,
245+
},
241246
};
242247
}
243248

0 commit comments

Comments
 (0)