7
7
8
8
import React from 'react' ;
9
9
import { StyleSheet , ScrollView , Text , View } from 'react-native' ;
10
- import SegmentedControlIOS from '@react-native-community/segmented-control' ;
10
+ import SegmentedControl from '@react-native-community/segmented-control' ;
11
11
12
12
export default class App extends React . Component < { } , $FlowFixMeState > {
13
13
state = {
@@ -21,30 +21,28 @@ export default class App extends React.Component<{}, $FlowFixMeState> {
21
21
< ScrollView contentContainerStyle = { styles . container } >
22
22
< View style = { styles . segmentContainer } >
23
23
< Text style = { styles . text } > Segmented controls can have values</ Text >
24
- < SegmentedControlIOS values = { [ 'One' , 'Two' ] } />
24
+ < SegmentedControl values = { [ 'One' , 'Two' ] } />
25
25
</ View >
26
26
27
27
< View style = { styles . segmentSection } >
28
- < SegmentedControlIOS
29
- values = { [ 'One' , 'Two' , 'Three' , 'Four' , 'Five' ] }
30
- />
28
+ < SegmentedControl values = { [ 'One' , 'Two' , 'Three' , 'Four' , 'Five' ] } />
31
29
</ View >
32
30
33
31
< View style = { styles . segmentSection } >
34
32
< Text style = { styles . text } >
35
33
Segmented controls can have pre-selected values
36
34
</ Text >
37
- < SegmentedControlIOS values = { [ 'One' , 'Two' ] } selectedIndex = { 0 } />
35
+ < SegmentedControl values = { [ 'One' , 'Two' ] } selectedIndex = { 0 } />
38
36
</ View >
39
37
40
38
< View style = { styles . segmentSection } >
41
39
< Text style = { styles . text } > Segmented controls can be momentary</ Text >
42
- < SegmentedControlIOS values = { [ 'One' , 'Two' ] } momentary = { true } />
40
+ < SegmentedControl values = { [ 'One' , 'Two' ] } momentary = { true } />
43
41
</ View >
44
42
45
43
< View style = { styles . segmentSection } >
46
44
< Text style = { styles . text } > Segmented controls can be disabled</ Text >
47
- < SegmentedControlIOS
45
+ < SegmentedControl
48
46
enabled = { false }
49
47
values = { [ 'One' , 'Two' ] }
50
48
selectedIndex = { 1 }
@@ -53,22 +51,24 @@ export default class App extends React.Component<{}, $FlowFixMeState> {
53
51
54
52
< View style = { styles . segmentContainer } >
55
53
< Text style = { styles . text } > Custom colors can be provided</ Text >
56
- < SegmentedControlIOS
54
+ < SegmentedControl
57
55
tintColor = "#ff0000"
58
56
values = { [ 'One' , 'Two' , 'Three' , 'Four' ] }
59
57
selectedIndex = { 0 }
60
58
backgroundColor = "#0000ff"
59
+ activeTextColor = "white"
61
60
/>
62
61
</ View >
63
62
< View style = { styles . segmentContainer } >
64
- < SegmentedControlIOS
63
+ < SegmentedControl
65
64
tintColor = "#00ff00"
66
65
values = { [ 'One' , 'Two' , 'Three' ] }
67
66
selectedIndex = { 1 }
67
+ activeTextColor = "black"
68
68
/>
69
69
</ View >
70
70
< View style = { styles . segmentSection } >
71
- < SegmentedControlIOS
71
+ < SegmentedControl
72
72
textColor = "#ff00ff"
73
73
values = { [ 'One' , 'Two' ] }
74
74
selectedIndex = { 1 }
@@ -78,7 +78,7 @@ export default class App extends React.Component<{}, $FlowFixMeState> {
78
78
< View >
79
79
< Text style = { styles . text } > Custom colors can be provided</ Text >
80
80
< View style = { styles . segmentContainer } >
81
- < SegmentedControlIOS
81
+ < SegmentedControl
82
82
values = { this . state . values }
83
83
selectedIndex = { this . state . selectedIndex }
84
84
onChange = { this . _onChange }
0 commit comments