Skip to content

Commit 23cfe8e

Browse files
authored
Revert "TabBar refactor (#1040)" (#1074)
This reverts commit 25a93d3.
1 parent 522cdf9 commit 23cfe8e

File tree

3 files changed

+349
-355
lines changed

3 files changed

+349
-355
lines changed

demo/src/screens/componentScreens/TabBarScreen.tsx

Lines changed: 17 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default class TabBarScreen extends Component {
3737
do {
3838
index = Math.floor(Math.random() * this.tabbar.props.children.length);
3939
} while (index === this.state.selectedIndex);
40-
40+
4141
this.setState({selectedIndex: index});
4242
}
4343
};
@@ -82,7 +82,7 @@ export default class TabBarScreen extends Component {
8282
removeTab = () => {
8383
const index = this.state.selectedIndex;
8484
const newTabs = this.state.currentTabs;
85-
85+
8686
if (newTabs.length >= 0) {
8787
newTabs.splice(index, 1);
8888
}
@@ -92,7 +92,7 @@ export default class TabBarScreen extends Component {
9292
/** Actions */
9393
getTabs(showAddTab: boolean) {
9494
const tabs = _.map(this.state.currentTabs, tab => this.renderTabs(tab));
95-
95+
9696
if (showAddTab) {
9797
tabs.push(this.renderAddTabsTab());
9898
} else {
@@ -126,20 +126,15 @@ export default class TabBarScreen extends Component {
126126
<ScrollView style={{overflow: 'visible'}} showsVerticalScrollIndicator={false}>
127127
<View bg-dark80>
128128
<TabBar style={styles.tabbar} selectedIndex={0} enableShadow>
129-
<TabBar.Item
130-
label="single tab"
129+
<TabBar.Item
130+
label="single tab"
131131
labelStyle={{color: Colors.green30, fontWeight: 'bold', textTransform: 'capitalize'}}
132132
/>
133133
</TabBar>
134134

135-
<TabBar
136-
style={styles.tabbar}
137-
selectedIndex={0}
138-
enableShadow
139-
// tabletMargins={{portrait: 0, landscape: 0}}
140-
>
141-
<TabBar.Item label="Fixed" uppercase backgroundColor={Colors.blue80}/>
142-
<TabBar.Item label="Tab" badgeProps={{label: '100'}} uppercase style={{backgroundColor: Colors.blue80}}/>
135+
<TabBar style={styles.tabbar} selectedIndex={0} enableShadow>
136+
<TabBar.Item label="Fixed" uppercase style={{backgroundColor: Colors.blue80}}/>
137+
<TabBar.Item label="Tab" badge={{label: '100'}} uppercase style={{backgroundColor: Colors.blue80}}/>
143138
<TabBar.Item label="Bar" uppercase style={{backgroundColor: Colors.blue80}}/>
144139
</TabBar>
145140

@@ -151,7 +146,7 @@ export default class TabBarScreen extends Component {
151146

152147
<TabBar style={styles.tabbar} selectedIndex={0} ref={r => (this.tabbar = r)} enableShadow>
153148
<TabBar.Item label="Scroll"/>
154-
<TabBar.Item label="View" badgeProps={{size: 'pimpleSmall'}}/>
149+
<TabBar.Item label="View" badge={{size: 'pimpleSmall'}}/>
155150
<TabBar.Item label="tab"/>
156151
<TabBar.Item label="bar"/>
157152
<TabBar.Item label="Container"/>
@@ -174,20 +169,13 @@ export default class TabBarScreen extends Component {
174169
{this.getTabs(true)}
175170
</TabBar>
176171

177-
<View center>
178-
<Button
179-
size={Button.sizes.small}
180-
margin-20
181-
label={`Change index: ${this.state.selectedIndex}`}
182-
onPress={this.changeIndex}
183-
/>
184-
</View>
185-
<TabBar
186-
style={styles.tabbar}
187-
selectedIndex={this.state.selectedIndex}
188-
enableShadow
189-
backgroundColor={Colors.green70}
190-
>
172+
<Button
173+
size={Button.sizes.small}
174+
margin-20
175+
label={`Change index: ${this.state.selectedIndex}`}
176+
onPress={this.changeIndex}
177+
/>
178+
<TabBar style={styles.tabbar} selectedIndex={this.state.selectedIndex} enableShadow backgroundColor={Colors.green70}>
191179
<TabBar.Item label="LONG LABEL"/>
192180
<TabBar.Item label="ACTIVE"/>
193181
<TabBar.Item label="INACTIVE"/>
@@ -199,7 +187,7 @@ export default class TabBarScreen extends Component {
199187
<TabBar.Item label="MODE"/>
200188
</TabBar>
201189

202-
<View center row>
190+
<View row>
203191
<Button size={Button.sizes.small} margin-20 label={`Change Labels`} onPress={this.changeLabels}/>
204192
<Button size={Button.sizes.small} margin-20 label={`Change Color`} onPress={this.changeColors}/>
205193
</View>

0 commit comments

Comments
 (0)