Skip to content

Commit 5405420

Browse files
committed
fix for tabbar types for scrollbar
1 parent c8d3ed5 commit 5405420

File tree

4 files changed

+30
-61
lines changed

4 files changed

+30
-61
lines changed

generatedTypes/components/scrollBar/index.d.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { Component } from 'react';
22
import { Animated, FlatListProps, ImageSourcePropType, NativeSyntheticEvent, NativeScrollEvent, LayoutChangeEvent } from 'react-native';
33
import { ForwardRefInjectedProps } from '../../commons/new';
4-
interface Props extends FlatListProps<any>, ForwardRefInjectedProps {
4+
export interface ScrollBarProps extends FlatListProps<any> {
55
/**
66
* Whether to use a FlatList. NOTE: you must pass 'data' and 'renderItem' props as well
77
*/
@@ -44,7 +44,7 @@ interface Props extends FlatListProps<any>, ForwardRefInjectedProps {
4444
*/
4545
focusIndex?: number;
4646
}
47-
export declare type ScrollBarProps = Props;
47+
declare type Props = ScrollBarProps & ForwardRefInjectedProps;
4848
export declare type State = {
4949
gradientOpacity: Animated.Value;
5050
gradientOpacityLeft: Animated.Value;
@@ -83,9 +83,7 @@ declare const Item: {
8383
({ children, index, onLayout }: any): JSX.Element;
8484
displayName: string;
8585
};
86-
declare const _default: React.ComponentClass<Props & {
87-
useCustomTheme?: boolean | undefined; /**
88-
* Whether to use a FlatList. NOTE: you must pass 'data' and 'renderItem' props as well
89-
*/
86+
declare const _default: React.ComponentClass<ScrollBarProps & {
87+
useCustomTheme?: boolean | undefined;
9088
}, any> & typeof ScrollBar;
9189
export default _default;

generatedTypes/components/tabBar/index.d.ts

Lines changed: 19 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
import React from 'react';
2-
import { Animated, ViewStyle } from 'react-native';
3-
import { BaseComponentInjectedProps } from '../../commons/new';
4-
import { ViewProps } from '../view';
5-
import TabBarItem from './TabBarItem';
6-
export declare type TabBarProps = BaseComponentInjectedProps & ViewProps & {
2+
import { StyleProp, ViewStyle } from 'react-native';
3+
import { ScrollBarProps } from '../scrollBar';
4+
import TabBarItem, { TabBarItemProps } from './TabBarItem';
5+
interface Props extends ScrollBarProps, TabBarItemProps {
76
/**
87
* Show Tab Bar bottom shadow
98
*/
109
enableShadow?: boolean;
1110
/**
12-
* The minimum number of tabs to render
11+
* The minimum number of tabs to render in scroll mode
1312
*/
1413
minTabsForScroll?: number;
1514
/**
@@ -19,69 +18,37 @@ export declare type TabBarProps = BaseComponentInjectedProps & ViewProps & {
1918
/**
2019
* callback for when index has change (will not be called on ignored items)
2120
*/
22-
onChangeIndex?: (props: any) => void;
21+
onChangeIndex?: (index: number) => void;
2322
/**
2423
* callback for when tab selected
2524
*/
26-
onTabSelected?: (props: any) => void;
25+
onTabSelected?: (index: number) => void;
2726
/**
2827
* custom style for the selected indicator
2928
*/
30-
indicatorStyle?: ViewStyle;
31-
/**
32-
* The background color
33-
*/
34-
backgroundColor: string;
29+
indicatorStyle?: StyleProp<ViewStyle>;
3530
/**
3631
* Tab Bar height
3732
*/
3833
height?: number;
39-
children: React.ReactNode;
40-
style?: ViewStyle;
41-
testID?: string;
42-
};
43-
export declare type State = {
44-
gradientOpacity: Animated.Value;
45-
scrollEnabled?: boolean;
46-
currentIndex?: number;
47-
};
48-
declare const _default: React.ComponentClass<BaseComponentInjectedProps & ViewProps & {
4934
/**
50-
* Show Tab Bar bottom shadow
51-
*/
52-
enableShadow?: boolean | undefined;
53-
/**
54-
* The minimum number of tabs to render
55-
*/
56-
minTabsForScroll?: number | undefined;
57-
/**
58-
* current selected tab index
35+
* Pass when container width is different than the screen width
5936
*/
60-
selectedIndex?: number | undefined;
61-
/**
62-
* callback for when index has change (will not be called on ignored items)
63-
*/
64-
onChangeIndex?: ((props: any) => void) | undefined;
65-
/**
66-
* callback for when tab selected
67-
*/
68-
onTabSelected?: ((props: any) => void) | undefined;
69-
/**
70-
* custom style for the selected indicator
71-
*/
72-
indicatorStyle?: ViewStyle | undefined;
37+
containerWidth?: number;
7338
/**
7439
* The background color
7540
*/
76-
backgroundColor: string;
41+
backgroundColor?: string;
7742
/**
78-
* Tab Bar height
43+
* set darkTheme style
7944
*/
80-
height?: number | undefined;
81-
children: React.ReactNode;
82-
style?: ViewStyle | undefined;
83-
testID?: string | undefined;
84-
} & {
45+
darkTheme?: boolean;
46+
children?: React.ReactNode;
47+
style?: ViewStyle;
48+
testID?: string;
49+
}
50+
export declare type TabBarProps = Props;
51+
declare const _default: React.ComponentClass<Props & {
8552
useCustomTheme?: boolean | undefined;
8653
}, any> & {
8754
Item: typeof TabBarItem;

generatedTypes/components/tabController/TabBarItem.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ export interface TabControllerItemProps {
4343
* Badge component props to display next the item label
4444
*/
4545
badge?: BadgeProps;
46+
/**
47+
* maximun number of lines the label can break
48+
*/
49+
/**
50+
* whether the tab will have a divider on its right
51+
*/
4652
/**
4753
* A fixed width for the item
4854
*/

src/components/tabBar/index.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,14 @@ import {Constants} from '../../helpers';
55
import {Colors} from '../../style';
66
import {asBaseComponent} from '../../commons/new';
77
import View from '../view';
8-
import ScrollBar/* , {ScrollBarProps} */ from '../scrollBar';
8+
import ScrollBar , {ScrollBarProps} from '../scrollBar';
99
import TabBarItem, {TabBarItemProps} from './TabBarItem';
1010

1111

1212
const MIN_TABS_FOR_SCROLL = 1;
1313
const DEFAULT_BACKGROUND_COLOR = Colors.white;
1414
const DEFAULT_HEIGHT = 48;
1515

16-
const ScrollBarProps = ScrollBar.propTypes; //TODO: remove after TS migration
17-
1816
interface Props extends ScrollBarProps, TabBarItemProps {
1917
/**
2018
* Show Tab Bar bottom shadow

0 commit comments

Comments
 (0)