Skip to content

Commit d16185d

Browse files
committed
Change interfaces names for TabController related classes
1 parent 0178216 commit d16185d

File tree

12 files changed

+40
-38
lines changed

12 files changed

+40
-38
lines changed

demo/src/screens/componentScreens/TabControllerScreen/index.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, {Component} from 'react';
22
import {ActivityIndicator} from 'react-native';
3-
import {Assets, TabController, Colors, View, Text, Button, TabBarItemProps} from 'react-native-ui-lib';
3+
import {Assets, TabController, Colors, View, Text, Button, TabControllerItemProps} from 'react-native-ui-lib';
44
import {gestureHandlerRootHOC} from 'react-native-gesture-handler';
55
import _ from 'lodash';
66

@@ -16,7 +16,7 @@ interface State {
1616
fewItems: boolean;
1717
selectedIndex: number;
1818
key: string | number;
19-
items: TabBarItemProps[];
19+
items: TabControllerItemProps[];
2020
}
2121

2222
class TabControllerScreen extends Component<{}, State> {
@@ -35,13 +35,13 @@ class TabControllerScreen extends Component<{}, State> {
3535
this.state.items = this.generateTabItems();
3636
}
3737

38-
generateTabItems = (fewItems = this.state.fewItems, centerSelected = this.state.centerSelected): TabBarItemProps[] => {
39-
let items: TabBarItemProps[] = _.chain(TABS)
38+
generateTabItems = (fewItems = this.state.fewItems, centerSelected = this.state.centerSelected): TabControllerItemProps[] => {
39+
let items: TabControllerItemProps[] = _.chain(TABS)
4040
.take(fewItems ? 3 : TABS.length)
41-
.map<TabBarItemProps>(tab => ({label: tab, key: tab}))
41+
.map<TabControllerItemProps>(tab => ({label: tab, key: tab}))
4242
.value();
4343

44-
const addItem: TabBarItemProps = {icon: Assets.icons.demo.add, key: 'add', ignore: true, width: 60, onPress: this.onAddItem};
44+
const addItem: TabControllerItemProps = {icon: Assets.icons.demo.add, key: 'add', ignore: true, width: 60, onPress: this.onAddItem};
4545

4646
if (!centerSelected) {
4747
items = [...items, addItem];

generatedTypes/components/tabController/PageCarousel.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { PureComponent } from 'react';
2+
import _ from 'lodash';
23
import Animated from 'react-native-reanimated';
34
/**
45
* @description: TabController's Page Carousel
@@ -13,7 +14,7 @@ declare class PageCarousel extends PureComponent {
1314
componentDidMount(): void;
1415
onTabChange: ([index]: readonly number[]) => void;
1516
scrollToPage: (pageIndex: number) => void;
16-
renderCodeBlock: () => Animated.Node<number>;
17+
renderCodeBlock: (() => JSX.Element) & _.MemoizedFunction;
1718
render(): JSX.Element;
1819
}
1920
export default PageCarousel;

generatedTypes/components/tabController/TabBar.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import React from 'react';
22
import { TextProps, StyleProp, ViewStyle } from 'react-native';
3-
import { TabBarItemProps } from './TabBarItem';
4-
export interface TabBarProps {
3+
import { TabControllerItemProps } from './TabBarItem';
4+
export interface TabControllerBarProps {
55
/**
66
* The list of tab bar items
77
*/
8-
items?: TabBarItemProps[];
8+
items?: TabControllerItemProps[];
99
/**
1010
* Tab Bar height
1111
*/
@@ -76,7 +76,7 @@ export interface TabBarProps {
7676
*/
7777
testID?: string;
7878
}
79-
declare const _default: React.ComponentClass<TabBarProps & {
79+
declare const _default: React.ComponentClass<TabControllerBarProps & {
8080
useCustomTheme?: boolean | undefined;
8181
}, any>;
8282
export default _default;

generatedTypes/components/tabController/TabBarItem.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Animated from 'react-native-reanimated';
66
import { State } from 'react-native-gesture-handler';
77
import { BadgeProps } from '../../components/badge';
88
import { TouchableOpacityProps } from '../../incubator';
9-
export interface TabBarItemProps {
9+
export interface TabControllerItemProps {
1010
/**
1111
* label of the tab
1212
*/
@@ -77,7 +77,7 @@ export interface TabBarItemProps {
7777
*/
7878
testID?: string;
7979
}
80-
interface Props extends TabBarItemProps {
80+
interface Props extends TabControllerItemProps {
8181
index: number;
8282
targetPage: any;
8383
state: State;

generatedTypes/components/tabController/TabPage.d.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { PureComponent } from 'react';
22
import Reanimated from 'react-native-reanimated';
3-
export interface TabPageProps {
3+
import _ from 'lodash';
4+
export interface TabControllerPageProps {
45
/**
56
* The index of the the TabPage
67
*/
@@ -26,7 +27,7 @@ export interface TabPageProps {
2627
* @description: TabController's TabPage
2728
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/TabControllerScreen/index.js
2829
*/
29-
export default class TabPage extends PureComponent<TabPageProps> {
30+
export default class TabPage extends PureComponent<TabControllerPageProps> {
3031
static displayName: string;
3132
static contextType: React.Context<{}>;
3233
static defaultProps: {
@@ -65,6 +66,6 @@ export default class TabPage extends PureComponent<TabPageProps> {
6566
width?: undefined;
6667
} | undefined)[];
6768
lazyLoad: () => void;
68-
renderCodeBlock: () => Reanimated.Node<number>;
69+
renderCodeBlock: (() => JSX.Element) & _.MemoizedFunction;
6970
render(): JSX.Element;
7071
}

generatedTypes/components/tabController/index.d.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import React, { Component } from 'react';
2-
import Reanimated from 'react-native-reanimated';
2+
import _ from 'lodash';
33
import TabBar from './TabBar';
4-
import TabBarItem, { TabBarItemProps } from './TabBarItem';
4+
import TabBarItem, { TabControllerItemProps } from './TabBarItem';
55
import TabPage from './TabPage';
66
import PageCarousel from './PageCarousel';
7-
export { TabBarItemProps };
7+
export { TabControllerItemProps };
88
export interface TabControllerProps {
99
/**
1010
* The list of tab bar items
1111
*/
12-
items: TabBarItemProps[];
12+
items: TabControllerItemProps[];
1313
/**
1414
* Initial selected index
1515
*/
@@ -67,7 +67,7 @@ declare class TabController extends Component<TabControllerProps, StateProps> {
6767
get pageWidth(): number;
6868
registerTabItems: (tabItemsCount: number, ignoredItems: StateProps['ignoredItems']) => void;
6969
onPageChange: ([index]: readonly number[]) => void;
70-
renderCodeBlock: () => Reanimated.Node<number>;
70+
renderCodeBlock: (() => JSX.Element) & _.MemoizedFunction;
7171
render(): JSX.Element;
7272
}
7373
declare const _default: React.ComponentClass<TabControllerProps & {

generatedTypes/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export {default as Overlay, OverlayTypes} from './components/overlay';
4242
export {default as RadioButton, RadioButtonPropTypes, RadioButtonProps} from './components/radioButton/RadioButton';
4343
export {default as RadioGroup, RadioGroupPropTypes, RadioGroupProps} from './components/radioButton/RadioGroup';
4444
export {default as Switch, SwitchProps} from './components/switch';
45-
export {default as TabController, TabControllerProps, TabBarItemProps} from './components/tabController';
45+
export {default as TabController, TabControllerProps, TabControllerItemProps} from './components/tabController';
4646
export {default as TabBar, TabBarProps} from './components/TabBar';
4747
export {default as Fader, FaderProps, FaderPosition} from './components/fader';
4848
export {default as ExpandableSection, ExpandableSectionProps} from './components/expandableSection';

src/components/tabController/TabBar.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import Reanimated from 'react-native-reanimated';
1616
import _ from 'lodash';
1717

1818
import TabBarContext from './TabBarContext';
19-
import TabBarItem, {TabBarItemProps} from './TabBarItem';
19+
import TabBarItem, {TabControllerItemProps} from './TabBarItem';
2020
import {asBaseComponent, forwardRef, BaseComponentInjectedProps, ForwardRefInjectedProps} from '../../commons/new';
2121
import View from '../../components/view';
2222
import ScrollBarGradient from '../scrollBar/ScrollBarGradient';
@@ -42,11 +42,11 @@ const DEFAULT_SELECTED_LABEL_STYLE = {
4242
letterSpacing: 0
4343
};
4444

45-
export interface TabBarProps {
45+
export interface TabControllerBarProps {
4646
/**
4747
* The list of tab bar items
4848
*/
49-
items?: TabBarItemProps[];
49+
items?: TabControllerItemProps[];
5050
/**
5151
* Tab Bar height
5252
*/
@@ -122,9 +122,9 @@ export interface TabBarProps {
122122
testID?: string;
123123
}
124124

125-
type ChildProps = React.ReactElement<TabBarItemProps>;
125+
type ChildProps = React.ReactElement<TabControllerItemProps>;
126126

127-
interface Props extends TabBarProps, BaseComponentInjectedProps, ForwardRefInjectedProps {
127+
interface Props extends TabControllerBarProps, BaseComponentInjectedProps, ForwardRefInjectedProps {
128128
children?: ChildProps[] | ChildProps;
129129
}
130130

@@ -431,7 +431,7 @@ class TabBar extends PureComponent<Props, State> {
431431
renderCodeBlock = _.memoize(() => {
432432
const {currentPage, targetPage} = this.context;
433433
const {itemsWidths, itemsOffsets} = this.state;
434-
const nodes = [];
434+
const nodes: any[] = [];
435435

436436
nodes.push(set(this._indicatorOffset,
437437
interpolate(currentPage, {
@@ -529,4 +529,4 @@ const styles = StyleSheet.create({
529529
}
530530
});
531531

532-
export default asBaseComponent<TabBarProps>(forwardRef<Props>(TabBar));
532+
export default asBaseComponent<TabControllerBarProps>(forwardRef<Props>(TabBar));

src/components/tabController/TabBarItem.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const {cond, eq, call, block, event, and} = Reanimated;
2222
const DEFAULT_LABEL_COLOR = Colors.black;
2323
const DEFAULT_SELECTED_LABEL_COLOR = Colors.blue30;
2424

25-
export interface TabBarItemProps {
25+
export interface TabControllerItemProps {
2626
/**
2727
* label of the tab
2828
*/
@@ -102,7 +102,7 @@ export interface TabBarItemProps {
102102
testID?: string;
103103
}
104104

105-
interface Props extends TabBarItemProps {
105+
interface Props extends TabControllerItemProps {
106106
index: number;
107107
targetPage: any; // TODO: typescript?
108108
state: State;

src/components/tabController/TabPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {Constants} from '../../helpers';
77

88
const {Code, Value, cond, set, and, call, block, eq} = Reanimated;
99

10-
export interface TabPageProps {
10+
export interface TabControllerPageProps {
1111
/**
1212
* The index of the the TabPage
1313
*/
@@ -34,7 +34,7 @@ export interface TabPageProps {
3434
* @description: TabController's TabPage
3535
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/TabControllerScreen/index.js
3636
*/
37-
export default class TabPage extends PureComponent<TabPageProps> {
37+
export default class TabPage extends PureComponent<TabControllerPageProps> {
3838
static displayName = 'TabController.TabPage';
3939

4040
static contextType = TabBarContext;

src/components/tabController/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import {Constants} from '../../helpers';
88
import {asBaseComponent} from '../../commons/new';
99
import TabBarContext from './TabBarContext';
1010
import TabBar from './TabBar';
11-
import TabBarItem, {TabBarItemProps} from './TabBarItem';
11+
import TabBarItem, {TabControllerItemProps} from './TabBarItem';
1212
import TabPage from './TabPage';
1313
import PageCarousel from './PageCarousel';
14-
export {TabBarItemProps};
14+
export {TabControllerItemProps};
1515

1616
const {
1717
and,
@@ -41,7 +41,7 @@ export interface TabControllerProps {
4141
/**
4242
* The list of tab bar items
4343
*/
44-
items: TabBarItemProps[];
44+
items: TabControllerItemProps[];
4545
/**
4646
* Initial selected index
4747
*/
@@ -110,7 +110,7 @@ class TabController extends Component<TabControllerProps, StateProps> {
110110
.size()
111111
.value();
112112
itemStates = _.times(itemsCount, () => new Value(State.UNDETERMINED));
113-
ignoredItems = _.filter<TabBarItemProps[]>(props.items, (item: TabBarItemProps) => item.ignore);
113+
ignoredItems = _.filter<TabControllerItemProps[]>(props.items, (item: TabControllerItemProps) => item.ignore);
114114
}
115115

116116
this.state = {

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export {default as Overlay, OverlayTypes} from './components/overlay';
3636
export {default as RadioButton, RadioButtonPropTypes, RadioButtonProps} from './components/radioButton/RadioButton';
3737
export {default as RadioGroup, RadioGroupPropTypes, RadioGroupProps} from './components/radioButton/RadioGroup';
3838
export {default as Switch, SwitchProps} from './components/switch';
39-
export {default as TabController, TabControllerProps, TabBarItemProps} from './components/tabController';
39+
export {default as TabController, TabControllerProps, TabControllerItemProps} from './components/tabController';
4040
export {default as TabBar, TabBarProps} from './components/TabBar';
4141
export {default as Fader, FaderProps, FaderPosition} from './components/fader';
4242
export {default as ExpandableSection, ExpandableSectionProps} from './components/expandableSection';

0 commit comments

Comments
 (0)