@react-navigation/native 7.0.0-alpha.5 → 7.0.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/Link.js +2 -2
- package/lib/commonjs/Link.js.map +1 -1
- package/lib/commonjs/LinkingContext.js.map +1 -1
- package/lib/commonjs/NavigationContainer.js +3 -5
- package/lib/commonjs/NavigationContainer.js.map +1 -1
- package/lib/commonjs/index.js +9 -25
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/{useLinkTools.js → useLinkBuilder.js} +7 -7
- package/lib/commonjs/useLinkBuilder.js.map +1 -0
- package/lib/commonjs/{theming/useTheme.js → useLinkTo.js} +21 -6
- package/lib/commonjs/useLinkTo.js.map +1 -0
- package/lib/commonjs/useUnhandledLinking.js +3 -2
- package/lib/commonjs/useUnhandledLinking.js.map +1 -1
- package/lib/module/Link.js +1 -1
- package/lib/module/Link.js.map +1 -1
- package/lib/module/LinkingContext.js.map +1 -1
- package/lib/module/NavigationContainer.js +3 -5
- package/lib/module/NavigationContainer.js.map +1 -1
- package/lib/module/index.js +2 -4
- package/lib/module/index.js.map +1 -1
- package/lib/module/{useLinkTools.js → useLinkBuilder.js} +6 -6
- package/lib/module/useLinkBuilder.js.map +1 -0
- package/lib/module/useLinkTo.js +23 -0
- package/lib/module/useLinkTo.js.map +1 -0
- package/lib/module/useUnhandledLinking.js +3 -1
- package/lib/module/useUnhandledLinking.js.map +1 -1
- package/lib/typescript/src/Link.d.ts.map +1 -1
- package/lib/typescript/src/LinkingContext.d.ts +1 -1
- package/lib/typescript/src/LinkingContext.d.ts.map +1 -1
- package/lib/typescript/src/NavigationContainer.d.ts +1 -3
- package/lib/typescript/src/NavigationContainer.d.ts.map +1 -1
- package/lib/typescript/src/__stubs__/createStackNavigator.d.ts +3 -27
- package/lib/typescript/src/__stubs__/createStackNavigator.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -4
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +22 -17
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/useLinkBuilder.d.ts +25 -0
- package/lib/typescript/src/useLinkBuilder.d.ts.map +1 -0
- package/lib/typescript/src/useLinkTo.d.ts +6 -0
- package/lib/typescript/src/useLinkTo.d.ts.map +1 -0
- package/lib/typescript/src/useLinking.d.ts +2 -18
- package/lib/typescript/src/useLinking.d.ts.map +1 -1
- package/lib/typescript/src/useLinking.native.d.ts +2 -18
- package/lib/typescript/src/useLinking.native.d.ts.map +1 -1
- package/lib/typescript/src/useUnhandledLinking.d.ts +1 -1
- package/lib/typescript/src/useUnhandledLinking.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/Link.tsx +1 -1
- package/src/LinkingContext.tsx +2 -1
- package/src/NavigationContainer.tsx +11 -15
- package/src/index.tsx +2 -4
- package/src/types.tsx +24 -17
- package/src/{useLinkTools.tsx → useLinkBuilder.tsx} +5 -5
- package/src/useLinkTo.tsx +30 -0
- package/src/useUnhandledLinking.tsx +2 -1
- package/lib/commonjs/theming/ThemeContext.js +0 -13
- package/lib/commonjs/theming/ThemeContext.js.map +0 -1
- package/lib/commonjs/theming/ThemeProvider.js +0 -20
- package/lib/commonjs/theming/ThemeProvider.js.map +0 -1
- package/lib/commonjs/theming/useTheme.js.map +0 -1
- package/lib/commonjs/useLinkTools.js.map +0 -1
- package/lib/module/theming/ThemeContext.js +0 -5
- package/lib/module/theming/ThemeContext.js.map +0 -1
- package/lib/module/theming/ThemeProvider.js +0 -12
- package/lib/module/theming/ThemeProvider.js.map +0 -1
- package/lib/module/theming/useTheme.js +0 -7
- package/lib/module/theming/useTheme.js.map +0 -1
- package/lib/module/useLinkTools.js.map +0 -1
- package/lib/typescript/src/theming/ThemeContext.d.ts +0 -4
- package/lib/typescript/src/theming/ThemeContext.d.ts.map +0 -1
- package/lib/typescript/src/theming/ThemeProvider.d.ts +0 -9
- package/lib/typescript/src/theming/ThemeProvider.d.ts.map +0 -1
- package/lib/typescript/src/theming/useTheme.d.ts +0 -2
- package/lib/typescript/src/theming/useTheme.d.ts.map +0 -1
- package/lib/typescript/src/useLinkTools.d.ts +0 -33
- package/lib/typescript/src/useLinkTools.d.ts.map +0 -1
- package/src/theming/ThemeContext.tsx +0 -8
- package/src/theming/ThemeProvider.tsx +0 -15
- package/src/theming/useTheme.tsx +0 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkingContext.d.ts","sourceRoot":"","sources":["../../../src/LinkingContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"LinkingContext.d.ts","sourceRoot":"","sources":["../../../src/LinkingContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAI9C,eAAO,MAAM,cAAc;;EAMzB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type NavigationContainerProps, type NavigationContainerRef } from '@react-navigation/core';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import type { DocumentTitleOptions, LinkingOptions, LocaleDirection
|
|
3
|
+
import type { DocumentTitleOptions, LinkingOptions, LocaleDirection } from './types';
|
|
4
4
|
declare global {
|
|
5
5
|
var REACT_NAVIGATION_DEVTOOLS: WeakMap<NavigationContainerRef<any>, {
|
|
6
6
|
readonly linking: LinkingOptions<any>;
|
|
@@ -8,14 +8,12 @@ declare global {
|
|
|
8
8
|
}
|
|
9
9
|
type Props<ParamList extends {}> = NavigationContainerProps & {
|
|
10
10
|
direction?: LocaleDirection;
|
|
11
|
-
theme?: Theme;
|
|
12
11
|
linking?: LinkingOptions<ParamList>;
|
|
13
12
|
fallback?: React.ReactNode;
|
|
14
13
|
documentTitle?: DocumentTitleOptions;
|
|
15
14
|
};
|
|
16
15
|
export declare const NavigationContainer: <RootParamList extends {} = ReactNavigation.RootParamList>(props: NavigationContainerProps & {
|
|
17
16
|
direction?: LocaleDirection | undefined;
|
|
18
|
-
theme?: Theme | undefined;
|
|
19
17
|
linking?: LinkingOptions<RootParamList> | undefined;
|
|
20
18
|
fallback?: React.ReactNode;
|
|
21
19
|
documentTitle?: DocumentTitleOptions | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationContainer.d.ts","sourceRoot":"","sources":["../../../src/NavigationContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAI5B,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"NavigationContainer.d.ts","sourceRoot":"","sources":["../../../src/NavigationContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAI5B,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,KAAK,EACV,oBAAoB,EACpB,cAAc,EACd,eAAe,EAChB,MAAM,SAAS,CAAC;AAOjB,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,yBAAyB,EAAE,OAAO,CACpC,sBAAsB,CAAC,GAAG,CAAC,EAC3B;QAAE,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC,GAAG,CAAC,CAAA;KAAE,CAC1C,CAAC;CACH;AAID,KAAK,KAAK,CAAC,SAAS,SAAS,EAAE,IAAI,wBAAwB,GAAG;IAC5D,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,OAAO,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;IACpC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,aAAa,CAAC,EAAE,oBAAoB,CAAC;CACtC,CAAC;AA8IF,eAAO,MAAM,mBAAmB;;;eAhJnB,MAAM,SAAS;;;;MAsJvB,MAAM,YAAY,CAAC"}
|
|
@@ -5,15 +5,7 @@ export declare const createStackNavigator: {
|
|
|
5
5
|
index: number;
|
|
6
6
|
routeNames: string[];
|
|
7
7
|
history?: unknown[] | undefined;
|
|
8
|
-
routes: (
|
|
9
|
-
key: string;
|
|
10
|
-
name: string;
|
|
11
|
-
path?: string | undefined;
|
|
12
|
-
}> & Readonly<{
|
|
13
|
-
params?: Readonly<object | undefined>;
|
|
14
|
-
}> & {
|
|
15
|
-
state?: Readonly<any> | import("@react-navigation/core").PartialState<Readonly<any>> | undefined;
|
|
16
|
-
})[];
|
|
8
|
+
routes: import("@react-navigation/core").NavigationRoute<import("@react-navigation/core").ParamListBase, string>[];
|
|
17
9
|
type: string;
|
|
18
10
|
stale: false;
|
|
19
11
|
}>, {}, import("@react-navigation/core").EventMapBase, (props: any) => React.JSX.Element>;
|
|
@@ -22,15 +14,7 @@ export declare const createStackNavigator: {
|
|
|
22
14
|
index: number;
|
|
23
15
|
routeNames: string[];
|
|
24
16
|
history?: unknown[] | undefined;
|
|
25
|
-
routes: (
|
|
26
|
-
key: string;
|
|
27
|
-
name: string;
|
|
28
|
-
path?: string | undefined;
|
|
29
|
-
}> & Readonly<{
|
|
30
|
-
params?: Readonly<object | undefined>;
|
|
31
|
-
}> & {
|
|
32
|
-
state?: Readonly<any> | import("@react-navigation/core").PartialState<Readonly<any>> | undefined;
|
|
33
|
-
})[];
|
|
17
|
+
routes: import("@react-navigation/core").NavigationRoute<import("@react-navigation/core").ParamListBase, string>[];
|
|
34
18
|
type: string;
|
|
35
19
|
stale: false;
|
|
36
20
|
}>, {}, import("@react-navigation/core").EventMapBase, (props: any) => React.JSX.Element>>(config: Config): import("@react-navigation/core").TypedNavigator<ParamList_1, Readonly<{
|
|
@@ -38,15 +22,7 @@ export declare const createStackNavigator: {
|
|
|
38
22
|
index: number;
|
|
39
23
|
routeNames: string[];
|
|
40
24
|
history?: unknown[] | undefined;
|
|
41
|
-
routes: (
|
|
42
|
-
key: string;
|
|
43
|
-
name: string;
|
|
44
|
-
path?: string | undefined;
|
|
45
|
-
}> & Readonly<{
|
|
46
|
-
params?: Readonly<object | undefined>;
|
|
47
|
-
}> & {
|
|
48
|
-
state?: Readonly<any> | import("@react-navigation/core").PartialState<Readonly<any>> | undefined;
|
|
49
|
-
})[];
|
|
25
|
+
routes: import("@react-navigation/core").NavigationRoute<import("@react-navigation/core").ParamListBase, string>[];
|
|
50
26
|
type: string;
|
|
51
27
|
stale: false;
|
|
52
28
|
}>, {}, import("@react-navigation/core").EventMapBase, (props: any) => React.JSX.Element> & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createStackNavigator.d.ts","sourceRoot":"","sources":["../../../../src/__stubs__/createStackNavigator.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,eAAO,MAAM,oBAAoB
|
|
1
|
+
{"version":3,"file":"createStackNavigator.d.ts","sourceRoot":"","sources":["../../../../src/__stubs__/createStackNavigator.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAW/B,CAAC"}
|
|
@@ -5,13 +5,11 @@ export { NavigationContainer } from './NavigationContainer';
|
|
|
5
5
|
export { ServerContainer } from './ServerContainer';
|
|
6
6
|
export { DarkTheme } from './theming/DarkTheme';
|
|
7
7
|
export { DefaultTheme } from './theming/DefaultTheme';
|
|
8
|
-
export { ThemeProvider } from './theming/ThemeProvider';
|
|
9
|
-
export { useTheme } from './theming/useTheme';
|
|
10
8
|
export * from './types';
|
|
9
|
+
export { useLinkBuilder } from './useLinkBuilder';
|
|
11
10
|
export { useLinkProps } from './useLinkProps';
|
|
12
|
-
export { useLinkTools } from './useLinkTools';
|
|
13
11
|
export { useLocale } from './useLocale';
|
|
14
12
|
export { useScrollToTop } from './useScrollToTop';
|
|
15
|
-
export {
|
|
13
|
+
export { UNSTABLE_useUnhandledLinking } from './useUnhandledLinking';
|
|
16
14
|
export * from '@react-navigation/core';
|
|
17
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AACrE,cAAc,wBAAwB,CAAC"}
|
|
@@ -1,26 +1,31 @@
|
|
|
1
1
|
import type { getActionFromState as getActionFromStateDefault, getPathFromState as getPathFromStateDefault, getStateFromPath as getStateFromPathDefault, PathConfigMap, Route } from '@react-navigation/core';
|
|
2
|
+
declare global {
|
|
3
|
+
namespace ReactNavigation {
|
|
4
|
+
interface Theme {
|
|
5
|
+
dark: boolean;
|
|
6
|
+
colors: {
|
|
7
|
+
primary: string;
|
|
8
|
+
background: string;
|
|
9
|
+
card: string;
|
|
10
|
+
text: string;
|
|
11
|
+
border: string;
|
|
12
|
+
notification: string;
|
|
13
|
+
};
|
|
14
|
+
fonts: {
|
|
15
|
+
regular: FontStyle;
|
|
16
|
+
medium: FontStyle;
|
|
17
|
+
bold: FontStyle;
|
|
18
|
+
heavy: FontStyle;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
2
23
|
export type LocaleDirection = 'ltr' | 'rtl';
|
|
3
24
|
type FontStyle = {
|
|
4
25
|
fontFamily: string;
|
|
5
26
|
fontWeight: 'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
|
|
6
27
|
};
|
|
7
|
-
export type Theme =
|
|
8
|
-
dark: boolean;
|
|
9
|
-
colors: {
|
|
10
|
-
primary: string;
|
|
11
|
-
background: string;
|
|
12
|
-
card: string;
|
|
13
|
-
text: string;
|
|
14
|
-
border: string;
|
|
15
|
-
notification: string;
|
|
16
|
-
};
|
|
17
|
-
fonts: {
|
|
18
|
-
regular: FontStyle;
|
|
19
|
-
medium: FontStyle;
|
|
20
|
-
bold: FontStyle;
|
|
21
|
-
heavy: FontStyle;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
28
|
+
export type Theme = ReactNavigation.Theme;
|
|
24
29
|
export type LinkingOptions<ParamList extends {}> = {
|
|
25
30
|
/**
|
|
26
31
|
* Whether deep link handling should be enabled.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,IAAI,yBAAyB,EAC/C,gBAAgB,IAAI,uBAAuB,EAC3C,gBAAgB,IAAI,uBAAuB,EAC3C,aAAa,EACb,KAAK,EACN,MAAM,wBAAwB,CAAC;AAEhC,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,IAAI,yBAAyB,EAC/C,gBAAgB,IAAI,uBAAuB,EAC3C,gBAAgB,IAAI,uBAAuB,EAC3C,aAAa,EACb,KAAK,EACN,MAAM,wBAAwB,CAAC;AAEhC,OAAO,CAAC,MAAM,CAAC;IAEb,UAAU,eAAe,CAAC;QACxB,UAAU,KAAK;YACb,IAAI,EAAE,OAAO,CAAC;YACd,MAAM,EAAE;gBACN,OAAO,EAAE,MAAM,CAAC;gBAChB,UAAU,EAAE,MAAM,CAAC;gBACnB,IAAI,EAAE,MAAM,CAAC;gBACb,IAAI,EAAE,MAAM,CAAC;gBACb,MAAM,EAAE,MAAM,CAAC;gBACf,YAAY,EAAE,MAAM,CAAC;aACtB,CAAC;YACF,KAAK,EAAE;gBACL,OAAO,EAAE,SAAS,CAAC;gBACnB,MAAM,EAAE,SAAS,CAAC;gBAClB,IAAI,EAAE,SAAS,CAAC;gBAChB,KAAK,EAAE,SAAS,CAAC;aAClB,CAAC;SACH;KACF;CACF;AAED,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,KAAK,CAAC;AAE5C,KAAK,SAAS,GAAG;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EACN,QAAQ,GACR,MAAM,GACN,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,CAAC;CACX,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG,eAAe,CAAC,KAAK,CAAC;AAE1C,MAAM,MAAM,cAAc,CAAC,SAAS,SAAS,EAAE,IAAI;IACjD;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IAClC;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,EAAE;QACP;;;;;WAKG;QACH,IAAI,CAAC,EAAE,MAAM,CAAC;QACd;;WAEG;QACH,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;QAClC;;WAEG;QACH,gBAAgB,CAAC,EAAE,MAAM,SAAS,CAAC;KACpC,CAAC;IACF;;;;;;;;;;;;OAYG;IACH,aAAa,CAAC,EAAE,MACZ,MAAM,GACN,IAAI,GACJ,SAAS,GACT,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;IACvC;;;;;;;;;;;;;;;;;;OAkBG;IACH,SAAS,CAAC,EAAE,CACV,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,KAC5B,SAAS,GAAG,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;IACrC;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,uBAAuB,CAAC;IAClD;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,uBAAuB,CAAC;IAClD;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,yBAAyB,CAAC;CACvD,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,CACV,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,EACxC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,SAAS,KAC7B,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,iBAAiB,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC;CACtD,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CommonActions, type ParamListBase } from '@react-navigation/core';
|
|
2
|
+
/**
|
|
3
|
+
* Helpers to build href or action based on the linking options.
|
|
4
|
+
* @returns `buildHref` to build an `href` for screen and `buildAction` to build an action from an `href`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useLinkBuilder(): {
|
|
7
|
+
buildHref: (name: string, params?: object) => string | undefined;
|
|
8
|
+
buildAction: (href: string) => {
|
|
9
|
+
type: "NAVIGATE";
|
|
10
|
+
payload: {
|
|
11
|
+
name: string;
|
|
12
|
+
params?: import("@react-navigation/core").NavigatorScreenParams<Readonly<{
|
|
13
|
+
key: string;
|
|
14
|
+
index: number;
|
|
15
|
+
routeNames: string[];
|
|
16
|
+
history?: unknown[] | undefined;
|
|
17
|
+
routes: import("@react-navigation/core").NavigationRoute<ParamListBase, string>[];
|
|
18
|
+
type: string;
|
|
19
|
+
stale: false;
|
|
20
|
+
}>>;
|
|
21
|
+
path?: string | undefined;
|
|
22
|
+
};
|
|
23
|
+
} | CommonActions.Action;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=useLinkBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLinkBuilder.d.ts","sourceRoot":"","sources":["../../../src/useLinkBuilder.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAOb,KAAK,aAAa,EACnB,MAAM,wBAAwB,CAAC;AAqChC;;;GAGG;AACH,wBAAgB,cAAc;sBAKnB,MAAM,WAAW,MAAM;wBA6BvB,MAAM;;;;;;;;;;;;;;;;EA0BhB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLinkTo.d.ts","sourceRoot":"","sources":["../../../src/useLinkTo.tsx"],"names":[],"mappings":"AAKA;;;GAGG;AACH,wBAAgB,SAAS,WAKd,MAAM,UAehB"}
|
|
@@ -12,15 +12,7 @@ export declare function useLinking(ref: React.RefObject<NavigationContainerRef<P
|
|
|
12
12
|
index: number;
|
|
13
13
|
routeNames: string[];
|
|
14
14
|
history?: unknown[] | undefined;
|
|
15
|
-
routes: (
|
|
16
|
-
key: string;
|
|
17
|
-
name: string;
|
|
18
|
-
path?: string | undefined;
|
|
19
|
-
}> & Readonly<{
|
|
20
|
-
params?: Readonly<object | undefined>;
|
|
21
|
-
}> & {
|
|
22
|
-
state?: Readonly<any> | import("@react-navigation/core").PartialState<Readonly<any>> | undefined;
|
|
23
|
-
})[];
|
|
15
|
+
routes: import("@react-navigation/core").NavigationRoute<ParamListBase, string>[];
|
|
24
16
|
type: string;
|
|
25
17
|
stale: false;
|
|
26
18
|
}>, "stale" | "routes">> & Readonly<{
|
|
@@ -32,15 +24,7 @@ export declare function useLinking(ref: React.RefObject<NavigationContainerRef<P
|
|
|
32
24
|
index: number;
|
|
33
25
|
routeNames: string[];
|
|
34
26
|
history?: unknown[] | undefined;
|
|
35
|
-
routes: (
|
|
36
|
-
key: string;
|
|
37
|
-
name: string;
|
|
38
|
-
path?: string | undefined;
|
|
39
|
-
}> & Readonly<{
|
|
40
|
-
params?: Readonly<object | undefined>;
|
|
41
|
-
}> & {
|
|
42
|
-
state?: Readonly<any> | import("@react-navigation/core").PartialState<Readonly<any>> | undefined;
|
|
43
|
-
})[];
|
|
27
|
+
routes: import("@react-navigation/core").NavigationRoute<ParamListBase, string>[];
|
|
44
28
|
type: string;
|
|
45
29
|
stale: false;
|
|
46
30
|
}>, "stale" | "routes">> & Readonly<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLinking.d.ts","sourceRoot":"","sources":["../../../src/useLinking.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,sBAAsB,EAE3B,KAAK,aAAa,EAEnB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AA4C9C;;GAEG;AACH,eAAO,MAAM,MAAM,OAAQ,MAAM,QAAQ,IAAI,CAAC,eAO7C,CAAC;AAIF,KAAK,OAAO,GAAG,cAAc,CAAC,aAAa,CAAC,CAAC;AAE7C,wBAAgB,UAAU,CACxB,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC,EAC3D,EACE,OAAc,EACd,MAAM,EACN,gBAA0C,EAC1C,gBAA0C,EAC1C,kBAA8C,GAC/C,EAAE,OAAO,EACV,kBAAkB,EAAE,CAAC,mBAAmB,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI
|
|
1
|
+
{"version":3,"file":"useLinking.d.ts","sourceRoot":"","sources":["../../../src/useLinking.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,sBAAsB,EAE3B,KAAK,aAAa,EAEnB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AA4C9C;;GAEG;AACH,eAAO,MAAM,MAAM,OAAQ,MAAM,QAAQ,IAAI,CAAC,eAO7C,CAAC;AAIF,KAAK,OAAO,GAAG,cAAc,CAAC,aAAa,CAAC,CAAC;AAE7C,wBAAgB,UAAU,CACxB,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC,EAC3D,EACE,OAAc,EACd,MAAM,EACN,gBAA0C,EAC1C,gBAA0C,EAC1C,kBAA8C,GAC/C,EAAE,OAAO,EACV,kBAAkB,EAAE,CAAC,mBAAmB,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;EA2UtE"}
|
|
@@ -8,15 +8,7 @@ export declare function useLinking(ref: React.RefObject<NavigationContainerRef<P
|
|
|
8
8
|
index: number;
|
|
9
9
|
routeNames: string[];
|
|
10
10
|
history?: unknown[] | undefined;
|
|
11
|
-
routes: (
|
|
12
|
-
key: string;
|
|
13
|
-
name: string;
|
|
14
|
-
path?: string | undefined;
|
|
15
|
-
}> & Readonly<{
|
|
16
|
-
params?: Readonly<object | undefined>;
|
|
17
|
-
}> & {
|
|
18
|
-
state?: Readonly<any> | import("@react-navigation/core").PartialState<Readonly<any>> | undefined;
|
|
19
|
-
})[];
|
|
11
|
+
routes: import("@react-navigation/core").NavigationRoute<ParamListBase, string>[];
|
|
20
12
|
type: string;
|
|
21
13
|
stale: false;
|
|
22
14
|
}>, "stale" | "routes">> & Readonly<{
|
|
@@ -28,15 +20,7 @@ export declare function useLinking(ref: React.RefObject<NavigationContainerRef<P
|
|
|
28
20
|
index: number;
|
|
29
21
|
routeNames: string[];
|
|
30
22
|
history?: unknown[] | undefined;
|
|
31
|
-
routes: (
|
|
32
|
-
key: string;
|
|
33
|
-
name: string;
|
|
34
|
-
path?: string | undefined;
|
|
35
|
-
}> & Readonly<{
|
|
36
|
-
params?: Readonly<object | undefined>;
|
|
37
|
-
}> & {
|
|
38
|
-
state?: Readonly<any> | import("@react-navigation/core").PartialState<Readonly<any>> | undefined;
|
|
39
|
-
})[];
|
|
23
|
+
routes: import("@react-navigation/core").NavigationRoute<ParamListBase, string>[];
|
|
40
24
|
type: string;
|
|
41
25
|
stale: false;
|
|
42
26
|
}>, "stale" | "routes">> & Readonly<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLinking.native.d.ts","sourceRoot":"","sources":["../../../src/useLinking.native.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAEnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAI9C,KAAK,OAAO,GAAG,cAAc,CAAC,aAAa,CAAC,CAAC;AAI7C,wBAAgB,UAAU,CACxB,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC,EAC3D,EACE,OAAc,EACd,QAAQ,EACR,MAAM,EACN,MAAM,EACN,aAQI,EACJ,SAmBC,EACD,gBAA0C,EAC1C,kBAA8C,GAC/C,EAAE,OAAO,EACV,kBAAkB,EAAE,CAAC,mBAAmB,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI
|
|
1
|
+
{"version":3,"file":"useLinking.native.d.ts","sourceRoot":"","sources":["../../../src/useLinking.native.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAEnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAI9C,KAAK,OAAO,GAAG,cAAc,CAAC,aAAa,CAAC,CAAC;AAI7C,wBAAgB,UAAU,CACxB,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC,EAC3D,EACE,OAAc,EACd,QAAQ,EACR,MAAM,EACN,MAAM,EACN,aAQI,EACJ,SAmBC,EACD,gBAA0C,EAC1C,kBAA8C,GAC/C,EAAE,OAAO,EACV,kBAAkB,EAAE,CAAC,mBAAmB,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;EAkKtE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type NavigationState, type PartialState } from '@react-navigation/core';
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function UNSTABLE_useUnhandledLinking(): {
|
|
3
3
|
lastUnhandledLink: string | undefined;
|
|
4
4
|
getStateForRouteNamesChange: (currentState: NavigationState) => PartialState<NavigationState> | undefined;
|
|
5
5
|
clearUnhandledLink: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUnhandledLinking.d.ts","sourceRoot":"","sources":["../../../src/useUnhandledLinking.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,YAAY,EAClB,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"useUnhandledLinking.d.ts","sourceRoot":"","sources":["../../../src/useUnhandledLinking.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,YAAY,EAClB,MAAM,wBAAwB,CAAC;AA2BhC,wBAAgB,4BAA4B;;gDAU1B,eAAe,KAC5B,aAAa,eAAe,CAAC,GAAG,SAAS;;EA+C7C"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-navigation/native",
|
|
3
3
|
"description": "React Native integration for React Navigation",
|
|
4
|
-
"version": "7.0.0-alpha.
|
|
4
|
+
"version": "7.0.0-alpha.7",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
7
7
|
"react-navigation",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"clean": "del lib"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@react-navigation/core": "^7.0.0-alpha.
|
|
40
|
+
"@react-navigation/core": "^7.0.0-alpha.7",
|
|
41
41
|
"escape-string-regexp": "^4.0.0",
|
|
42
42
|
"fast-deep-equal": "^3.1.3",
|
|
43
43
|
"nanoid": "3.3.6",
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
]
|
|
73
73
|
]
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "d0e6a2cd79d2c6aff0cf54e46e31edc407c3c46b"
|
|
76
76
|
}
|
package/src/Link.tsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useTheme } from '@react-navigation/core';
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import {
|
|
3
4
|
type GestureResponderEvent,
|
|
@@ -6,7 +7,6 @@ import {
|
|
|
6
7
|
type TextProps,
|
|
7
8
|
} from 'react-native';
|
|
8
9
|
|
|
9
|
-
import { useTheme } from './theming/useTheme';
|
|
10
10
|
import { type Props as LinkProps, useLinkProps } from './useLinkProps';
|
|
11
11
|
|
|
12
12
|
type Props<ParamList extends ReactNavigation.RootParamList> =
|
package/src/LinkingContext.tsx
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ParamListBase } from '@react-navigation/core';
|
|
2
|
-
import type { LinkingOptions } from '@react-navigation/native/src/types';
|
|
3
2
|
import * as React from 'react';
|
|
4
3
|
|
|
4
|
+
import type { LinkingOptions } from './types';
|
|
5
|
+
|
|
5
6
|
const MISSING_CONTEXT_ERROR = "Couldn't find a LinkingContext context.";
|
|
6
7
|
|
|
7
8
|
export const LinkingContext = React.createContext<{
|
|
@@ -16,12 +16,10 @@ import useLatestCallback from 'use-latest-callback';
|
|
|
16
16
|
import { LinkingContext } from './LinkingContext';
|
|
17
17
|
import { LocaleDirContext } from './LocaleDirContext';
|
|
18
18
|
import { DefaultTheme } from './theming/DefaultTheme';
|
|
19
|
-
import { ThemeProvider } from './theming/ThemeProvider';
|
|
20
19
|
import type {
|
|
21
20
|
DocumentTitleOptions,
|
|
22
21
|
LinkingOptions,
|
|
23
22
|
LocaleDirection,
|
|
24
|
-
Theme,
|
|
25
23
|
} from './types';
|
|
26
24
|
import { UnhandledLinkingContext } from './UnhandledLinkingContext';
|
|
27
25
|
import { useBackButton } from './useBackButton';
|
|
@@ -41,7 +39,6 @@ global.REACT_NAVIGATION_DEVTOOLS = new WeakMap();
|
|
|
41
39
|
|
|
42
40
|
type Props<ParamList extends {}> = NavigationContainerProps & {
|
|
43
41
|
direction?: LocaleDirection;
|
|
44
|
-
theme?: Theme;
|
|
45
42
|
linking?: LinkingOptions<ParamList>;
|
|
46
43
|
fallback?: React.ReactNode;
|
|
47
44
|
documentTitle?: DocumentTitleOptions;
|
|
@@ -56,7 +53,7 @@ type Props<ParamList extends {}> = NavigationContainerProps & {
|
|
|
56
53
|
* @param props.onStateChange Callback which is called with the latest navigation state when it changes.
|
|
57
54
|
* @param props.onUnhandledAction Callback which is called when an action is not handled.
|
|
58
55
|
* @param props.direction Text direction of the components. Defaults to `'ltr'`.
|
|
59
|
-
* @param props.theme Theme object for the
|
|
56
|
+
* @param props.theme Theme object for the UI elements.
|
|
60
57
|
* @param props.linking Options for deep linking. Deep link handling is enabled when this prop is provided, unless `linking.enabled` is `false`.
|
|
61
58
|
* @param props.fallback Fallback component to render until we have finished getting initial state when linking is enabled. Defaults to `null`.
|
|
62
59
|
* @param props.documentTitle Options to configure the document title on Web. Updating document title is handled by default unless `documentTitle.enabled` is `false`.
|
|
@@ -171,17 +168,16 @@ function NavigationContainerInner(
|
|
|
171
168
|
<LocaleDirContext.Provider value={direction}>
|
|
172
169
|
<UnhandledLinkingContext.Provider value={unhandledLinkingContext}>
|
|
173
170
|
<LinkingContext.Provider value={linkingContext}>
|
|
174
|
-
<
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
</ThemeProvider>
|
|
171
|
+
<BaseNavigationContainer
|
|
172
|
+
{...rest}
|
|
173
|
+
theme={theme}
|
|
174
|
+
onReady={onReadyForLinkingHandling}
|
|
175
|
+
onStateChange={onStateChangeForLinkingHandling}
|
|
176
|
+
initialState={
|
|
177
|
+
rest.initialState == null ? initialState : rest.initialState
|
|
178
|
+
}
|
|
179
|
+
ref={refContainer}
|
|
180
|
+
/>
|
|
185
181
|
</LinkingContext.Provider>
|
|
186
182
|
</UnhandledLinkingContext.Provider>
|
|
187
183
|
</LocaleDirContext.Provider>
|
package/src/index.tsx
CHANGED
|
@@ -5,12 +5,10 @@ export { NavigationContainer } from './NavigationContainer';
|
|
|
5
5
|
export { ServerContainer } from './ServerContainer';
|
|
6
6
|
export { DarkTheme } from './theming/DarkTheme';
|
|
7
7
|
export { DefaultTheme } from './theming/DefaultTheme';
|
|
8
|
-
export { ThemeProvider } from './theming/ThemeProvider';
|
|
9
|
-
export { useTheme } from './theming/useTheme';
|
|
10
8
|
export * from './types';
|
|
9
|
+
export { useLinkBuilder } from './useLinkBuilder';
|
|
11
10
|
export { useLinkProps } from './useLinkProps';
|
|
12
|
-
export { useLinkTools } from './useLinkTools';
|
|
13
11
|
export { useLocale } from './useLocale';
|
|
14
12
|
export { useScrollToTop } from './useScrollToTop';
|
|
15
|
-
export {
|
|
13
|
+
export { UNSTABLE_useUnhandledLinking } from './useUnhandledLinking';
|
|
16
14
|
export * from '@react-navigation/core';
|
package/src/types.tsx
CHANGED
|
@@ -6,6 +6,29 @@ import type {
|
|
|
6
6
|
Route,
|
|
7
7
|
} from '@react-navigation/core';
|
|
8
8
|
|
|
9
|
+
declare global {
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
11
|
+
namespace ReactNavigation {
|
|
12
|
+
interface Theme {
|
|
13
|
+
dark: boolean;
|
|
14
|
+
colors: {
|
|
15
|
+
primary: string;
|
|
16
|
+
background: string;
|
|
17
|
+
card: string;
|
|
18
|
+
text: string;
|
|
19
|
+
border: string;
|
|
20
|
+
notification: string;
|
|
21
|
+
};
|
|
22
|
+
fonts: {
|
|
23
|
+
regular: FontStyle;
|
|
24
|
+
medium: FontStyle;
|
|
25
|
+
bold: FontStyle;
|
|
26
|
+
heavy: FontStyle;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
9
32
|
export type LocaleDirection = 'ltr' | 'rtl';
|
|
10
33
|
|
|
11
34
|
type FontStyle = {
|
|
@@ -24,23 +47,7 @@ type FontStyle = {
|
|
|
24
47
|
| '900';
|
|
25
48
|
};
|
|
26
49
|
|
|
27
|
-
export type Theme =
|
|
28
|
-
dark: boolean;
|
|
29
|
-
colors: {
|
|
30
|
-
primary: string;
|
|
31
|
-
background: string;
|
|
32
|
-
card: string;
|
|
33
|
-
text: string;
|
|
34
|
-
border: string;
|
|
35
|
-
notification: string;
|
|
36
|
-
};
|
|
37
|
-
fonts: {
|
|
38
|
-
regular: FontStyle;
|
|
39
|
-
medium: FontStyle;
|
|
40
|
-
bold: FontStyle;
|
|
41
|
-
heavy: FontStyle;
|
|
42
|
-
};
|
|
43
|
-
};
|
|
50
|
+
export type Theme = ReactNavigation.Theme;
|
|
44
51
|
|
|
45
52
|
export type LinkingOptions<ParamList extends {}> = {
|
|
46
53
|
/**
|
|
@@ -45,10 +45,10 @@ const getRootStateForNavigate = (
|
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
|
-
*
|
|
49
|
-
*
|
|
48
|
+
* Helpers to build href or action based on the linking options.
|
|
49
|
+
* @returns `buildHref` to build an `href` for screen and `buildAction` to build an action from an `href`.
|
|
50
50
|
*/
|
|
51
|
-
export function
|
|
51
|
+
export function useLinkBuilder() {
|
|
52
52
|
const navigation = React.useContext(NavigationHelpersContext);
|
|
53
53
|
const linking = React.useContext(LinkingContext);
|
|
54
54
|
|
|
@@ -84,7 +84,7 @@ export function useLinkTools() {
|
|
|
84
84
|
const buildAction = React.useCallback(
|
|
85
85
|
(href: string) => {
|
|
86
86
|
if (!href.startsWith('/')) {
|
|
87
|
-
throw new Error(`The
|
|
87
|
+
throw new Error(`The href must start with '/' (${href}).`);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
const { options } = linking;
|
|
@@ -98,7 +98,7 @@ export function useLinkTools() {
|
|
|
98
98
|
|
|
99
99
|
return action ?? CommonActions.reset(state);
|
|
100
100
|
} else {
|
|
101
|
-
throw new Error('Failed to parse the
|
|
101
|
+
throw new Error('Failed to parse the href to a navigation state.');
|
|
102
102
|
}
|
|
103
103
|
},
|
|
104
104
|
[linking]
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { NavigationContainerRefContext } from '@react-navigation/core';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
import { useLinkBuilder } from './useLinkBuilder';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Helper to navigate to a screen using a href based on the linking options.
|
|
8
|
+
* @returns function that receives the href to navigate to.
|
|
9
|
+
*/
|
|
10
|
+
export function useLinkTo() {
|
|
11
|
+
const navigation = React.useContext(NavigationContainerRefContext);
|
|
12
|
+
const { buildAction } = useLinkBuilder();
|
|
13
|
+
|
|
14
|
+
const linkTo = React.useCallback(
|
|
15
|
+
(href: string) => {
|
|
16
|
+
if (navigation === undefined) {
|
|
17
|
+
throw new Error(
|
|
18
|
+
"Couldn't find a navigation object. Is your component inside NavigationContainer?"
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const action = buildAction(href);
|
|
23
|
+
|
|
24
|
+
navigation.dispatch(action);
|
|
25
|
+
},
|
|
26
|
+
[buildAction, navigation]
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
return linkTo;
|
|
30
|
+
}
|
|
@@ -10,6 +10,7 @@ import useLatestCallback from 'use-latest-callback';
|
|
|
10
10
|
import { LinkingContext } from './LinkingContext';
|
|
11
11
|
import { UnhandledLinkingContext } from './UnhandledLinkingContext';
|
|
12
12
|
|
|
13
|
+
// FIXME: don't rely on depth only to get the navigator state
|
|
13
14
|
function extractNavigatorSpecificState(
|
|
14
15
|
_: NavigationState,
|
|
15
16
|
pathState: PartialState<NavigationState>,
|
|
@@ -29,7 +30,7 @@ function extractNavigatorSpecificState(
|
|
|
29
30
|
return partialPathState;
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
export function
|
|
33
|
+
export function UNSTABLE_useUnhandledLinking() {
|
|
33
34
|
const navigation = React.useContext(NavigationContext);
|
|
34
35
|
const linking = React.useContext(LinkingContext);
|
|
35
36
|
const { setLastUnhandledLink, lastUnhandledLink } = React.useContext(
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ThemeContext = void 0;
|
|
7
|
-
var React = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _DefaultTheme = require("./DefaultTheme");
|
|
9
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
10
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
|
-
const ThemeContext = exports.ThemeContext = /*#__PURE__*/React.createContext(_DefaultTheme.DefaultTheme);
|
|
12
|
-
ThemeContext.displayName = 'ThemeContext';
|
|
13
|
-
//# sourceMappingURL=ThemeContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","_interopRequireWildcard","require","_DefaultTheme","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","ThemeContext","exports","createContext","DefaultTheme","displayName"],"sourceRoot":"../../../src","sources":["theming/ThemeContext.tsx"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,aAAA,GAAAD,OAAA;AAA8C,SAAAE,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAJ,wBAAAI,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAI,CAAA,KAAAA,CAAA,CAAAX,GAAA,IAAAW,CAAA,CAAAC,GAAA,IAAAR,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAI,CAAA,IAAAV,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAgB,GAAA,CAAAnB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAEvC,MAAMY,YAAY,GAAAC,OAAA,CAAAD,YAAA,gBAAGzB,KAAK,CAAC2B,aAAa,CAAQC,0BAAY,CAAC;AAEpEH,YAAY,CAACI,WAAW,GAAG,cAAc"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ThemeProvider = ThemeProvider;
|
|
7
|
-
var React = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _ThemeContext = require("./ThemeContext");
|
|
9
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
10
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
|
-
function ThemeProvider(_ref) {
|
|
12
|
-
let {
|
|
13
|
-
value,
|
|
14
|
-
children
|
|
15
|
-
} = _ref;
|
|
16
|
-
return /*#__PURE__*/React.createElement(_ThemeContext.ThemeContext.Provider, {
|
|
17
|
-
value: value
|
|
18
|
-
}, children);
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=ThemeProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","_interopRequireWildcard","require","_ThemeContext","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","ThemeProvider","_ref","value","children","createElement","ThemeContext","Provider"],"sourceRoot":"../../../src","sources":["theming/ThemeProvider.tsx"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,aAAA,GAAAD,OAAA;AAA8C,SAAAE,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAJ,wBAAAI,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAI,CAAA,KAAAA,CAAA,CAAAX,GAAA,IAAAW,CAAA,CAAAC,GAAA,IAAAR,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAI,CAAA,IAAAV,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAgB,GAAA,CAAAnB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAOvC,SAASY,aAAaA,CAAAC,IAAA,EAA6B;EAAA,IAA5B;IAAEC,KAAK;IAAEC;EAAgB,CAAC,GAAAF,IAAA;EACtD,oBACE1B,KAAA,CAAA6B,aAAA,CAAC1B,aAAA,CAAA2B,YAAY,CAACC,QAAQ;IAACJ,KAAK,EAAEA;EAAM,GAAEC,QAAgC,CAAC;AAE3E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","_interopRequireWildcard","require","_ThemeContext","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","useTheme","theme","useContext","ThemeContext"],"sourceRoot":"../../../src","sources":["theming/useTheme.tsx"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,aAAA,GAAAD,OAAA;AAA8C,SAAAE,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAJ,wBAAAI,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAI,CAAA,KAAAA,CAAA,CAAAX,GAAA,IAAAW,CAAA,CAAAC,GAAA,IAAAR,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAI,CAAA,IAAAV,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAgB,GAAA,CAAAnB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAEvC,SAASY,QAAQA,CAAA,EAAG;EACzB,MAAMC,KAAK,GAAG1B,KAAK,CAAC2B,UAAU,CAACC,0BAAY,CAAC;EAE5C,OAAOF,KAAK;AACd"}
|