Skip to content

Commit

Permalink
fix: segmented-control without active style, close #1832
Browse files Browse the repository at this point in the history
  • Loading branch information
silentcloud committed Sep 12, 2017
1 parent 5881ba4 commit fa8a284
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ exports[`renders ./components/segmented-control/demo/basic.md correctly 1`] = `
>
<div
class="am-segment-item-inner"
style="background-color:#ff0000;"
/>
Segment1
</div>
Expand All @@ -149,6 +150,7 @@ exports[`renders ./components/segmented-control/demo/basic.md correctly 1`] = `
>
<div
class="am-segment-item-inner"
style="background-color:#ff0000;"
/>
Segment2
</div>
Expand All @@ -161,6 +163,7 @@ exports[`renders ./components/segmented-control/demo/basic.md correctly 1`] = `
>
<div
class="am-segment-item-inner"
style="background-color:#ff0000;"
/>
Segment3
</div>
Expand Down
6 changes: 5 additions & 1 deletion components/segmented-control/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ export default class SegmentedControl extends React.Component<SegmentedControlPr
borderColor: tintColor,
};

const activeInnerStyle: any = tintColor ? {
backgroundColor: tintColor,
} : {};

return (
<TouchFeedback
key={idx}
Expand All @@ -76,7 +80,7 @@ export default class SegmentedControl extends React.Component<SegmentedControlPr
aria-disabled={disabled}
onClick={disabled ? undefined : (e) => this.onClick(e, idx, value)}
>
<div className={`${prefixCls}-item-inner`} />
<div className={`${prefixCls}-item-inner`} style={activeInnerStyle} />
{value}
</div>
</TouchFeedback>
Expand Down
1 change: 0 additions & 1 deletion components/segmented-control/segmented.android.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export default class SegmentedControl extends React.Component<ISegmentControlNat
super(props);
this.state = {
selectedIndex: props.selectedIndex,
active: false,
};
}

Expand Down
1 change: 1 addition & 0 deletions components/segmented-control/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
width: 100%;
opacity: 0.1;
transition: background .2s;
background-color: @segmented-control-color;
}
}
}
Expand Down

0 comments on commit fa8a284

Please sign in to comment.