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

Commit

Permalink
feat: export types for ScreenProps amd ScreenComponent
Browse files Browse the repository at this point in the history
  • Loading branch information
satya164 committed Sep 12, 2019
1 parent 5267a1c commit be8155f
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 13 deletions.
2 changes: 1 addition & 1 deletion example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
8 changes: 4 additions & 4 deletions example/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@
"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"
},
"peerDependencies": {
"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": {
Expand Down
12 changes: 12 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
export {
default as createMaterialBottomTabNavigator,
} from './navigators/createMaterialBottomTabNavigator';

/**
* Types
*/
export {
NavigationTabState,
NavigationTabProp,
NavigationTabScreenProps,
NavigationMaterialBottomTabOptions,
NavigationMaterialBottomTabConfig,
NavigationMaterialBottomTabScreenComponent,
} from './types';
5 changes: 3 additions & 2 deletions src/navigators/createMaterialBottomTabNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down
21 changes: 21 additions & 0 deletions src/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import {
NavigationState,
NavigationScreenProp,
NavigationParams,
NavigationScreenConfig,
SupportedThemes,
} from 'react-navigation';

export type NavigationTabState = NavigationState;
Expand Down Expand Up @@ -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>
>;
};
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit be8155f

Please sign in to comment.