Skip to content
This repository was archived by the owner on Feb 25, 2020. It is now read-only.

Commit be8155f

Browse files
committed
feat: export types for ScreenProps amd ScreenComponent
1 parent 5267a1c commit be8155f

7 files changed

Lines changed: 47 additions & 13 deletions

File tree

example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"react-native-gesture-handler": "~1.3.0",
2020
"react-native-paper": "^3.0.0-alpha.4",
2121
"react-native-reanimated": "~1.1.0",
22-
"react-navigation": "^4.0.3",
22+
"react-navigation": "^4.0.4",
2323
"react-navigation-stack": "^1.5.4"
2424
},
2525
"devDependencies": {

example/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4318,10 +4318,10 @@ react-navigation-stack@^1.5.4:
43184318
dependencies:
43194319
prop-types "^15.7.2"
43204320

4321-
react-navigation@^4.0.3:
4322-
version "4.0.3"
4323-
resolved "https://registry.yarnpkg.com/react-navigation/-/react-navigation-4.0.3.tgz#ba2cacb71db56e22ee50d774829ebc7fa95a0724"
4324-
integrity sha512-oASR5gHwd6se1Mw8AM4Ie8GicD5mKzRiYP6oaQujiQroQzQPij9sXxkRSqOscd/Kw1/Hf3htvBX3ZRPbOkWsfA==
4321+
react-navigation@^4.0.4:
4322+
version "4.0.4"
4323+
resolved "https://registry.yarnpkg.com/react-navigation/-/react-navigation-4.0.4.tgz#afa43c7183891d38708cf57f1d4394fed1d4c2ad"
4324+
integrity sha512-MZeVkYkFTKZobhrXMV3Hgeg0HHeokCrYsbxActVfO0n6zfzm0/La6EiC2mIHiwOymvb1ZygyFf90vryLUMEBNA==
43254325
dependencies:
43264326
"@react-navigation/core" "^3.5.0"
43274327
"@react-navigation/native" "^3.6.2"

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@
6060
"react-native-gesture-handler": "^1.4.1",
6161
"react-native-paper": "^3.0.0-alpha.4",
6262
"react-native-reanimated": "^1.2.0",
63-
"react-navigation": "^4.0.3",
63+
"react-navigation": "^4.0.4",
6464
"release-it": "^12.3.6",
6565
"typescript": "^3.5.2"
6666
},
6767
"peerDependencies": {
6868
"react": "*",
6969
"react-native": "*",
7070
"react-native-paper": "^2.2.2 || ^3.0.0-alpha.1",
71-
"react-navigation": "^4.0.3"
71+
"react-navigation": "^4.0.4"
7272
},
7373
"husky": {
7474
"hooks": {

src/index.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
11
export {
22
default as createMaterialBottomTabNavigator,
33
} from './navigators/createMaterialBottomTabNavigator';
4+
5+
/**
6+
* Types
7+
*/
8+
export {
9+
NavigationTabState,
10+
NavigationTabProp,
11+
NavigationTabScreenProps,
12+
NavigationMaterialBottomTabOptions,
13+
NavigationMaterialBottomTabConfig,
14+
NavigationMaterialBottomTabScreenComponent,
15+
} from './types';

src/navigators/createMaterialBottomTabNavigator.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,13 @@ export type NavigationViewProps = {
5454
export default function createMaterialBottomTabNavigator(
5555
routes: NavigationRouteConfigMap<
5656
NavigationMaterialBottomTabOptions,
57-
NavigationTabProp
57+
NavigationTabProp<NavigationRoute, any>
5858
>,
5959
config: CreateNavigatorConfig<
6060
NavigationMaterialBottomTabConfig,
6161
NavigationTabRouterConfig,
62-
NavigationMaterialBottomTabOptions
62+
NavigationMaterialBottomTabOptions,
63+
NavigationTabProp<NavigationRoute, any>
6364
> = {}
6465
) {
6566
class NavigationView extends React.Component<NavigationViewProps> {

src/types.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import {
44
NavigationState,
55
NavigationScreenProp,
66
NavigationParams,
7+
NavigationScreenConfig,
8+
SupportedThemes,
79
} from 'react-navigation';
810

911
export type NavigationTabState = NavigationState;
@@ -85,3 +87,22 @@ export type NavigationMaterialBottomTabConfig = {
8587
barStyleDark?: StyleProp<ViewStyle>;
8688
style?: StyleProp<ViewStyle>;
8789
};
90+
91+
export type NavigationTabScreenProps<
92+
Params = NavigationParams,
93+
ScreenProps = unknown
94+
> = {
95+
theme: SupportedThemes;
96+
navigation: NavigationTabProp<NavigationRoute, Params>;
97+
screenProps: ScreenProps;
98+
};
99+
100+
export type NavigationMaterialBottomTabScreenComponent<
101+
Params = NavigationParams,
102+
ScreenProps = unknown
103+
> = React.ComponentType<NavigationTabScreenProps<Params, ScreenProps>> & {
104+
navigationOptions?: NavigationScreenConfig<
105+
NavigationMaterialBottomTabOptions,
106+
NavigationTabProp<NavigationRoute, Params>
107+
>;
108+
};

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7378,10 +7378,10 @@ react-native@~0.59.8:
73787378
xmldoc "^0.4.0"
73797379
yargs "^9.0.0"
73807380

7381-
react-navigation@^4.0.3:
7382-
version "4.0.3"
7383-
resolved "https://registry.yarnpkg.com/react-navigation/-/react-navigation-4.0.3.tgz#ba2cacb71db56e22ee50d774829ebc7fa95a0724"
7384-
integrity sha512-oASR5gHwd6se1Mw8AM4Ie8GicD5mKzRiYP6oaQujiQroQzQPij9sXxkRSqOscd/Kw1/Hf3htvBX3ZRPbOkWsfA==
7381+
react-navigation@^4.0.4:
7382+
version "4.0.4"
7383+
resolved "https://registry.yarnpkg.com/react-navigation/-/react-navigation-4.0.4.tgz#afa43c7183891d38708cf57f1d4394fed1d4c2ad"
7384+
integrity sha512-MZeVkYkFTKZobhrXMV3Hgeg0HHeokCrYsbxActVfO0n6zfzm0/La6EiC2mIHiwOymvb1ZygyFf90vryLUMEBNA==
73857385
dependencies:
73867386
"@react-navigation/core" "^3.5.0"
73877387
"@react-navigation/native" "^3.6.2"

0 commit comments

Comments
 (0)