Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SegmentedControl comonent selected segment text bug in android #520

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions components/segmented-control/PropsType.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ export interface SegmentedControlPropsType {
values?: string[];
onChange?: (e: any) => void;
onValueChange?: (value: string) => void;
selectedTextColor?: string; //for android platform
}
5 changes: 3 additions & 2 deletions components/segmented-control/segmented.android.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export default class SegmentedControl extends React.Component<
onChange() {},
onValueChange() {},
style: {},
selectedTextColor: '#fff',
};

constructor(props: SegmentControlProps) {
Expand Down Expand Up @@ -82,7 +83,7 @@ export default class SegmentedControl extends React.Component<
}

render() {
const { style, disabled, values = [] } = this.props;
const { style, disabled, values = [], selectedTextColor } = this.props;
let { tintColor } = this.props;
return (
<WithTheme styles={this.props.styles} themeStyles={AndroidStyles}>
Expand Down Expand Up @@ -128,7 +129,7 @@ export default class SegmentedControl extends React.Component<
// tslint:disable-next-line:jsx-no-multiline-js
style={[
styles.itemText,
{ color: idx === selectedIndex ? '#fff' : tintColor },
{ color: idx === selectedIndex ? selectedTextColor : tintColor },
]}
>
{value}
Expand Down