forked from Alovoa/alovoa-expo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes-hack.ts
More file actions
40 lines (37 loc) · 1.59 KB
/
types-hack.ts
File metadata and controls
40 lines (37 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// react-native-paper@5 & @react-navigation/native@7 type compatibility hack
// https://github.com/callstack/react-native-paper/issues/4572#issuecomment-2558782323
// todo: remove below after react-native-paper@5 fixes support for @react-navigation/native@7
import {
DefaultNavigatorOptions,
EventMapBase,
NavigationState,
ParamListBase,
RouteConfig,
RouteGroupConfig,
TabNavigationState,
} from '@react-navigation/native';
import { MaterialBottomTabNavigationEventMap, MaterialBottomTabNavigationOptions } from 'react-native-paper';
import { MaterialBottomTabNavigatorProps } from 'react-native-paper/lib/typescript/react-navigation/navigators/createMaterialBottomTabNavigator';
type LegacyTypedNavigator<
ParamList extends ParamListBase,
State extends NavigationState,
ScreenOptions extends object,
EventMap extends EventMapBase,
Navigator extends React.ComponentType<any>,
> = {
Navigator: React.ComponentType<
Omit<React.ComponentProps<Navigator>, keyof DefaultNavigatorOptions<any, any, any, any, any, any>> &
DefaultNavigatorOptions<ParamList, any, State, ScreenOptions, EventMap, any>
>;
Group: React.ComponentType<RouteGroupConfig<ParamList, ScreenOptions, any>>;
Screen: <RouteName extends keyof ParamList>(
_: RouteConfig<ParamList, RouteName, State, ScreenOptions, EventMap, any>,
) => null;
};
export type MaterialBottomTabNavigator<T extends ParamListBase> = LegacyTypedNavigator<
T,
TabNavigationState<ParamListBase>,
MaterialBottomTabNavigationOptions,
MaterialBottomTabNavigationEventMap,
(_: MaterialBottomTabNavigatorProps) => React.JSX.Element
>;