mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 23:37:04 +00:00
Merge pull request #24284 from stackworx/master
[react-navigation] Added types for switch navigator
This commit is contained in:
Vendored
+14
@@ -14,6 +14,7 @@
|
||||
// Veit Lehmann: <https://github.com/levito>
|
||||
// Roberto Huertas: <https://github.com/robertohuertasm>
|
||||
// Steven Miller <https://github.com/YourGamesBeOver>
|
||||
// Ciaran Liedeman <https://github.com/cliedeman>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
@@ -575,6 +576,19 @@ export function StackNavigator(
|
||||
stackConfig?: StackNavigatorConfig,
|
||||
): NavigationContainer;
|
||||
|
||||
export interface SwitchNavigatorConfig {
|
||||
initialRouteName: string;
|
||||
resetOnBlur?: boolean;
|
||||
paths?: NavigationPathsConfig;
|
||||
backBehavior?: 'none' | 'intialRoute';
|
||||
}
|
||||
|
||||
// Return createNavigationContainer
|
||||
export function SwitchNavigator(
|
||||
routeConfigMap: NavigationRouteConfigMap,
|
||||
switchConfig?: SwitchNavigatorConfig
|
||||
): NavigationContainer;
|
||||
|
||||
// DrawerItems
|
||||
export const DrawerItems: React.ReactType;
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@ import {
|
||||
NavigationTransitionProps,
|
||||
StackNavigator,
|
||||
StackNavigatorConfig,
|
||||
SwitchNavigator,
|
||||
SwitchNavigatorConfig,
|
||||
TabBarTop,
|
||||
TabNavigator,
|
||||
TabNavigatorConfig,
|
||||
@@ -219,6 +221,30 @@ function renderAdvancedStackNavigator(): JSX.Element {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch navigator.
|
||||
*/
|
||||
|
||||
const switchNavigatorConfig: SwitchNavigatorConfig = {
|
||||
initialRouteName: 'screen',
|
||||
resetOnBlur: false,
|
||||
backBehavior: 'none'
|
||||
};
|
||||
|
||||
const BasicSwitchNavigator = SwitchNavigator(
|
||||
routeConfigMap,
|
||||
switchNavigatorConfig,
|
||||
);
|
||||
|
||||
function renderBasicSwitchNavigator(): JSX.Element {
|
||||
return (
|
||||
<BasicSwitchNavigator
|
||||
ref={(ref: any) => { }}
|
||||
style={viewStyle}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Drawer navigator.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user