feat: export types for ScreenProps amd ScreenComponent

This commit is contained in:
satyajit.happy
2019-09-12 16:24:19 +02:00
parent e89659443a
commit 807627a12f
7 changed files with 36 additions and 12 deletions

View File

@@ -25,7 +25,7 @@
"react-native-unimodules": "~0.5.2",
"react-native-web": "^0.11.4",
"react-native-webview": "~5.12.0",
"react-navigation": "^4.0.3",
"react-navigation": "^4.0.4",
"react-navigation-drawer": "^2.0.0",
"react-navigation-tabs": "2.2.0"
},

View File

@@ -9451,10 +9451,10 @@ react-navigation-tabs@2.2.0:
react-lifecycles-compat "^3.0.4"
react-native-tab-view "^2.6.2"
react-navigation@^4.0.3:
version "4.0.3"
resolved "https://registry.yarnpkg.com/react-navigation/-/react-navigation-4.0.3.tgz#ba2cacb71db56e22ee50d774829ebc7fa95a0724"
integrity sha512-oASR5gHwd6se1Mw8AM4Ie8GicD5mKzRiYP6oaQujiQroQzQPij9sXxkRSqOscd/Kw1/Hf3htvBX3ZRPbOkWsfA==
react-navigation@^4.0.4:
version "4.0.4"
resolved "https://registry.yarnpkg.com/react-navigation/-/react-navigation-4.0.4.tgz#afa43c7183891d38708cf57f1d4394fed1d4c2ad"
integrity sha512-MZeVkYkFTKZobhrXMV3Hgeg0HHeokCrYsbxActVfO0n6zfzm0/La6EiC2mIHiwOymvb1ZygyFf90vryLUMEBNA==
dependencies:
"@react-navigation/core" "^3.5.0"
"@react-navigation/native" "^3.6.2"

View File

@@ -68,7 +68,7 @@
"react-native-gesture-handler": "^1.3.0",
"react-native-reanimated": "^1.1.0",
"react-native-screens": "^1.0.0-alpha.23",
"react-navigation": "^4.0.3",
"react-navigation": "^4.0.4",
"react-test-renderer": "16.8.3",
"release-it": "^12.3.2",
"scheduler": "^0.14.0",
@@ -81,7 +81,7 @@
"react-native-gesture-handler": "^1.0.0",
"react-native-reanimated": "^1.3.0-alpha",
"react-native-screens": "^1.0.0 || ^1.0.0-alpha",
"react-navigation": "^4.0.3"
"react-navigation": "^4.0.4"
},
"jest": {
"preset": "react-native",

View File

@@ -40,4 +40,6 @@ export {
NavigationStackProp,
NavigationStackOptions,
NavigationStackConfig,
NavigationStackScreenComponent,
NavigationStackScreenProps,
} from './types';

View File

@@ -23,7 +23,8 @@ function createStackNavigator(
stackConfig: CreateNavigatorConfig<
NavigationStackConfig,
NavigationStackRouterConfig,
NavigationStackOptions
NavigationStackOptions,
NavigationStackProp
> = {}
) {
const router = StackRouter(routeConfigMap, stackConfig);

View File

@@ -15,6 +15,8 @@ import {
NavigationEventCallback,
NavigationEventSubscription,
NavigationDescriptor,
NavigationScreenConfig,
SupportedThemes,
} from 'react-navigation';
export type NavigationStackEventName =
@@ -126,6 +128,25 @@ export type NavigationStackConfig = {
disableKeyboardHandling?: boolean;
};
export type NavigationStackScreenProps<
Params = NavigationParams,
ScreenProps = unknown
> = {
theme: SupportedThemes;
navigation: NavigationStackProp<NavigationRoute, Params>;
screenProps: ScreenProps;
};
export type NavigationStackScreenComponent<
Params = NavigationParams,
ScreenProps = unknown
> = React.ComponentType<NavigationStackScreenProps<Params, ScreenProps>> & {
navigationOptions?: NavigationScreenConfig<
NavigationStackOptions,
NavigationStackProp<NavigationRoute, Params>
>;
};
export type SceneDescriptorMap = {
[key: string]:
| NavigationDescriptor<

View File

@@ -7333,10 +7333,10 @@ react-native@~0.59.8:
xmldoc "^0.4.0"
yargs "^9.0.0"
react-navigation@^4.0.3:
version "4.0.3"
resolved "https://registry.yarnpkg.com/react-navigation/-/react-navigation-4.0.3.tgz#ba2cacb71db56e22ee50d774829ebc7fa95a0724"
integrity sha512-oASR5gHwd6se1Mw8AM4Ie8GicD5mKzRiYP6oaQujiQroQzQPij9sXxkRSqOscd/Kw1/Hf3htvBX3ZRPbOkWsfA==
react-navigation@^4.0.4:
version "4.0.4"
resolved "https://registry.yarnpkg.com/react-navigation/-/react-navigation-4.0.4.tgz#afa43c7183891d38708cf57f1d4394fed1d4c2ad"
integrity sha512-MZeVkYkFTKZobhrXMV3Hgeg0HHeokCrYsbxActVfO0n6zfzm0/La6EiC2mIHiwOymvb1ZygyFf90vryLUMEBNA==
dependencies:
"@react-navigation/core" "^3.5.0"
"@react-navigation/native" "^3.6.2"