|
1 |
| -import React from 'react'; |
| 1 | +import React, { Component } from 'react'; |
| 2 | +import Reanimated from 'react-native-reanimated'; |
2 | 3 | import TabBar from './TabBar';
|
3 | 4 | import TabBarItem, { TabBarItemProps } from './TabBarItem';
|
4 | 5 | import TabPage from './TabPage';
|
@@ -26,12 +27,50 @@ export interface TabControllerProps {
|
26 | 27 | */
|
27 | 28 | carouselPageWidth?: number;
|
28 | 29 | }
|
| 30 | +interface StateProps { |
| 31 | + selectedIndex: number; |
| 32 | + asCarousel?: boolean; |
| 33 | + pageWidth: number; |
| 34 | + items: TabControllerProps['items']; |
| 35 | + itemStates: any[]; |
| 36 | + ignoredItems: any[]; |
| 37 | + targetPage: any; |
| 38 | + currentPage: any; |
| 39 | + carouselOffset: any; |
| 40 | + containerWidth: any; |
| 41 | + registerTabItems: (tabItemsCount: number, ignoredItems: StateProps['ignoredItems']) => void; |
| 42 | + onChangeIndex: (index: number) => void; |
| 43 | +} |
| 44 | +/** |
| 45 | + * @description: A performant solution for a tab controller with lazy load mechanism |
| 46 | + * @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/TabControllerScreen/index.js |
| 47 | + * @notes: This component is based on react-native-gesture-handler |
| 48 | + * @important: On Android, if using react-native-navigation, make sure to wrap your screen with gestureHandlerRootHOC |
| 49 | + * @importantLink: https://kmagiera.github.io/react-native-gesture-handler/docs/getting-started.html#with-wix-react-native-navigation-https-githubcom-wix-react-native-navigation |
| 50 | + */ |
| 51 | +declare class TabController extends Component<TabControllerProps, StateProps> { |
| 52 | + static displayName: string; |
| 53 | + static contextType: React.Context<{}>; |
| 54 | + static TabBar: typeof TabBar; |
| 55 | + static TabBarItem: typeof TabBarItem; |
| 56 | + static TabPage: typeof TabPage; |
| 57 | + static PageCarousel: typeof PageCarousel; |
| 58 | + static defaultProps: { |
| 59 | + selectedIndex: number; |
| 60 | + activeOpacity: number; |
| 61 | + }; |
| 62 | + constructor(props: TabControllerProps); |
| 63 | + static getDerivedStateFromProps(nextProps: TabControllerProps, prevState: StateProps): { |
| 64 | + pageWidth: number; |
| 65 | + } | null; |
| 66 | + componentDidUpdate(_prevProps: TabControllerProps, prevState: StateProps): void; |
| 67 | + get pageWidth(): number; |
| 68 | + registerTabItems: (tabItemsCount: number, ignoredItems: StateProps['ignoredItems']) => void; |
| 69 | + onPageChange: ([index]: readonly number[]) => void; |
| 70 | + renderCodeBlock: () => Reanimated.Node<number>; |
| 71 | + render(): JSX.Element; |
| 72 | +} |
29 | 73 | declare const _default: React.ComponentClass<TabControllerProps & {
|
30 | 74 | useCustomTheme?: boolean | undefined;
|
31 |
| -}, any> & { |
32 |
| - TabBar: typeof TabBar; |
33 |
| - TabBarItem: typeof TabBarItem; |
34 |
| - TabPage: typeof TabPage; |
35 |
| - PageCarousel: typeof PageCarousel; |
36 |
| -}; |
| 75 | +}, any> & typeof TabController; |
37 | 76 | export default _default;
|
0 commit comments