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 | declare module 'react-navigation' {
|
35 | import * as React from 'react';
|
36 |
|
37 | import {
|
38 | Animated,
|
39 | Text,
|
40 | TextInput,
|
41 | StatusBar,
|
42 | TextStyle,
|
43 | ViewProps,
|
44 | ViewStyle,
|
45 | StyleProp,
|
46 | } from 'react-native';
|
47 |
|
48 |
|
49 |
|
50 | export { FlatList, SectionList, ScrollView } from 'react-native';
|
51 |
|
52 |
|
53 | export function getActiveChildNavigationOptions<S>(
|
54 | navigation: NavigationProp<S>,
|
55 | screenProps?: unknown,
|
56 | theme?: SupportedThemes
|
57 | ): NavigationParams;
|
58 |
|
59 |
|
60 |
|
61 | export type AnimatedValue = any;
|
62 |
|
63 | |
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 | export interface NavigationState {
|
77 | |
78 |
|
79 |
|
80 | index: number;
|
81 | routes: NavigationRoute[];
|
82 | isTransitioning: boolean;
|
83 | key: string;
|
84 | params?: NavigationParams | undefined;
|
85 | }
|
86 |
|
87 | export interface DrawerNavigationState extends NavigationState {
|
88 | isDrawerOpen: boolean;
|
89 | isTransitioning: boolean;
|
90 | }
|
91 |
|
92 | export type NavigationRoute<Params = NavigationParams> =
|
93 | | NavigationLeafRoute<Params>
|
94 | | NavigationStateRoute<Params>;
|
95 |
|
96 | export interface NavigationLeafRoute<Params = NavigationParams> {
|
97 | |
98 |
|
99 |
|
100 |
|
101 | key: string;
|
102 | |
103 |
|
104 |
|
105 | index: number;
|
106 | |
107 |
|
108 |
|
109 |
|
110 | routeName: string;
|
111 | |
112 |
|
113 |
|
114 | path?: string;
|
115 | |
116 |
|
117 |
|
118 |
|
119 | params?: Params;
|
120 | |
121 |
|
122 |
|
123 | routes: NavigationRoute[];
|
124 | |
125 |
|
126 |
|
127 | isTransitioning: boolean;
|
128 | }
|
129 |
|
130 | export type NavigationStateRoute<
|
131 | NavigationLeafRouteParams
|
132 | > = NavigationLeafRoute<NavigationLeafRouteParams> & NavigationState;
|
133 |
|
134 | export type NavigationScreenOptionsGetter<Options> = (
|
135 | navigation: NavigationScreenProp<NavigationRoute<any>>,
|
136 | screenProps: unknown | null,
|
137 | theme: SupportedThemes
|
138 | ) => Options;
|
139 |
|
140 | export interface NavigationRouter<State = NavigationState, Options = {}> {
|
141 | |
142 |
|
143 |
|
144 |
|
145 |
|
146 | getStateForAction: (
|
147 | action: NavigationAction,
|
148 | lastState?: State
|
149 | ) => State | null;
|
150 |
|
151 | |
152 |
|
153 |
|
154 |
|
155 | getActionForPathAndParams: (
|
156 | path: string,
|
157 | params?: NavigationParams
|
158 | ) => NavigationAction | null;
|
159 |
|
160 | getPathAndParamsForState: (
|
161 | state: State
|
162 | ) => {
|
163 | path: string;
|
164 | params?: NavigationParams;
|
165 | };
|
166 |
|
167 | getComponentForRouteName: (
|
168 | routeName: string
|
169 | ) => NavigationComponent<{}, NavigationScreenProp<NavigationRoute>>;
|
170 |
|
171 | getComponentForState: (
|
172 | state: State
|
173 | ) => NavigationComponent<{}, NavigationScreenProp<NavigationRoute>>;
|
174 |
|
175 | getActionCreators: (
|
176 | route: NavigationRoute,
|
177 | key: string
|
178 | ) => {
|
179 | [key: string]: () => NavigationAction;
|
180 | };
|
181 |
|
182 | |
183 |
|
184 |
|
185 |
|
186 |
|
187 |
|
188 |
|
189 |
|
190 | getScreenOptions: NavigationScreenOptionsGetter<Options>;
|
191 | }
|
192 |
|
193 | export type NavigationScreenComponent<
|
194 | Options,
|
195 | NavigationScreenPropType
|
196 | > = React.ComponentType<any> & {
|
197 | navigationOptions?: NavigationScreenConfig<
|
198 | Options,
|
199 | NavigationScreenPropType
|
200 | >;
|
201 | };
|
202 |
|
203 | export interface NavigationScreenConfigProps<
|
204 | NavigationScreenPropType,
|
205 | ScreenProps = unknown
|
206 | > {
|
207 | navigation: NavigationScreenPropType;
|
208 | screenProps: ScreenProps;
|
209 | theme: SupportedThemes;
|
210 | }
|
211 |
|
212 | export type NavigationScreenConfig<
|
213 | Options,
|
214 | NavigationScreenPropType,
|
215 | ScreenProps = unknown
|
216 | > =
|
217 | | Options
|
218 | | ((
|
219 | navigationOptionsContainer: NavigationScreenConfigProps<
|
220 | NavigationScreenPropType,
|
221 | ScreenProps
|
222 | > & {
|
223 | navigationOptions: Options;
|
224 | }
|
225 | ) => Options);
|
226 |
|
227 | export type NavigationComponent<Options, NavigationPropType> =
|
228 | | NavigationScreenComponent<Options, NavigationPropType>
|
229 | | NavigationNavigator<Options, NavigationPropType>;
|
230 |
|
231 | export type NavigationNavigator<
|
232 | Options,
|
233 | NavigationPropType
|
234 | > = React.ComponentType<NavigationNavigatorProps<Options>> & {
|
235 | router: NavigationRouter<Options>;
|
236 | navigationOptions?: NavigationScreenConfig<Options, NavigationPropType>;
|
237 | };
|
238 |
|
239 | export interface NavigationParams {
|
240 | [key: string]: any;
|
241 | }
|
242 |
|
243 | export interface NavigationNavigateActionPayload {
|
244 | routeName: string;
|
245 | params?: NavigationParams;
|
246 |
|
247 |
|
248 | action?: NavigationNavigateAction;
|
249 |
|
250 | key?: string;
|
251 | }
|
252 |
|
253 | export interface NavigationNavigateAction
|
254 | extends NavigationNavigateActionPayload {
|
255 | type: 'Navigation/NAVIGATE';
|
256 | }
|
257 |
|
258 | export interface NavigationBackActionPayload {
|
259 | key?: string | null;
|
260 | immediate?: boolean;
|
261 | }
|
262 |
|
263 | export interface NavigationBackAction extends NavigationBackActionPayload {
|
264 | type: 'Navigation/BACK';
|
265 | }
|
266 |
|
267 | export interface NavigationSetParamsActionPayload {
|
268 |
|
269 | key: string;
|
270 |
|
271 |
|
272 | params?: NavigationParams;
|
273 | }
|
274 |
|
275 | export interface NavigationSetParamsAction
|
276 | extends NavigationSetParamsActionPayload {
|
277 | type: 'Navigation/SET_PARAMS';
|
278 | }
|
279 |
|
280 | export interface NavigationInitActionPayload {
|
281 | params?: NavigationParams;
|
282 | }
|
283 |
|
284 | export interface NavigationInitAction extends NavigationInitActionPayload {
|
285 | type: 'Navigation/INIT';
|
286 | key?: string;
|
287 | }
|
288 |
|
289 | export interface NavigationReplaceActionPayload {
|
290 | key?: string;
|
291 | newKey?: string;
|
292 | routeName: string;
|
293 | params?: NavigationParams;
|
294 | action?: NavigationNavigateAction;
|
295 | }
|
296 |
|
297 | export interface NavigationReplaceAction {
|
298 | type: 'Navigation/REPLACE';
|
299 | key: string;
|
300 | routeName: string;
|
301 | params?: NavigationParams;
|
302 | action?: NavigationNavigateAction;
|
303 | }
|
304 |
|
305 | export interface NavigationCompleteTransitionActionPayload {
|
306 | key?: string;
|
307 | toChildKey?: string;
|
308 | }
|
309 |
|
310 | export interface NavigationCompleteTransitionAction {
|
311 | type: 'Navigation/COMPLETE_TRANSITION';
|
312 | key: string;
|
313 | }
|
314 |
|
315 | export interface NavigationResetActionPayload {
|
316 | index: number;
|
317 | key?: string | null;
|
318 | actions: NavigationNavigateAction[];
|
319 | }
|
320 |
|
321 | export interface NavigationResetAction extends NavigationResetActionPayload {
|
322 | type: 'Navigation/RESET';
|
323 | }
|
324 |
|
325 | export interface NavigationUriActionPayload {
|
326 | uri: string;
|
327 | }
|
328 |
|
329 | export interface NavigationUriAction extends NavigationUriActionPayload {
|
330 | type: 'Navigation/URI';
|
331 | }
|
332 |
|
333 | export interface NavigationPopActionPayload {
|
334 |
|
335 | n?: number;
|
336 | immediate?: boolean;
|
337 | }
|
338 |
|
339 | export interface NavigationPopAction extends NavigationPopActionPayload {
|
340 | type: 'Navigation/POP';
|
341 | key?: string;
|
342 | }
|
343 |
|
344 | export interface NavigationPopToTopActionPayload {
|
345 | key?: string;
|
346 | immediate?: boolean;
|
347 | }
|
348 |
|
349 | export interface NavigationPopToTopAction
|
350 | extends NavigationPopToTopActionPayload {
|
351 | type: 'Navigation/POP_TO_TOP';
|
352 | }
|
353 |
|
354 | export interface NavigationPushActionPayload {
|
355 | routeName: string;
|
356 | params?: NavigationParams;
|
357 | action?: NavigationNavigateAction;
|
358 | key?: string;
|
359 | }
|
360 |
|
361 | export interface NavigationPushAction {
|
362 | type: 'Navigation/PUSH';
|
363 | routeName: string;
|
364 | params?: NavigationParams;
|
365 | action?: NavigationNavigateAction;
|
366 | key?: string;
|
367 | }
|
368 |
|
369 | export interface NavigationJumpToActionPayload {
|
370 | routeName: string;
|
371 | key?: string;
|
372 | params?: NavigationParams;
|
373 | }
|
374 |
|
375 | export interface NavigationJumpToAction {
|
376 | type: 'Navigation/JUMP_TO';
|
377 | preserveFocus: boolean;
|
378 | routeName: string;
|
379 | key: string;
|
380 | params?: NavigationParams;
|
381 | }
|
382 |
|
383 | export interface NavigationDrawerOpenedAction {
|
384 | key?: string;
|
385 | type: 'Navigation/DRAWER_OPENED';
|
386 | }
|
387 |
|
388 | export interface NavigationDrawerClosedAction {
|
389 | key?: string;
|
390 | type: 'Navigation/DRAWER_CLOSED';
|
391 | }
|
392 |
|
393 | export interface NavigationOpenDrawerAction {
|
394 | key?: string;
|
395 | type: 'Navigation/OPEN_DRAWER';
|
396 | }
|
397 |
|
398 | export interface NavigationCloseDrawerAction {
|
399 | key?: string;
|
400 | type: 'Navigation/CLOSE_DRAWER';
|
401 | }
|
402 |
|
403 | export interface NavigationToggleDrawerAction {
|
404 | key?: string;
|
405 | type: 'Navigation/TOGGLE_DRAWER';
|
406 | }
|
407 |
|
408 | |
409 |
|
410 |
|
411 | export interface NavigationSwitchRouterConfig {
|
412 | initialRouteName?: string;
|
413 | initialRouteParams?: NavigationParams;
|
414 | paths?: NavigationPathsConfig;
|
415 | order?: string[];
|
416 | backBehavior?: 'none' | 'initialRoute' | 'history' | 'order';
|
417 | resetOnBlur?: boolean;
|
418 | }
|
419 |
|
420 | export function SwitchRouter(
|
421 | routeConfigs: NavigationRouteConfigMap<any, any>,
|
422 | config?: NavigationSwitchRouterConfig
|
423 | ): NavigationRouter<any, any>;
|
424 |
|
425 | export type NavigationSwitchProp<
|
426 | State = NavigationRoute,
|
427 | Params = NavigationParams
|
428 | > = NavigationScreenProp<State, Params> & {
|
429 | jumpTo(routeName: string, key?: string): void;
|
430 | };
|
431 |
|
432 | export type NavigationSwitchScreenProps<
|
433 | Params = NavigationParams,
|
434 | ScreenProps = unknown
|
435 | > = {
|
436 | theme: SupportedThemes;
|
437 | navigation: NavigationSwitchProp<NavigationRoute, Params>;
|
438 | screenProps: ScreenProps;
|
439 | };
|
440 |
|
441 | export type NavigationSwitchScreenComponent<
|
442 | Params = NavigationParams,
|
443 | ScreenProps = unknown
|
444 | > = React.ComponentType<NavigationSwitchScreenProps<Params, ScreenProps>> & {
|
445 | navigationOptions?: NavigationScreenConfig<
|
446 | {},
|
447 | NavigationSwitchProp<NavigationRoute, Params>,
|
448 | ScreenProps
|
449 | >;
|
450 | };
|
451 |
|
452 | export type NavigationStackAction =
|
453 | | NavigationInitAction
|
454 | | NavigationNavigateAction
|
455 | | NavigationBackAction
|
456 | | NavigationSetParamsAction
|
457 | | NavigationResetAction
|
458 | | NavigationReplaceAction
|
459 | | NavigationPopAction
|
460 | | NavigationPushAction
|
461 | | NavigationPopToTopAction
|
462 | | NavigationCompleteTransitionAction;
|
463 |
|
464 | export type NavigationTabAction =
|
465 | | NavigationInitAction
|
466 | | NavigationNavigateAction
|
467 | | NavigationBackAction;
|
468 |
|
469 | export type NavigationDrawerAction =
|
470 | | NavigationDrawerOpenedAction
|
471 | | NavigationDrawerClosedAction
|
472 | | NavigationOpenDrawerAction
|
473 | | NavigationCloseDrawerAction
|
474 | | NavigationToggleDrawerAction;
|
475 |
|
476 | export type NavigationSwitchAction = NavigationJumpToAction;
|
477 |
|
478 | export type NavigationAction =
|
479 | | NavigationInitAction
|
480 | | NavigationStackAction
|
481 | | NavigationTabAction
|
482 | | NavigationDrawerAction
|
483 | | NavigationSwitchAction
|
484 | | { type: 'CHILD_ACTION'; key?: string };
|
485 |
|
486 | export type NavigationRouteConfig<Options, NavigationScreenPropType> =
|
487 | | NavigationComponent<Options, NavigationScreenPropType>
|
488 | | (
|
489 | | { screen: NavigationComponent<Options, NavigationScreenPropType> }
|
490 | | {
|
491 | getScreen(): NavigationScreenComponent<
|
492 | Options,
|
493 | NavigationScreenPropType
|
494 | >;
|
495 | }) & {
|
496 | navigationOptions?: NavigationScreenConfig<
|
497 | Options,
|
498 | NavigationScreenPropType
|
499 | >;
|
500 | params?: { [key: string]: any };
|
501 | path?: string;
|
502 | };
|
503 |
|
504 | export interface NavigationPathsConfig {
|
505 | [routeName: string]: string;
|
506 | }
|
507 |
|
508 |
|
509 | export interface NavigationTabRouterConfig {
|
510 | initialRouteName?: string;
|
511 | initialRouteParams?: NavigationParams;
|
512 | paths?: NavigationPathsConfig;
|
513 | order?: string[];
|
514 | backBehavior?: 'none' | 'initialRoute' | 'history' | 'order';
|
515 | resetOnBlur?: boolean;
|
516 | }
|
517 |
|
518 | export interface NavigationRouteConfigMap<Options, NavigationScreenPropType> {
|
519 | [routeName: string]: NavigationRouteConfig<
|
520 | Options,
|
521 | NavigationScreenPropType
|
522 | >;
|
523 | }
|
524 |
|
525 | export type NavigationDispatch = (action: NavigationAction) => boolean;
|
526 |
|
527 | export interface NavigationProp<S> {
|
528 | state: S;
|
529 | dispatch: NavigationDispatch;
|
530 | }
|
531 |
|
532 | export type EventType =
|
533 | | 'willFocus'
|
534 | | 'didFocus'
|
535 | | 'willBlur'
|
536 | | 'didBlur'
|
537 | | 'action';
|
538 |
|
539 | export interface NavigationEventPayload {
|
540 | type: EventType;
|
541 | action: NavigationAction;
|
542 | state: NavigationState;
|
543 | lastState: NavigationState | null | undefined;
|
544 | }
|
545 |
|
546 | export type NavigationEventCallback = (
|
547 | payload: NavigationEventPayload
|
548 | ) => void;
|
549 |
|
550 | export interface NavigationEventSubscription {
|
551 | remove: () => void;
|
552 | }
|
553 |
|
554 | export interface NavigationEventsProps extends ViewProps {
|
555 | onWillFocus?: NavigationEventCallback;
|
556 | onDidFocus?: NavigationEventCallback;
|
557 | onWillBlur?: NavigationEventCallback;
|
558 | onDidBlur?: NavigationEventCallback;
|
559 | }
|
560 |
|
561 | export const NavigationEvents: React.ComponentType<NavigationEventsProps>;
|
562 |
|
563 | export interface NavigationScreenProp<S, P = NavigationParams> {
|
564 | state: S & { params?: P };
|
565 | dispatch: NavigationDispatch;
|
566 | goBack: (routeKey?: string | null) => boolean;
|
567 | dismiss: () => boolean;
|
568 | navigate(options: {
|
569 | routeName:
|
570 | | string
|
571 | | {
|
572 | routeName: string;
|
573 | params?: NavigationParams;
|
574 | action?: NavigationNavigateAction;
|
575 | key?: string;
|
576 | };
|
577 | params?: NavigationParams;
|
578 | action?: NavigationAction;
|
579 | key?: string;
|
580 | }): boolean;
|
581 | navigate(
|
582 | routeNameOrOptions: string,
|
583 | params?: NavigationParams,
|
584 | action?: NavigationAction
|
585 | ): boolean;
|
586 | openDrawer: () => any;
|
587 | closeDrawer: () => any;
|
588 | toggleDrawer: () => any;
|
589 | getParam<T extends keyof P>(
|
590 | param: T,
|
591 | fallback: NonNullable<P[T]>
|
592 | ): NonNullable<P[T]>;
|
593 | getParam<T extends keyof P>(param: T): P[T];
|
594 | setParams: (newParams: Partial<P>) => boolean;
|
595 | emit: (eventName: 'refocus') => void;
|
596 | addListener: (
|
597 | eventName: string,
|
598 | callback: NavigationEventCallback
|
599 | ) => NavigationEventSubscription;
|
600 | isFocused: () => boolean;
|
601 | isFirstRouteInParent: () => boolean;
|
602 | router?: NavigationRouter;
|
603 | dangerouslyGetParent: () => NavigationScreenProp<S> | undefined;
|
604 | }
|
605 |
|
606 | export interface NavigationNavigatorProps<
|
607 | Options = {},
|
608 | State = {},
|
609 | ScreenProps = unknown
|
610 | > {
|
611 | theme?: SupportedThemes | 'no-preference';
|
612 | detached?: boolean;
|
613 | navigation?: NavigationProp<State>;
|
614 | screenProps?: ScreenProps;
|
615 | navigationOptions?: Options;
|
616 | }
|
617 |
|
618 | export type NavigatorType =
|
619 | | 'react-navigation/STACK'
|
620 | | 'react-navigation/TABS'
|
621 | | 'react-navigation/DRAWER';
|
622 |
|
623 | export interface NavigationContainerProps<
|
624 | State = {},
|
625 | Options = {},
|
626 | ScreenProps = unknown
|
627 | > {
|
628 | uriPrefix?: string | RegExp;
|
629 | |
630 |
|
631 |
|
632 |
|
633 |
|
634 | enableURLHandling?: boolean;
|
635 | onNavigationStateChange?: (
|
636 | prevNavigationState: NavigationState,
|
637 | nextNavigationState: NavigationState,
|
638 | action: NavigationAction
|
639 | ) => void | null | undefined;
|
640 | navigation?: NavigationScreenProp<State>;
|
641 | |
642 |
|
643 |
|
644 |
|
645 | persistenceKey?: string | null;
|
646 |
|
647 | loadNavigationState?: () => Promise<any>;
|
648 | persistNavigationState?: (state: NavigationState) => Promise<any>;
|
649 |
|
650 | renderLoadingExperimental?: React.ComponentType;
|
651 | screenProps?: ScreenProps;
|
652 | navigationOptions?: Options;
|
653 | style?: StyleProp<ViewStyle>;
|
654 | }
|
655 |
|
656 | export interface NavigationContainerComponent
|
657 | extends React.Component<
|
658 | NavigationContainerProps & NavigationNavigatorProps<any>
|
659 | > {
|
660 | dispatch: NavigationDispatch;
|
661 | }
|
662 |
|
663 | export interface NavigationContainer
|
664 | extends React.ComponentClass<
|
665 | NavigationContainerProps & NavigationNavigatorProps<any>
|
666 | > {
|
667 | new (
|
668 | props: NavigationContainerProps & NavigationNavigatorProps<any>,
|
669 | context?: any
|
670 | ): NavigationContainerComponent;
|
671 |
|
672 | router: NavigationRouter<any, any>;
|
673 | screenProps: unknown;
|
674 | navigationOptions: any;
|
675 | state: { nav: NavigationState | null };
|
676 | }
|
677 |
|
678 | export function createSwitchNavigator(
|
679 | routeConfigMap: NavigationRouteConfigMap<{}, NavigationSwitchProp>,
|
680 | switchConfig?: CreateNavigatorConfig<
|
681 | {},
|
682 | NavigationSwitchRouterConfig,
|
683 | {},
|
684 | NavigationSwitchProp
|
685 | >
|
686 | ): NavigationNavigator<{}, NavigationProp<NavigationState>>;
|
687 |
|
688 | |
689 |
|
690 |
|
691 | export namespace NavigationActions {
|
692 | const BACK: 'Navigation/BACK';
|
693 | const INIT: 'Navigation/INIT';
|
694 | const NAVIGATE: 'Navigation/NAVIGATE';
|
695 | const SET_PARAMS: 'Navigation/SET_PARAMS';
|
696 |
|
697 | function init(options?: NavigationInitActionPayload): NavigationInitAction;
|
698 | function navigate(
|
699 | options: NavigationNavigateActionPayload
|
700 | ): NavigationNavigateAction;
|
701 | function back(options?: NavigationBackActionPayload): NavigationBackAction;
|
702 | function setParams(
|
703 | options: NavigationSetParamsActionPayload
|
704 | ): NavigationSetParamsAction;
|
705 | }
|
706 |
|
707 | |
708 |
|
709 |
|
710 | export namespace DrawerActions {
|
711 | const OPEN_DRAWER: 'Navigation/OPEN_DRAWER';
|
712 | const CLOSE_DRAWER: 'Navigation/CLOSE_DRAWER';
|
713 | const TOGGLE_DRAWER: 'Navigation/TOGGLE_DRAWER';
|
714 |
|
715 | function openDrawer(): NavigationOpenDrawerAction;
|
716 | function closeDrawer(): NavigationCloseDrawerAction;
|
717 | function toggleDrawer(): NavigationToggleDrawerAction;
|
718 | }
|
719 |
|
720 | |
721 |
|
722 |
|
723 | export namespace StackActions {
|
724 | const POP: 'Navigation/POP';
|
725 | const POP_TO_TOP: 'Navigation/POP_TO_TOP';
|
726 | const PUSH: 'Navigation/PUSH';
|
727 | const RESET: 'Navigation/RESET';
|
728 | const REPLACE: 'Navigation/REPLACE';
|
729 | const COMPLETE_TRANSITION: 'Navigation/COMPLETE_TRANSITION';
|
730 |
|
731 | function pop(options: NavigationPopActionPayload): NavigationPopAction;
|
732 | function popToTop(
|
733 | options?: NavigationPopToTopActionPayload
|
734 | ): NavigationPopToTopAction;
|
735 |
|
736 | function push(options: NavigationPushActionPayload): NavigationPushAction;
|
737 | function reset(
|
738 | options: NavigationResetActionPayload
|
739 | ): NavigationResetAction;
|
740 |
|
741 | function replace(
|
742 | options: NavigationReplaceActionPayload
|
743 | ): NavigationReplaceAction;
|
744 |
|
745 | function completeTransition(
|
746 | payload?: NavigationCompleteTransitionActionPayload
|
747 | ): NavigationCompleteTransitionAction;
|
748 | }
|
749 |
|
750 | |
751 |
|
752 |
|
753 | export namespace SwitchActions {
|
754 | const JUMP_TO: 'Navigation/JUMP_TO';
|
755 |
|
756 | function jumpTo(
|
757 | options: NavigationJumpToActionPayload
|
758 | ): NavigationJumpToAction;
|
759 | }
|
760 |
|
761 | |
762 |
|
763 |
|
764 |
|
765 |
|
766 | export function TabRouter(
|
767 | routeConfigs: NavigationRouteConfigMap<any, any>,
|
768 | config: NavigationTabRouterConfig
|
769 | ): NavigationRouter<any, any>;
|
770 |
|
771 | |
772 |
|
773 |
|
774 |
|
775 |
|
776 | export function StackRouter(
|
777 | routeConfigs: NavigationRouteConfigMap<any, any>,
|
778 | config?: NavigationTabRouterConfig
|
779 | ): NavigationRouter<any, any>;
|
780 |
|
781 | export interface NavigationStackRouterConfig {
|
782 | initialRouteName?: string;
|
783 | initialRouteParams?: NavigationParams;
|
784 | paths?: NavigationPathsConfig;
|
785 | initialRouteKey?: string;
|
786 | }
|
787 |
|
788 | |
789 |
|
790 |
|
791 |
|
792 |
|
793 | export interface NavigationDescriptor<
|
794 | Params = NavigationParams,
|
795 | Options = {},
|
796 | NavigationScreenPropType = NavigationScreenProp<NavigationRoute>
|
797 | > {
|
798 | key: string;
|
799 | state: NavigationLeafRoute<Params> | NavigationStateRoute<Params>;
|
800 | navigation: NavigationScreenPropType;
|
801 | options: Options;
|
802 | getComponent: () => React.ComponentType;
|
803 | }
|
804 |
|
805 | export type NavigationView<
|
806 | Options,
|
807 | State,
|
808 | ScreenProps = unknown
|
809 | > = React.ComponentType<
|
810 | {
|
811 | descriptors: { [key: string]: NavigationDescriptor };
|
812 | navigationConfig: Options;
|
813 | screenProps?: ScreenProps;
|
814 | } & NavigationInjectedProps
|
815 | >;
|
816 |
|
817 | export type CreateNavigatorConfig<
|
818 | NavigatorConfig,
|
819 | RouterConfig,
|
820 | Options,
|
821 | NavigationScreenPropType
|
822 | > = NavigatorConfig &
|
823 | RouterConfig & {
|
824 | defaultNavigationOptions?: NavigationScreenConfig<
|
825 | Options,
|
826 | NavigationScreenPropType
|
827 | >;
|
828 | navigationOptions?: NavigationScreenConfig<
|
829 | { [key: string]: any },
|
830 | NavigationScreenProp<NavigationRoute>
|
831 | >;
|
832 | };
|
833 |
|
834 | export function createNavigator<S, Options>(
|
835 | view: NavigationView<Options, S>,
|
836 | router: NavigationRouter<S, Options>,
|
837 | navigatorConfig?: {},
|
838 | navigatorType?: NavigatorType
|
839 | ): NavigationNavigator<Options, NavigationProp<NavigationState>>;
|
840 |
|
841 | |
842 |
|
843 |
|
844 |
|
845 |
|
846 |
|
847 |
|
848 |
|
849 | export function createNavigationContainer<Options, NavigationPropType>(
|
850 | Component: NavigationNavigator<Options, NavigationPropType>
|
851 | ): NavigationContainer;
|
852 |
|
853 | |
854 |
|
855 |
|
856 |
|
857 |
|
858 | export function createAppContainer<Options, NavigationPropType>(
|
859 | Component: NavigationNavigator<Options, NavigationPropType>
|
860 | ): NavigationContainer;
|
861 |
|
862 | export type Omit<T, K extends keyof any> = Pick<T, Exclude<keyof T, K>>;
|
863 |
|
864 | export type InferProps<
|
865 | T extends React.ComponentType<any>
|
866 | > = T extends React.ComponentType<infer P> ? P : never;
|
867 |
|
868 | export interface NavigationOrientationInjectedProps {
|
869 | isLandscape: boolean;
|
870 | }
|
871 |
|
872 | export function createKeyboardAwareNavigator<Props>(
|
873 | Comp: React.ComponentType<Props>,
|
874 | stackConfig: object
|
875 | ): React.ComponentType<Props>;
|
876 |
|
877 | export function withOrientation<P extends NavigationOrientationInjectedProps>(
|
878 | Component: React.ComponentType<P>
|
879 | ): React.ComponentType<Omit<P, keyof NavigationOrientationInjectedProps>>;
|
880 |
|
881 | export interface NavigationInjectedProps<P = NavigationParams> {
|
882 | navigation: NavigationScreenProp<NavigationRoute<P>, P>;
|
883 | }
|
884 |
|
885 |
|
886 | export function withNavigation<
|
887 | P extends NavigationInjectedProps,
|
888 | T extends React.ComponentClass<P>
|
889 | >(
|
890 | Component: T & React.ComponentClass<P>
|
891 | ): React.ComponentType<
|
892 | Omit<P, keyof NavigationInjectedProps> & {
|
893 | onRef?: React.Ref<InstanceType<T>>;
|
894 | }
|
895 | >;
|
896 |
|
897 | export function withNavigation<P extends NavigationInjectedProps>(
|
898 | Component: React.ComponentType<P>
|
899 | ): React.ComponentType<Omit<P, keyof NavigationInjectedProps>>;
|
900 |
|
901 |
|
902 | export function withNavigation<T = {}, P = NavigationParams>(
|
903 | Component: React.ComponentType<T & NavigationInjectedProps<P>>
|
904 | ): React.ComponentType<
|
905 | T & { onRef?: React.Ref<React.Component<T & NavigationInjectedProps<P>>> }
|
906 | >;
|
907 |
|
908 | export const NavigationProvider: React.ComponentType<{
|
909 | value: NavigationProp<any>;
|
910 | }>;
|
911 |
|
912 | export interface NavigationFocusInjectedProps<P = NavigationParams>
|
913 | extends NavigationInjectedProps<P> {
|
914 | isFocused: boolean;
|
915 | }
|
916 |
|
917 |
|
918 | export function withNavigationFocus<
|
919 | P extends NavigationFocusInjectedProps,
|
920 | T extends React.ComponentClass<P>
|
921 | >(
|
922 | Component: T & React.ComponentClass<P>
|
923 | ): React.ComponentType<
|
924 | Omit<P, keyof NavigationFocusInjectedProps> & {
|
925 | onRef?: React.Ref<InstanceType<T>>;
|
926 | }
|
927 | >;
|
928 |
|
929 | export function withNavigationFocus<P extends NavigationFocusInjectedProps>(
|
930 | Component: React.ComponentType<P>
|
931 | ): React.ComponentType<Omit<P, keyof NavigationFocusInjectedProps>>;
|
932 |
|
933 |
|
934 | export function withNavigationFocus<T = {}, P = NavigationParams>(
|
935 | Component: React.ComponentType<T & NavigationFocusInjectedProps<P>>
|
936 | ): React.ComponentType<
|
937 | T & {
|
938 | onRef?: React.Ref<React.Component<T & NavigationFocusInjectedProps<P>>>;
|
939 | }
|
940 | >;
|
941 |
|
942 | |
943 |
|
944 |
|
945 | export type SafeAreaViewForceInsetValue = 'always' | 'never';
|
946 | export interface SafeAreaViewProps extends ViewProps {
|
947 | forceInset?: {
|
948 | top?: SafeAreaViewForceInsetValue;
|
949 | bottom?: SafeAreaViewForceInsetValue;
|
950 | left?: SafeAreaViewForceInsetValue;
|
951 | right?: SafeAreaViewForceInsetValue;
|
952 | horizontal?: SafeAreaViewForceInsetValue;
|
953 | vertical?: SafeAreaViewForceInsetValue;
|
954 | };
|
955 | children?: React.ReactNode;
|
956 | }
|
957 |
|
958 | export const SafeAreaView: React.ComponentClass<SafeAreaViewProps>;
|
959 |
|
960 | export const NavigationContext: React.Context<
|
961 | NavigationScreenProp<NavigationRoute>
|
962 | >;
|
963 |
|
964 | export function createKeyboardAwareNavigator<Props>(
|
965 | Comp: React.ComponentType<Props>,
|
966 | stackConfig: object
|
967 | ): React.ComponentType<Props>;
|
968 |
|
969 | |
970 |
|
971 |
|
972 |
|
973 | export interface SceneViewProps {
|
974 | component: React.ComponentType;
|
975 | screenProps: unknown;
|
976 | navigation: NavigationProp<any>;
|
977 | }
|
978 |
|
979 | export const SceneView: React.ComponentType<SceneViewProps>;
|
980 |
|
981 | |
982 |
|
983 |
|
984 |
|
985 |
|
986 | export type SupportedThemes = 'light' | 'dark';
|
987 | export const ThemeContext: React.Context<SupportedThemes>;
|
988 |
|
989 |
|
990 | export function useTheme(): SupportedThemes;
|
991 |
|
992 |
|
993 | export interface Theme {
|
994 | header: string;
|
995 | headerBorder: string;
|
996 | body: string;
|
997 | bodyBorder: string;
|
998 | bodyContent: string;
|
999 | bodyContentBorder: string;
|
1000 | label: string;
|
1001 | }
|
1002 | export const ThemeColors: { [k in SupportedThemes]: Theme };
|
1003 |
|
1004 |
|
1005 | interface ThemedStatusBarProps
|
1006 | extends React.ComponentProps<typeof StatusBar> {}
|
1007 | interface ThemedTextProps extends React.ComponentProps<typeof Text> {}
|
1008 | interface ThemedTextInputProps
|
1009 | extends React.ComponentProps<typeof TextInput> {}
|
1010 |
|
1011 | export namespace Themed {
|
1012 | export const StatusBar: React.ComponentType<ThemedStatusBarProps>;
|
1013 | export const Text: React.ComponentType<ThemedTextProps>;
|
1014 | export const TextInput: React.ComponentType<ThemedTextInputProps>;
|
1015 | }
|
1016 | }
|