Skip to content

Commit 9e2123f

Browse files
committed
allow dynamic change of card selection color
1 parent dd12b94 commit 9e2123f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/components/card/index.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,16 +172,23 @@ class Card extends PureBaseComponent {
172172
const {selectionOptions, borderRadius, selected} = this.getThemeProps();
173173
const {animatedSelected} = this.state;
174174

175+
const selectionColor = _.get(selectionOptions, 'color', DEFAULT_SELECTION_PROPS.color);
176+
175177
if (_.isUndefined(selected)) {
176178
return null;
177179
}
178180

179181
return (
180182
<Animated.View
181-
style={[this.styles.selectedBorder, borderRadius && {borderRadius}, {opacity: animatedSelected}]}
183+
style={[
184+
this.styles.selectedBorder,
185+
{borderColor: selectionColor},
186+
borderRadius && {borderRadius},
187+
{opacity: animatedSelected},
188+
]}
182189
pointerEvents="none"
183190
>
184-
<View style={this.styles.selectedIndicator}>
191+
<View style={[this.styles.selectedIndicator, {backgroundColor: selectionColor}]}>
185192
<Image source={_.get(selectionOptions, 'icon', DEFAULT_SELECTION_PROPS.icon)} />
186193
</View>
187194
</Animated.View>

0 commit comments

Comments
 (0)