Skip to content

TabBar - start deprecation process. #1545

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions demo/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,6 @@ module.exports = {
get TabControllerScreen() {
return require('./screens/componentScreens/TabControllerScreen').default;
},
get TabBarScreen() {
return require('./screens/componentScreens/TabBarScreen').default;
},
get TextScreen() {
return require('./screens/componentScreens/TextScreen').default;
},
Expand Down
1 change: 0 additions & 1 deletion demo/src/screens/MenuStructure.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ export const navigationData = {
{title: 'Modal', tags: 'modal topbar screen', screen: 'unicorn.screens.ModalScreen'},
{title: 'StateScreen', tags: 'empty state screen', screen: 'unicorn.screens.EmptyStateScreen'},
{title: 'TabController', tags: 'tabbar controller native', screen: 'unicorn.components.TabControllerScreen'},
{title: 'TabBar', tags: 'tab bar', screen: 'unicorn.components.TabBarScreen'},
{
title: 'withScrollEnabler',
tags: 'scroll enabled withScrollEnabler',
Expand Down
257 changes: 0 additions & 257 deletions demo/src/screens/componentScreens/TabBarScreen.tsx

This file was deleted.

1 change: 0 additions & 1 deletion demo/src/screens/componentScreens/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export function registerScreens(registrar) {
registrar('unicorn.components.SwitchScreen', () => require('./SwitchScreen').default);
registrar('unicorn.components.ToastsScreen', () => require('./ToastsScreen').default);
registrar('unicorn.components.TabControllerScreen', () => require('./TabControllerScreen').default);
registrar('unicorn.components.TabBarScreen', () => require('./TabBarScreen').default);
registrar('unicorn.components.TextScreen', () => require('./TextScreen').default);
registrar('unicorn.components.TextFieldScreen', () => require('./TextFieldScreen').default);
registrar('unicorn.wrappers.TouchableOpacityScreen', () => require('./TouchableOpacityScreen').default);
Expand Down
42 changes: 24 additions & 18 deletions demo/src/screens/foundationScreens/TypographyScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import _ from 'lodash';
import PropTypes from 'prop-types';
import React, {Component} from 'react';
import {ScrollView} from 'react-native';
import {TabBar, Colors, Typography, View, Text} from 'react-native-ui-lib';
import {TabController, Colors, Typography, View, Text} from 'react-native-ui-lib';


const WEIGHTS = ['Thin', 'Light', 'Default', 'Regular', 'Medium', 'Bold', 'Heavy', 'Black'];

Expand All @@ -15,10 +16,6 @@ export default class TypographyScreen extends Component {
color: Colors.grey10
};

state = {
currentPage: 0
};

getWeightSuffix(weight) {
if (weight === 'Default') {
return '';
Expand All @@ -30,10 +27,9 @@ export default class TypographyScreen extends Component {
}
}

renderPage() {
renderPage(index = 0) {
const {color} = this.props;
const {currentPage} = this.state;
const weight = WEIGHTS[currentPage];
const weight = WEIGHTS[index];
const weightSuffix = this.getWeightSuffix(weight);
return (
<ScrollView>
Expand Down Expand Up @@ -62,19 +58,29 @@ export default class TypographyScreen extends Component {
);
}

render() {
const {currentPage} = this.state;
renderPages() {
return (
<View flex>
<TabBar selectedIndex={currentPage} onChangeIndex={index => this.setState({currentPage: index})}>
{_.map(WEIGHTS, weight => (
<TabBar.Item key={weight} label={weight}/>
))}
</TabBar>
<View flex>
{this.renderPage()}
</View>
{_.map(WEIGHTS, (item, index) => {
return (
<TabController.TabPage key={`${item.title}_page`} index={index}>
{this.renderPage(index)}
</TabController.TabPage>
);
})}
</View>
);
}

render() {
return (
<TabController>
<TabController.TabBar
items={WEIGHTS.map(item => ({label: item, key: item}))}
activeBackgroundColor={Colors.blue70}
/>
{this.renderPages()}
</TabController>
);
}
}
15 changes: 0 additions & 15 deletions eslint-rules/tests/lib/rules/typography-deprecation.js
Original file line number Diff line number Diff line change
Expand Up @@ -692,21 +692,6 @@ ruleTester.run('typography-deprecation', rule, {
// options: options,
// code: `
// import React, {Component} from 'react';
// import {Typography, TabBar} from 'our-source';
// export default class OurList extends Component {
// render() {
// const titleVal = true;
// return (
// <TabBar labelStyle={{title: titleVal}} selectedLabelStyle={{title: titleVal}}/>
// )
// }
// }`,
// errors: [{message: `'Typography.title' is deprecated. Please use 'Typography.heading' instead (fix is available).`}]
// },
// {
// options: options,
// code: `
// import React, {Component} from 'react';
// import {Typography, Label} from 'our-source';
// export default class OurList extends Component {
// render() {
Expand Down
3 changes: 0 additions & 3 deletions markdowns/getting-started/v5.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ Implementation had slightly changed, please see [example screen](https://github.
- `relative` value for `position` prop was removed
- Blur effect is not part of the component

#### TabBar
Implementation had slightly changed, please see [example screen](https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/TabBarScreen.tsx)

#### ListItem
Component not supporting animation out of the box (animatable wrapper was removed)

Expand Down
2 changes: 1 addition & 1 deletion src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export default {
get TabController() {
return require('./tabController').default;
},
get TabBar() {
get TabBar() { //TODO: remove on V7
return require('./tabBar').default;
},
get ChipsInput() {
Expand Down
Loading