Skip to content

Commit 3fd2850

Browse files
committed
Updated proptypes and added handler for badgesStyle component in the example
1 parent 3be002e commit 3fd2850

File tree

6 files changed

+11211
-12
lines changed

6 files changed

+11211
-12
lines changed

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
.nvmrc
12
Example

Example/ExampleMain.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class ExampleMain extends Component {
1111
super(props);
1212
this.state = {
1313
selectedIndex: 0,
14+
badgesStyleIndex: 0,
1415
customStyleIndex: 0,
1516
}
1617
}
@@ -22,6 +23,13 @@ class ExampleMain extends Component {
2223
});
2324
}
2425

26+
handleBadgesSelect = (index) => {
27+
this.setState({
28+
...this.state,
29+
badgesStyleIndex: index,
30+
});
31+
}
32+
2533
handleCustomIndexSelect = (index) => {
2634
this.setState({
2735
...this.state,
@@ -43,8 +51,8 @@ class ExampleMain extends Component {
4351
<Text style={styles.headerText} >Default segmented with badges</Text>
4452
<SegmentedControlTab
4553
badges={[1, 2, 3]}
46-
selectedIndex={this.state.selectedIndex}
47-
onTabPress={this.handleSingleIndexSelect} />
54+
selectedIndex={this.state.badgesStyleIndex}
55+
onTabPress={this.handleBadgesSelect} />
4856
<View style={styles.Seperator} />
4957

5058
<Text style={styles.headerText} >Custom segmented control with custom styles</Text>

0 commit comments

Comments
 (0)