@@ -3,12 +3,16 @@ import { ViewStyle, TextStyle, Text } from 'react-native';
33import  ButtonGroup ,  {  ButtonGroupProps  }  from  '../ButtonGroup' ; 
44import  Button  from  '../Button' ; 
55
6+ interface  textColorType  { 
7+   actived ?: string ; 
8+   unactived ?: string ; 
9+ } 
610export  interface  SegmentedControlProps < T >  extends  ButtonGroupProps  { 
711  value ?: string [ ]  |  T [ ] ; 
812  selectedIndex ?: number ; 
913  renderItem ?: ( label : string  |  T ,  selectedIndex : number ,  props : ButtonGroupProps )  =>  JSX . Element ; 
1014  onValueChange ?: ( label : string  |  T ,  selectedIndex : number )  =>  void ; 
11-   textColor ?: [ string ,   string ] ; 
15+   textColor ?: textColorType ; 
1216} 
1317
1418export  interface  SegmentedControlState  { 
@@ -40,7 +44,10 @@ export default class SegmentedControl<T> extends Component<SegmentedControlProps
4044      value, 
4145      selectedIndex, 
4246      renderItem, 
43-       textColor =  [ '#fff' ,  this . props . color  ??  '#108ee9' ] , 
47+       textColor =  { 
48+         actived : '#fff' , 
49+         unactived : this . props . color  ??  '#108ee9' , 
50+       } , 
4451      ...otherProps 
4552    }  =  this . props ; 
4653    return  ( 
@@ -49,11 +56,11 @@ export default class SegmentedControl<T> extends Component<SegmentedControlProps
4956          ( value  as  ( string  |  T ) [ ] ) . map ( ( label : string  |  T ,  key : number )  =>  { 
5057            const  styl : ViewStyle  =  { } ; 
5158            const  textStyle : TextStyle  =  { } ; 
52-             let  textStyleColor : string  =  textColor [ 0 ] ; 
59+             let  textStyleColor : string  =  textColor . actived ! ; 
5360            if  ( this . state . selectedIndex  !==  key  +  1 )  { 
5461              styl . backgroundColor  =  '#fff' ; 
5562              textStyle . color  =  otherProps . color ; 
56-               textStyleColor  =  textColor [ 1 ] ; 
63+               textStyleColor  =  textColor . unactived ! ; 
5764            } 
5865            const  props : ButtonGroupProps  =  { 
5966              type : 'primary' , 
0 commit comments