Skip to content

Commit

Permalink
refactor(tab-set): update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Artur Yorsh committed Oct 23, 2018
1 parent a6526fd commit 9e402b0
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 29 deletions.
28 changes: 0 additions & 28 deletions example/screens/TabSetScreen.js

This file was deleted.

2 changes: 1 addition & 1 deletion example/screens/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export * from './ImageScreen';
export * from './GalleryScreen';
export * from './InputScreen';
export * from './TabScreen';
export * from './TabSetScreen';
export * from './tabset/TabSetScreen';
export * from './SettingsScreen';
export * from './ChoiceCustomizationScreen';
export * from './PickerScreen';
Expand Down
39 changes: 39 additions & 0 deletions example/screens/tabset/TabContentScreen.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React from 'react';
import PropTypes from 'prop-types';
import {
View,
Text,
ViewPropTypes,
} from 'react-native';
import { RkStyleSheet } from 'react-native-ui-kitten';

export class TabContentScreen extends React.Component {
static propTypes = {
message: PropTypes.string,
...ViewPropTypes,
};
static defaultProps = {
message: 'I <3 React Native UI Kitten',
};

render() {
return (
<View style={[styles.container, this.props.style]}>
<Text style={styles.text}>{this.props.message}</Text>
</View>
);
}
}

const styles = RkStyleSheet.create(theme => ({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
text: {
color: theme.colors.text.inverse,
fontSize: 18,
fontWeight: '700',
},
}));
49 changes: 49 additions & 0 deletions example/screens/tabset/TabSetScreen.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import React from 'react';
import { View } from 'react-native';
import {
RkTabSet,
RkTabSetItem,
RkStyleSheet,
} from 'react-native-ui-kitten';
import { TabContentScreen } from './TabContentScreen';

export class TabSetScreen extends React.Component {
static navigationOptions = {
title: 'Tab Set',
};
static propTypes = {};

render() {
return (
<View style={styles.container}>
<RkTabSet>
<RkTabSetItem title="Tab #1">
<TabContentScreen style={styles.tabContent1} />
</RkTabSetItem>
<RkTabSetItem title="Tab #2" isSelected={true}>
<TabContentScreen style={styles.tabContent2} message='Tab 2 loves React Native UI Kitten' />
</RkTabSetItem>
<RkTabSetItem title="Tab #3">
<TabContentScreen style={styles.tabContent3} />
</RkTabSetItem>
</RkTabSet>
</View>
);
}
}

const styles = RkStyleSheet.create(theme => ({
container: {
flex: 1,
backgroundColor: theme.colors.background,
},
tabContent1: {
backgroundColor: 'red',
},
tabContent2: {
backgroundColor: 'green',
},
tabContent3: {
backgroundColor: 'blue',
},
}));
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export { RkGalleryImage } from './src/components/gallery/rkGalleryImage';
export { RkCalendar } from './src/components/calendar/rkCalendar.component';
export { RkTabView } from './src/components/tab/rkTabView';
export { RkTabSet } from './src/components/tabset/rkTabSet.component';
export { RkTabSetItem } from './src/components/tabset/rkTabSetItem.component';
export { RkCard } from './src/components/card/rkCard';
export { RkAvoidKeyboard } from './src/components/avoidKeyboard/rkAvoidKeyboard';
export { RkComponent } from './src/components/rkComponent';
Expand Down

0 comments on commit 9e402b0

Please sign in to comment.