Compare commits

..

2 Commits

Author SHA1 Message Date
satyajit.happy
d342812102 chore: release 4.0.7 2019-09-22 00:30:34 +02:00
satyajit.happy
5c13cea6c9 fix: accept type parameter for screenProps 2019-09-22 00:29:42 +02:00
2 changed files with 16 additions and 41 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "react-navigation",
"version": "4.0.6",
"version": "4.0.7",
"description": "Routing and navigation for your React Native apps",
"main": "src/react-navigation.js",
"types": "typescript/react-navigation.d.ts",

View File

@@ -190,16 +190,16 @@ declare module 'react-navigation' {
navigationOptions?: NavigationScreenConfig<Options, NavigationScreenPropType>;
};
export interface NavigationScreenConfigProps<NavigationScreenPropType> {
export interface NavigationScreenConfigProps<NavigationScreenPropType, ScreenProps = unknown> {
navigation: NavigationScreenPropType;
screenProps: unknown;
screenProps: ScreenProps;
theme: SupportedThemes;
}
export type NavigationScreenConfig<Options, NavigationScreenPropType> =
export type NavigationScreenConfig<Options, NavigationScreenPropType, ScreenProps = unknown> =
| Options
| ((
navigationOptionsContainer: NavigationScreenConfigProps<NavigationScreenPropType> & {
navigationOptionsContainer: NavigationScreenConfigProps<NavigationScreenPropType, ScreenProps> & {
navigationOptions: Options;
}
) => Options);
@@ -542,12 +542,12 @@ declare module 'react-navigation' {
dangerouslyGetParent: () => NavigationScreenProp<S> | undefined;
}
export interface NavigationNavigatorProps<O = {}, S = {}> {
export interface NavigationNavigatorProps<Options = {}, State = {}, ScreenProps = unknown> {
theme?: SupportedThemes | 'no-preference';
detached?: boolean;
navigation?: NavigationProp<S>;
screenProps?: unknown;
navigationOptions?: O;
navigation?: NavigationProp<State>;
screenProps?: ScreenProps;
navigationOptions?: Options;
}
export type NavigatorType =
@@ -555,7 +555,7 @@ declare module 'react-navigation' {
| 'react-navigation/TABS'
| 'react-navigation/DRAWER';
export interface NavigationContainerProps<S = {}, O = {}> {
export interface NavigationContainerProps<State = {}, Options = {}, ScreenProps = unknown> {
uriPrefix?: string | RegExp;
/**
* Controls whether the navigation container handles URLs opened via 'Linking'
@@ -568,7 +568,7 @@ declare module 'react-navigation' {
nextNavigationState: NavigationState,
action: NavigationAction
) => void | null | undefined;
navigation?: NavigationScreenProp<S>;
navigation?: NavigationScreenProp<State>;
/*
* This prop is no longer supported. Use `loadNavigationState` and
* `persistNavigationState` instead.
@@ -579,8 +579,8 @@ declare module 'react-navigation' {
persistNavigationState?: (state: NavigationState) => Promise<any>;
renderLoadingExperimental?: React.ComponentType;
screenProps?: unknown;
navigationOptions?: O;
screenProps?: ScreenProps;
navigationOptions?: Options;
style?: StyleProp<ViewStyle>;
}
@@ -613,9 +613,6 @@ declare module 'react-navigation' {
backBehavior?: 'none' | 'initialRoute';
}
// Return createNavigationContainer
export type _SwitchNavigatorConfig = NavigationSwitchRouterConfig;
export function createSwitchNavigator(
routeConfigMap: NavigationRouteConfigMap<SwitchNavigatorConfig, NavigationScreenProp<NavigationRoute>>,
switchConfig?: SwitchNavigatorConfig
@@ -738,11 +735,11 @@ declare module 'react-navigation' {
getComponent: () => React.ComponentType;
}
export type NavigationView<O, S> = React.ComponentType<
export type NavigationView<Options, State, ScreenProps = unknown> = React.ComponentType<
{
descriptors: { [key: string]: NavigationDescriptor };
navigationConfig: O;
screenProps?: unknown;
navigationConfig: Options;
screenProps?: ScreenProps;
} & NavigationInjectedProps
>;
@@ -779,28 +776,6 @@ declare module 'react-navigation' {
Component: NavigationNavigator<Options, NavigationPropType>
): NavigationContainer;
/**
* END MANUAL DEFINITIONS OUTSIDE OF TYPEDEFINITION.JS
*/
/**
* BEGIN CUSTOM CONVENIENCE INTERFACES
*/
export interface NavigationScreenProps<
Params = NavigationParams,
Options = {},
NavigationScreenPropType = NavigationScreenProp<NavigationRoute>
> {
navigation: NavigationScreenProp<NavigationRoute<Params>, Params>;
screenProps?: unknown;
navigationOptions?: NavigationScreenConfig<Options, NavigationScreenPropType>;
}
/**
* END CUSTOM CONVENIENCE INTERFACES
*/
export type Omit<T, K extends keyof any> = Pick<T, Exclude<keyof T, K>>;
export type InferProps<