feat(react-native-elements): add Tabs component

This commit is contained in:
Ifiok Jr
2017-09-17 22:03:21 +01:00
parent 27bb912ad8
commit 2385b0fa66
3 changed files with 85 additions and 2 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ List will update as typings are added
- [x] ButtonGroup
- [x] CheckBoxes
- [x] List Element
- [ ] ~~Tab Bar Component~~ DEPRECATED
- [x] ~~Tab Bar Component~~ DEPRECATED
- [x] HTML style headings
- [x] Card component
- [x] Pricing Component
+15
View File
@@ -25,6 +25,7 @@ import {
Animated,
TransformsStyle
} from 'react-native';
import TabNavigator from 'react-native-tab-navigator';
/**
* Supports auto complete for most used types as well as any other string type.
@@ -2101,3 +2102,17 @@ export class SwipeDeck<D = any> extends React.Component<
SwipeDeckProps<D>,
any
> {}
/**
* @deprecated
* Warning: Tabs has been deprecated and will be removed in a future version of React Native Elements.
* For a complete navigation solution that includes Tabs as well as many other features, be sure to check out react-navigation (https://reactnavigation.org) and it's TabRouter.
*/
export class Tabs extends TabNavigator {}
/**
* @deprecated
* Warning: Tab has been deprecated and will be removed in a future version of React Native Elements.
* For a complete navigation solution that includes Tabs as well as many other features, be sure to check out react-navigation (https://reactnavigation.org) and it's TabRouter.
*/
export class Tab extends TabNavigator.Item {}
@@ -31,7 +31,9 @@ import {
SideMenu,
Slider,
SocialIcon,
SwipeDeck
SwipeDeck,
Tabs,
Tab
} from 'react-native-elements';
const { width, height } = Dimensions.get('window');
@@ -860,3 +862,69 @@ class SwipeDeckTest extends React.Component {
);
}
}
class TabsTest extends React.Component {
state = {
selectedTab: 'profile'
};
changeTab = (selectedTab: string) => {
this.setState({ selectedTab });
}
render() {
const { selectedTab } = this.state;
return (
<Tabs>
<Tab
titleStyle={{ fontWeight: 'bold', fontSize: 10 }}
selectedTitleStyle={{ marginTop: -1, marginBottom: 6 }}
selected={selectedTab === 'feed'}
title={selectedTab === 'feed' ? 'FEED' : undefined}
renderIcon={() => (
<Icon
containerStyle={{
justifyContent: 'center',
alignItems: 'center',
marginTop: 12
}}
color={'#5e6977'}
name="whatshot"
size={33}
/>
)}
renderSelectedIcon={() => (
<Icon color={'#6296f9'} name="whatshot" size={30} />
)}
onPress={() => this.changeTab('feed')}
>
<View />
</Tab>
<Tab
titleStyle={{ fontWeight: 'bold', fontSize: 10 }}
selectedTitleStyle={{ marginTop: -1, marginBottom: 6 }}
selected={selectedTab === 'profile'}
title={selectedTab === 'profile' ? 'PROFILE' : undefined}
renderIcon={() => (
<Icon
containerStyle={{
justifyContent: 'center',
alignItems: 'center',
marginTop: 12
}}
color={'#5e6977'}
name="person"
size={33}
/>
)}
renderSelectedIcon={() => (
<Icon color={'#6296f9'} name="person" size={30} />
)}
onPress={() => this.changeTab('profile')}
>
<View />
</Tab>
</Tabs>
);
}
}