Skip to content
This repository was archived by the owner on Nov 27, 2022. It is now read-only.

Commit 858801b

Browse files
committed
breaking: remove <TabBarBottom />
1 parent a623d7e commit 858801b

File tree

8 files changed

+30
-66
lines changed

8 files changed

+30
-66
lines changed

README.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ The package exposes the following components,
111111

112112
It accepts the following props,
113113
- `pressColor` - color for material ripple (Android > 5.0 only)
114-
- `renderIcon` - callback which receives the current scene and returns a React Element to be used as a icon
115-
- `renderLabel` - callback which receives the current scene and returns a React Element to be used as a label
116-
- `renderIndicator` - callback which receives the current scene and returns a React Element to be used as a indicator
114+
- `renderIcon` - optiona; callback which receives the current scene and returns a React Element to be used as a icon
115+
- `renderLabel` - optional callback which receives the current scene and returns a React Element to be used as a label
116+
- `renderIndicator` - optional callback which receives the current scene and returns a React Element to be used as a indicator
117117
- `tabStyle` - style object for the tab
118118
- `indicatorStyle` - style object for the tab indicator
119119

@@ -122,8 +122,3 @@ The package exposes the following components,
122122
It accepts the following props in addition to the props accepted by `<TabBar />`,
123123
- `renderLabel` - optional callback which receives the current scene and returns a React Element to be used as a label
124124
- `indicatorStyle` - style object for the tab indicator
125-
126-
- `<TabBarTop />` - material design themed bottom tab bar
127-
128-
It accepts the following props in addition to the props accepted by `<TabBar />`,
129-
- `renderLabel` - optional callback which receives the current scene and returns a React Element to be used as a label

example/src/BottomBarIconExample.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { Component } from 'react';
22
import { View, Image, StyleSheet } from 'react-native';
3-
import { TabViewAnimated, TabViewPage, TabBarBottom } from 'react-native-tab-view';
3+
import { TabViewAnimated, TabViewPage, TabBar } from 'react-native-tab-view';
44

55
const styles = StyleSheet.create({
66
container: {
@@ -53,7 +53,7 @@ export default class TopBarIconExample extends Component {
5353

5454
_renderFooter = (props) => {
5555
return (
56-
<TabBarBottom
56+
<TabBar
5757
{...props}
5858
pressColor='rgba(0, 0, 0, .2)'
5959
renderIcon={this._renderIcon}

example/src/BottomBarIconTextExample.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { Component } from 'react';
22
import { View, Image, StyleSheet } from 'react-native';
3-
import { TabViewAnimated, TabViewPage, TabBarBottom } from 'react-native-tab-view';
3+
import { TabViewAnimated, TabViewPage, TabBar } from 'react-native-tab-view';
44

55
const styles = StyleSheet.create({
66
container: {
@@ -14,6 +14,9 @@ const styles = StyleSheet.create({
1414
alignItems: 'center',
1515
justifyContent: 'center',
1616
},
17+
tab: {
18+
padding: 0,
19+
},
1720
});
1821

1922
export default class TopBarIconExample extends Component {
@@ -53,10 +56,11 @@ export default class TopBarIconExample extends Component {
5356

5457
_renderFooter = (props) => {
5558
return (
56-
<TabBarBottom
59+
<TabBar
5760
{...props}
5861
pressColor='rgba(0, 0, 0, .2)'
5962
renderIcon={this._renderIcon}
63+
tabStyle={styles.tab}
6064
style={styles.tabbar}
6165
/>
6266
);

example/src/NoAnimationExample.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { Component } from 'react';
22
import { View, Image, StyleSheet } from 'react-native';
3-
import { TabViewAnimated, TabViewPage, TabBarBottom } from 'react-native-tab-view';
3+
import { TabViewAnimated, TabViewPage, TabBar } from 'react-native-tab-view';
44

55
const styles = StyleSheet.create({
66
container: {
@@ -53,7 +53,7 @@ export default class TopBarIconExample extends Component {
5353

5454
_renderFooter = (props) => {
5555
return (
56-
<TabBarBottom
56+
<TabBar
5757
{...props}
5858
pressColor='rgba(0, 0, 0, .2)'
5959
renderIcon={this._renderIcon}

index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@ export { default as TabViewAnimated } from './src/TabViewAnimated';
33
export { default as TabViewPage } from './src/TabViewPage';
44
export { default as TabBar } from './src/TabBar';
55
export { default as TabBarTop } from './src/TabBarTop';
6-
export { default as TabBarBottom } from './src/TabBarBottom';

src/TabBar.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
Animated,
66
StyleSheet,
77
View,
8+
Text,
89
} from 'react-native';
910
import shallowCompare from 'react-addons-shallow-compare';
1011
import TouchableItem from './TouchableItem';
@@ -18,6 +19,10 @@ const styles = StyleSheet.create({
1819
flexWrap: 'nowrap',
1920
elevation: 4,
2021
},
22+
tablabel: {
23+
color: 'white',
24+
margin: 8,
25+
},
2126
tab: {
2227
flex: 1,
2328
},
@@ -29,16 +34,20 @@ const styles = StyleSheet.create({
2934
},
3035
});
3136

37+
type DefaultProps = {
38+
renderLabel: (scene: Scene) => ?React.Element<any>;
39+
}
40+
3241
type Props = SceneRendererProps & {
3342
pressColor?: string;
34-
renderLabel: (scene: Scene) => React.Element<any>;
35-
renderIcon: (scene: Scene) => React.Element<any>;
36-
renderIndicator: (props: SceneRendererProps) => React.Element<any>;
43+
renderLabel?: (scene: Scene) => ?React.Element<any>;
44+
renderIcon?: (scene: Scene) => ?React.Element<any>;
45+
renderIndicator?: (props: SceneRendererProps) => ?React.Element<any>;
3746
tabStyle?: any;
3847
style?: any;
3948
}
4049

41-
export default class TabBarTop extends Component<void, Props, void> {
50+
export default class TabBarTop extends Component<DefaultProps, Props, void> {
4251
static propTypes = {
4352
...SceneRendererPropType,
4453
pressColor: TouchableItem.propTypes.pressColor,
@@ -49,6 +58,10 @@ export default class TabBarTop extends Component<void, Props, void> {
4958
style: View.propTypes.style,
5059
};
5160

61+
static defaultProps = {
62+
renderLabel: ({ route }) => route.title ? <Text style={styles.tablabel}>{route.title}</Text> : null,
63+
};
64+
5265
shouldComponentUpdate(nextProps: Props, nextState: void) {
5366
return shallowCompare(this, nextProps, nextState);
5467
}

src/TabBarBottom.js

Lines changed: 0 additions & 46 deletions
This file was deleted.

src/TabBarTop.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import type { Scene, SceneRendererProps } from './TabViewTypeDefinitions';
1515
const styles = StyleSheet.create({
1616
tablabel: {
1717
color: 'white',
18-
fontSize: 14,
1918
margin: 8,
2019
},
2120
indicator: {

0 commit comments

Comments
 (0)