Skip to content

Commit b25d5d4

Browse files
authored
Fix selected card iconColor (wix#2236)
* Fix selected card iconColor * change _.get to optional chaining
1 parent 990052a commit b25d5d4

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/components/card/index.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ class Card extends PureComponent<PropTypes, State> {
212212
renderSelection() {
213213
const {selectionOptions = {}, selected} = this.props;
214214
const {animatedSelected} = this.state;
215-
const selectionColor = _.get(selectionOptions, 'color', DEFAULT_SELECTION_PROPS.color);
215+
const selectionColor = selectionOptions?.color || DEFAULT_SELECTION_PROPS.color;
216216

217217
if (_.isUndefined(selected)) {
218218
return null;
@@ -231,8 +231,8 @@ class Card extends PureComponent<PropTypes, State> {
231231
{!selectionOptions.hideIndicator && (
232232
<View style={[this.styles.selectedIndicator, {backgroundColor: selectionColor}]}>
233233
<Icon
234-
style={this.styles.selectedIcon}
235-
source={_.get(selectionOptions, 'icon', DEFAULT_SELECTION_PROPS.icon)}
234+
source={selectionOptions?.icon || DEFAULT_SELECTION_PROPS.icon}
235+
tintColor={selectionOptions?.iconColor || DEFAULT_SELECTION_PROPS.iconColor}
236236
/>
237237
</View>
238238
)}
@@ -333,9 +333,6 @@ function createStyles({width, height, borderRadius, selectionOptions}: CardProps
333333
backgroundColor: selectionOptionsWithDefaults.color,
334334
alignItems: 'center',
335335
justifyContent: 'center'
336-
},
337-
selectedIcon: {
338-
tintColor: selectionOptionsWithDefaults.iconColor
339336
}
340337
});
341338
}

0 commit comments

Comments
 (0)