feat: export types for ScreenProps amd ScreenComponent

This commit is contained in:
satyajit.happy
2019-09-12 20:10:48 +02:00
parent 249c7d7310
commit cdc3537045
7 changed files with 47 additions and 13 deletions

View File

@@ -19,7 +19,7 @@
"react-native-gesture-handler": "~1.3.0",
"react-native-paper": "^3.0.0-alpha.4",
"react-native-reanimated": "~1.1.0",
"react-navigation": "^4.0.3",
"react-navigation": "^4.0.4",
"react-navigation-stack": "^1.5.4"
},
"devDependencies": {

View File

@@ -4318,10 +4318,10 @@ react-navigation-stack@^1.5.4:
dependencies:
prop-types "^15.7.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

@@ -60,7 +60,7 @@
"react-native-gesture-handler": "^1.4.1",
"react-native-paper": "^3.0.0-alpha.4",
"react-native-reanimated": "^1.2.0",
"react-navigation": "^4.0.3",
"react-navigation": "^4.0.4",
"release-it": "^12.3.6",
"typescript": "^3.5.2"
},
@@ -68,7 +68,7 @@
"react": "*",
"react-native": "*",
"react-native-paper": "^2.2.2 || ^3.0.0-alpha.1",
"react-navigation": "^4.0.3"
"react-navigation": "^4.0.4"
},
"husky": {
"hooks": {

View File

@@ -1,3 +1,15 @@
export {
default as createMaterialBottomTabNavigator,
} from './navigators/createMaterialBottomTabNavigator';
/**
* Types
*/
export {
NavigationTabState,
NavigationTabProp,
NavigationTabScreenProps,
NavigationMaterialBottomTabOptions,
NavigationMaterialBottomTabConfig,
NavigationMaterialBottomTabScreenComponent,
} from './types';

View File

@@ -54,12 +54,13 @@ export type NavigationViewProps = {
export default function createMaterialBottomTabNavigator(
routes: NavigationRouteConfigMap<
NavigationMaterialBottomTabOptions,
NavigationTabProp
NavigationTabProp<NavigationRoute, any>
>,
config: CreateNavigatorConfig<
NavigationMaterialBottomTabConfig,
NavigationTabRouterConfig,
NavigationMaterialBottomTabOptions
NavigationMaterialBottomTabOptions,
NavigationTabProp<NavigationRoute, any>
> = {}
) {
class NavigationView extends React.Component<NavigationViewProps> {

View File

@@ -4,6 +4,8 @@ import {
NavigationState,
NavigationScreenProp,
NavigationParams,
NavigationScreenConfig,
SupportedThemes,
} from 'react-navigation';
export type NavigationTabState = NavigationState;
@@ -85,3 +87,22 @@ export type NavigationMaterialBottomTabConfig = {
barStyleDark?: StyleProp<ViewStyle>;
style?: StyleProp<ViewStyle>;
};
export type NavigationTabScreenProps<
Params = NavigationParams,
ScreenProps = unknown
> = {
theme: SupportedThemes;
navigation: NavigationTabProp<NavigationRoute, Params>;
screenProps: ScreenProps;
};
export type NavigationMaterialBottomTabScreenComponent<
Params = NavigationParams,
ScreenProps = unknown
> = React.ComponentType<NavigationTabScreenProps<Params, ScreenProps>> & {
navigationOptions?: NavigationScreenConfig<
NavigationMaterialBottomTabOptions,
NavigationTabProp<NavigationRoute, Params>
>;
};

View File

@@ -7378,10 +7378,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"