diff --git a/types/react-router-navigation-core/react-router-navigation-core-tests.tsx b/types/react-router-navigation-core/react-router-navigation-core-tests.tsx index 4f4df88f5f..6d6d048886 100644 --- a/types/react-router-navigation-core/react-router-navigation-core-tests.tsx +++ b/types/react-router-navigation-core/react-router-navigation-core-tests.tsx @@ -1,33 +1,12 @@ import * as React from "react"; -import { - StyleSheet, - Dimensions, - View, - StyleProp, - ViewStyle -} from "react-native"; +import { View } from "react-native"; import { TabStack, renderSubView } from "react-router-navigation-core"; +import { TabBarProps, TabProps } from "react-router-navigation"; import { TabViewAnimated } from "react-native-tab-view"; -import { - TabBarProps, - TabSubViewProps, - TabProps -} from "react-router-navigation"; - -const styles = StyleSheet.create({ - container: { - flex: 1 - }, - scene: { - flex: 1, - overflow: "hidden" - } -}); type Props = TabBarProps & { children?: Array>; lazy?: boolean; - style?: StyleProp; }; type State = { @@ -35,54 +14,12 @@ type State = { }; class BottomNavigation extends React.Component { - static defaultProps = { - lazy: true - }; - state = { key: Math.random().toString(10) }; - renderPager = (sceneProps: TabSubViewProps) => ; - - renderNavigationBar = ( - sceneProps: TabSubViewProps, - props: TabSubViewProps - ) => { - // Hide tab bar - if (sceneProps.hideTabBar) return null; - // Custom tab bar - if (sceneProps.renderTabBar) { - return React.createElement(sceneProps.renderTabBar, sceneProps); - } - // Default tab bar - return ; - }; - - renderSceneView = (sceneProps: TabSubViewProps) => { - const { render, children, component, lazy, loadedTabs } = sceneProps; - const { key } = sceneProps; - if (lazy && !loadedTabs.includes(key)) { - return null; - } else if (render) { - return render(sceneProps); - } else if (children && typeof children === "function") { - return children(sceneProps); - } else if (component) { - return React.createElement(component, sceneProps); - } - return null; - }; - - renderScene = (sceneProps: TabSubViewProps) => { - return ( - {this.renderSceneView(sceneProps)} - ); - }; - render() { return ( { const ownProps = { ...this.props, ...props }; @@ -90,19 +27,17 @@ class BottomNavigation extends React.Component { , ownProps )} renderFooter={renderSubView( - this.renderNavigationBar, + sceneProps => , ownProps )} renderScene={renderSubView( - this.renderScene, + sceneProps => , ownProps )} /> @@ -112,5 +47,3 @@ class BottomNavigation extends React.Component { ); } } - -export default BottomNavigation;