mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-09-24 10:00:27 +00:00
Merge pull request #16668 from huhuanming/react-navigation
Add NavgationComponentProps<T>
This commit is contained in:
Vendored
+25
-6
@@ -1,7 +1,6 @@
|
||||
// Type definitions for react-navigation 1.0
|
||||
// Project: https://github.com/react-community/react-navigation
|
||||
// Definitions by: Huhuanming <https://github.com/huhuanming>
|
||||
// mhcgrq <https://github.com/mhcgrq>
|
||||
// Definitions by: Huhuanming <https://github.com/huhuanming>, mhcgrq <https://github.com/mhcgrq>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import * as React from 'react'
|
||||
@@ -320,10 +319,10 @@ export type NavigationAction =
|
||||
| NavigationTabAction
|
||||
|
||||
export namespace NavigationActions {
|
||||
function navigate(options: NavigationNavigateAction): any;
|
||||
function reset(options: NavigationResetAction): any;
|
||||
function back(options?: NavigationBackAction): any;
|
||||
function setParams(options: NavigationSetParamsAction): any;
|
||||
function navigate(options: NavigationNavigateAction): NavigationNavigateAction;
|
||||
function reset(options: NavigationResetAction): NavigationResetAction;
|
||||
function back(options?: NavigationBackAction): NavigationBackAction;
|
||||
function setParams(options: NavigationSetParamsAction): NavigationSetParamsAction;
|
||||
}
|
||||
|
||||
export type NavigationRouteConfig<T> = T & {
|
||||
@@ -602,3 +601,23 @@ export interface DrawerNavigatorScreenOptions {
|
||||
| ((options: {focused: boolean, tintColor: string}) => React.ReactElement<any>)
|
||||
;
|
||||
}
|
||||
|
||||
export type NavigationNavigateActionCreator = (options: NavigationNavigateAction) => boolean;
|
||||
export type NavigationResetActionCreator = (options: NavigationResetAction) => boolean;
|
||||
export type NavigationBackActionCreator = (options?: NavigationBackAction) => boolean;
|
||||
export type NavigationSetParamsActionCreator = (options: NavigationSetParamsAction) => boolean;
|
||||
|
||||
export interface NavgationComponentProps<T> {
|
||||
screenProps: any
|
||||
navigation: {
|
||||
dispatch: any
|
||||
goBack: NavigationBackActionCreator
|
||||
navigate: NavigationNavigateActionCreator
|
||||
setParams: NavigationSetParamsActionCreator
|
||||
state: {
|
||||
key: string
|
||||
routeName: string,
|
||||
params: T,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user