@react-navigation/native 7.0.0-alpha.3 → 7.0.0-alpha.5
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 +13 -5
- package/lib/commonjs/Link.js.map +1 -1
- package/lib/commonjs/LinkingContext.js +7 -5
- package/lib/commonjs/LinkingContext.js.map +1 -1
- package/lib/commonjs/LocaleDirContext.js +3 -4
- package/lib/commonjs/LocaleDirContext.js.map +1 -1
- package/lib/commonjs/NavigationContainer.js +48 -14
- package/lib/commonjs/NavigationContainer.js.map +1 -1
- package/lib/commonjs/ServerContainer.js +3 -4
- package/lib/commonjs/ServerContainer.js.map +1 -1
- package/lib/commonjs/ServerContext.js +3 -4
- package/lib/commonjs/ServerContext.js.map +1 -1
- package/lib/commonjs/UnhandledLinkingContext.js +20 -0
- package/lib/commonjs/UnhandledLinkingContext.js.map +1 -0
- package/lib/commonjs/__stubs__/createStackNavigator.js +19 -0
- package/lib/commonjs/__stubs__/createStackNavigator.js.map +1 -0
- package/lib/commonjs/__stubs__/window.js +79 -0
- package/lib/commonjs/__stubs__/window.js.map +1 -0
- package/lib/commonjs/createMemoryHistory.js +4 -7
- package/lib/commonjs/createMemoryHistory.js.map +1 -1
- package/lib/commonjs/createStaticNavigation.js +2 -2
- package/lib/commonjs/createStaticNavigation.js.map +1 -1
- package/lib/commonjs/extractPathFromURL.js +1 -2
- package/lib/commonjs/extractPathFromURL.js.map +1 -1
- package/lib/commonjs/index.js +9 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/theming/DarkTheme.js +1 -2
- package/lib/commonjs/theming/DarkTheme.js.map +1 -1
- package/lib/commonjs/theming/DefaultTheme.js +1 -2
- package/lib/commonjs/theming/DefaultTheme.js.map +1 -1
- package/lib/commonjs/theming/ThemeContext.js +3 -4
- package/lib/commonjs/theming/ThemeContext.js.map +1 -1
- package/lib/commonjs/theming/ThemeProvider.js +2 -2
- package/lib/commonjs/theming/ThemeProvider.js.map +1 -1
- package/lib/commonjs/theming/fonts.js +1 -2
- package/lib/commonjs/theming/fonts.js.map +1 -1
- package/lib/commonjs/theming/useTheme.js +2 -2
- package/lib/commonjs/theming/useTheme.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/useBackButton.js +3 -19
- package/lib/commonjs/useBackButton.js.map +1 -1
- package/lib/commonjs/useBackButton.native.js +27 -0
- package/lib/commonjs/useBackButton.native.js.map +1 -0
- package/lib/commonjs/useDocumentTitle.js +5 -5
- package/lib/commonjs/useDocumentTitle.js.map +1 -1
- package/lib/commonjs/useDocumentTitle.native.js.map +1 -1
- package/lib/commonjs/useLinkProps.js +20 -23
- package/lib/commonjs/useLinkProps.js.map +1 -1
- package/lib/commonjs/useLinkTools.js +6 -6
- package/lib/commonjs/useLinkTools.js.map +1 -1
- package/lib/commonjs/useLinking.js +26 -13
- package/lib/commonjs/useLinking.js.map +1 -1
- package/lib/commonjs/useLinking.native.js +30 -23
- package/lib/commonjs/useLinking.native.js.map +1 -1
- package/lib/commonjs/useLocale.js +2 -2
- package/lib/commonjs/useLocale.js.map +1 -1
- package/lib/commonjs/useScrollToTop.js +4 -4
- package/lib/commonjs/useScrollToTop.js.map +1 -1
- package/lib/commonjs/useThenable.js +3 -2
- package/lib/commonjs/useThenable.js.map +1 -1
- package/lib/commonjs/useUnhandledLinking.js +74 -0
- package/lib/commonjs/useUnhandledLinking.js.map +1 -0
- package/lib/module/Link.js +11 -3
- package/lib/module/Link.js.map +1 -1
- package/lib/module/LinkingContext.js +4 -1
- package/lib/module/LinkingContext.js.map +1 -1
- package/lib/module/LocaleDirContext.js.map +1 -1
- package/lib/module/NavigationContainer.js +44 -10
- package/lib/module/NavigationContainer.js.map +1 -1
- package/lib/module/ServerContainer.js.map +1 -1
- package/lib/module/ServerContext.js.map +1 -1
- package/lib/module/UnhandledLinkingContext.js +12 -0
- package/lib/module/UnhandledLinkingContext.js.map +1 -0
- package/lib/module/__stubs__/createStackNavigator.js +11 -0
- package/lib/module/__stubs__/createStackNavigator.js.map +1 -0
- package/lib/module/__stubs__/window.js +73 -0
- package/lib/module/__stubs__/window.js.map +1 -0
- package/lib/module/createMemoryHistory.js +4 -7
- package/lib/module/createMemoryHistory.js.map +1 -1
- package/lib/module/createStaticNavigation.js.map +1 -1
- package/lib/module/extractPathFromURL.js +1 -2
- package/lib/module/extractPathFromURL.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/theming/DarkTheme.js.map +1 -1
- package/lib/module/theming/DefaultTheme.js.map +1 -1
- package/lib/module/theming/ThemeContext.js.map +1 -1
- package/lib/module/theming/ThemeProvider.js.map +1 -1
- package/lib/module/theming/fonts.js.map +1 -1
- package/lib/module/theming/useTheme.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/useBackButton.js +3 -17
- package/lib/module/useBackButton.js.map +1 -1
- package/lib/module/useBackButton.native.js +19 -0
- package/lib/module/useBackButton.native.js.map +1 -0
- package/lib/module/useDocumentTitle.js +3 -3
- package/lib/module/useDocumentTitle.js.map +1 -1
- package/lib/module/useDocumentTitle.native.js.map +1 -1
- package/lib/module/useLinkProps.js +18 -21
- package/lib/module/useLinkProps.js.map +1 -1
- package/lib/module/useLinkTools.js +4 -4
- package/lib/module/useLinkTools.js.map +1 -1
- package/lib/module/useLinking.js +24 -11
- package/lib/module/useLinking.js.map +1 -1
- package/lib/module/useLinking.native.js +28 -21
- package/lib/module/useLinking.native.js.map +1 -1
- package/lib/module/useLocale.js.map +1 -1
- package/lib/module/useScrollToTop.js +2 -2
- package/lib/module/useScrollToTop.js.map +1 -1
- package/lib/module/useThenable.js +1 -0
- package/lib/module/useThenable.js.map +1 -1
- package/lib/module/useUnhandledLinking.js +67 -0
- package/lib/module/useUnhandledLinking.js.map +1 -0
- package/lib/typescript/src/Link.d.ts +3 -3
- package/lib/typescript/src/Link.d.ts.map +1 -1
- package/lib/typescript/src/LinkingContext.d.ts +2 -2
- package/lib/typescript/src/LinkingContext.d.ts.map +1 -1
- package/lib/typescript/src/NavigationContainer.d.ts +1 -1
- package/lib/typescript/src/NavigationContainer.d.ts.map +1 -1
- package/lib/typescript/src/ServerContainer.d.ts +1 -1
- package/lib/typescript/src/ServerContainer.d.ts.map +1 -1
- package/lib/typescript/src/UnhandledLinkingContext.d.ts +6 -0
- package/lib/typescript/src/UnhandledLinkingContext.d.ts.map +1 -0
- package/lib/typescript/src/{__mocks__ → __stubs__}/createStackNavigator.d.ts +5 -4
- package/lib/typescript/src/__stubs__/createStackNavigator.d.ts.map +1 -0
- package/lib/typescript/src/{__mocks__ → __stubs__}/window.d.ts +1 -1
- package/lib/typescript/src/{__mocks__ → __stubs__}/window.d.ts.map +1 -1
- package/lib/typescript/src/createStaticNavigation.d.ts +2 -2
- package/lib/typescript/src/createStaticNavigation.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/theming/ThemeProvider.d.ts +1 -1
- package/lib/typescript/src/theming/ThemeProvider.d.ts.map +1 -1
- package/lib/typescript/src/useBackButton.d.ts +2 -2
- package/lib/typescript/src/useBackButton.d.ts.map +1 -1
- package/lib/typescript/src/useBackButton.native.d.ts +4 -0
- package/lib/typescript/src/useBackButton.native.d.ts.map +1 -0
- package/lib/typescript/src/useLinkProps.d.ts +2 -2
- package/lib/typescript/src/useLinkProps.d.ts.map +1 -1
- package/lib/typescript/src/useLinking.d.ts +2 -2
- package/lib/typescript/src/useLinking.d.ts.map +1 -1
- package/lib/typescript/src/useLinking.native.d.ts +2 -2
- package/lib/typescript/src/useLinking.native.d.ts.map +1 -1
- package/lib/typescript/src/useThenable.d.ts.map +1 -1
- package/lib/typescript/src/useUnhandledLinking.d.ts +7 -0
- package/lib/typescript/src/useUnhandledLinking.d.ts.map +1 -0
- package/package.json +12 -12
- package/src/Link.tsx +11 -2
- package/src/LinkingContext.tsx +8 -3
- package/src/NavigationContainer.tsx +68 -20
- package/src/ServerContainer.tsx +1 -1
- package/src/UnhandledLinkingContext.tsx +18 -0
- package/src/{__mocks__ → __stubs__}/window.tsx +7 -5
- package/src/createStaticNavigation.tsx +2 -2
- package/src/index.tsx +1 -0
- package/src/useBackButton.native.tsx +33 -0
- package/src/useBackButton.tsx +3 -25
- package/src/useLinkProps.tsx +20 -19
- package/src/useLinkTools.tsx +3 -3
- package/src/useLinking.native.tsx +26 -20
- package/src/useLinking.tsx +33 -12
- package/src/useScrollToTop.tsx +4 -4
- package/src/useThenable.tsx +1 -0
- package/src/useUnhandledLinking.tsx +90 -0
- package/lib/commonjs/useBackButton.web.js +0 -8
- package/lib/commonjs/useBackButton.web.js.map +0 -1
- package/lib/module/useBackButton.web.js +0 -2
- package/lib/module/useBackButton.web.js.map +0 -1
- package/lib/typescript/src/__mocks__/createStackNavigator.d.ts.map +0 -1
- package/lib/typescript/src/useBackButton.web.d.ts +0 -2
- package/lib/typescript/src/useBackButton.web.d.ts.map +0 -1
- package/src/useBackButton.web.tsx +0 -1
- /package/src/{__mocks__ → __stubs__}/createStackNavigator.tsx +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ParamListBase } from '@react-navigation/core';
|
|
2
|
+
import type { LinkingOptions } from '@react-navigation/native/src/types';
|
|
2
3
|
import * as React from 'react';
|
|
3
|
-
import type { LinkingOptions } from './types';
|
|
4
4
|
export declare const LinkingContext: React.Context<{
|
|
5
|
-
options
|
|
5
|
+
options?: LinkingOptions<ParamListBase> | undefined;
|
|
6
6
|
}>;
|
|
7
7
|
//# sourceMappingURL=LinkingContext.d.ts.map
|
|
@@ -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,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,eAAO,MAAM,cAAc;;EAMzB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NavigationContainerProps, NavigationContainerRef } from '@react-navigation/core';
|
|
1
|
+
import { type NavigationContainerProps, type NavigationContainerRef } from '@react-navigation/core';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import type { DocumentTitleOptions, LinkingOptions, LocaleDirection, Theme } from './types';
|
|
4
4
|
declare global {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationContainer.d.ts","sourceRoot":"","sources":["../../../src/NavigationContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,wBAAwB,
|
|
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;AAQ/B,OAAO,KAAK,EACV,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,KAAK,EACN,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,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,OAAO,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;IACpC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,aAAa,CAAC,EAAE,oBAAoB,CAAC;CACtC,CAAC;AA+IF,eAAO,MAAM,mBAAmB;;;;eAjJnB,MAAM,SAAS;;;;MAuJvB,MAAM,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServerContainer.d.ts","sourceRoot":"","sources":["../../../src/ServerContainer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAiB,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"ServerContainer.d.ts","sourceRoot":"","sources":["../../../src/ServerContainer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAiB,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAMlD;;;;;;GAMG;AACH,eAAO,MAAM,eAAe;cAVhB,MAAM,SAAS;4CAgDzB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare const UnhandledLinkingContext: React.Context<{
|
|
3
|
+
lastUnhandledLink: string | undefined;
|
|
4
|
+
setLastUnhandledLink: (lastUnhandledUrl: string | undefined) => void;
|
|
5
|
+
}>;
|
|
6
|
+
//# sourceMappingURL=UnhandledLinkingContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnhandledLinkingContext.d.ts","sourceRoot":"","sources":["../../../src/UnhandledLinkingContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,eAAO,MAAM,uBAAuB;uBACf,MAAM,GAAG,SAAS;6CACI,MAAM,GAAG,SAAS,KAAK,IAAI;EAQpE,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
export declare const createStackNavigator: {
|
|
2
3
|
<ParamList extends import("@react-navigation/core").ParamListBase>(): import("@react-navigation/core").TypedNavigator<ParamList, Readonly<{
|
|
3
4
|
key: string;
|
|
@@ -15,8 +16,8 @@ export declare const createStackNavigator: {
|
|
|
15
16
|
})[];
|
|
16
17
|
type: string;
|
|
17
18
|
stale: false;
|
|
18
|
-
}>, {}, import("@react-navigation/core").EventMapBase, (props: any) => JSX.Element>;
|
|
19
|
-
<ParamList_1 extends import("@react-navigation/core").ParamListBase, Config extends import("
|
|
19
|
+
}>, {}, import("@react-navigation/core").EventMapBase, (props: any) => React.JSX.Element>;
|
|
20
|
+
<ParamList_1 extends import("@react-navigation/core").ParamListBase, Config extends import("@react-navigation/core/lib/typescript/src/StaticNavigation").StaticConfig<ParamList_1, Readonly<{
|
|
20
21
|
key: string;
|
|
21
22
|
index: number;
|
|
22
23
|
routeNames: string[];
|
|
@@ -32,7 +33,7 @@ export declare const createStackNavigator: {
|
|
|
32
33
|
})[];
|
|
33
34
|
type: string;
|
|
34
35
|
stale: false;
|
|
35
|
-
}>, {}, import("@react-navigation/core").EventMapBase, (props: any) => JSX.Element>>(config: Config): import("@react-navigation/core").TypedNavigator<ParamList_1, Readonly<{
|
|
36
|
+
}>, {}, import("@react-navigation/core").EventMapBase, (props: any) => React.JSX.Element>>(config: Config): import("@react-navigation/core").TypedNavigator<ParamList_1, Readonly<{
|
|
36
37
|
key: string;
|
|
37
38
|
index: number;
|
|
38
39
|
routeNames: string[];
|
|
@@ -48,7 +49,7 @@ export declare const createStackNavigator: {
|
|
|
48
49
|
})[];
|
|
49
50
|
type: string;
|
|
50
51
|
stale: false;
|
|
51
|
-
}>, {}, import("@react-navigation/core").EventMapBase, (props: any) => JSX.Element> & {
|
|
52
|
+
}>, {}, import("@react-navigation/core").EventMapBase, (props: any) => React.JSX.Element> & {
|
|
52
53
|
config: Config;
|
|
53
54
|
};
|
|
54
55
|
};
|
|
@@ -0,0 +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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAW/B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../../../../src/
|
|
1
|
+
{"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../../../../src/__stubs__/window.tsx"],"names":[],"mappings":"AAiEA,eAAO,MAAM,MAAM;;;;;;;yBApDA,GAAG,KAAK,MAAM,QAAQ,MAAM;4BASzB,GAAG,KAAK,MAAM,QAAQ,MAAM;cAO1C,MAAM;;;;6BAwBkB,UAAU,YAAY,MAAM,IAAI;gCAM7B,UAAU,YAAY,MAAM,IAAI;;CAiBlE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ParamListBase, StaticNavigation } from '@react-navigation/core';
|
|
1
|
+
import { type ParamListBase, type StaticNavigation } from '@react-navigation/core';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { NavigationContainer } from './NavigationContainer';
|
|
4
4
|
import type { LinkingOptions } from './types';
|
|
@@ -15,6 +15,6 @@ type Props = Omit<React.ComponentProps<typeof NavigationContainer>, 'linking' |
|
|
|
15
15
|
* @param tree Static navigation config.
|
|
16
16
|
* @returns Navigation component to use in your app.
|
|
17
17
|
*/
|
|
18
|
-
export declare function createStaticNavigation(tree: StaticNavigation<any, any, any>): ({ linking, ...rest }: Props) => JSX.Element;
|
|
18
|
+
export declare function createStaticNavigation(tree: StaticNavigation<any, any, any>): ({ linking, ...rest }: Props) => React.JSX.Element;
|
|
19
19
|
export {};
|
|
20
20
|
//# sourceMappingURL=createStaticNavigation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createStaticNavigation.d.ts","sourceRoot":"","sources":["../../../src/createStaticNavigation.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,aAAa,
|
|
1
|
+
{"version":3,"file":"createStaticNavigation.d.ts","sourceRoot":"","sources":["../../../src/createStaticNavigation.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,KAAK,KAAK,GAAG,IAAI,CACf,KAAK,CAAC,cAAc,CAAC,OAAO,mBAAmB,CAAC,EAChD,SAAS,GAAG,UAAU,CACvB,GAAG;IACF;;OAEG;IACH,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,EAAE,QAAQ,CAAC,CAAC;CACzD,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,0BAQzB,KAAK,uBAUvD"}
|
|
@@ -12,5 +12,6 @@ export { useLinkProps } from './useLinkProps';
|
|
|
12
12
|
export { useLinkTools } from './useLinkTools';
|
|
13
13
|
export { useLocale } from './useLocale';
|
|
14
14
|
export { useScrollToTop } from './useScrollToTop';
|
|
15
|
+
export { useUnhandledLinking } from './useUnhandledLinking';
|
|
15
16
|
export * from '@react-navigation/core';
|
|
16
17
|
//# 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,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,cAAc,wBAAwB,CAAC"}
|
|
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,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,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,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,cAAc,wBAAwB,CAAC"}
|
|
@@ -4,6 +4,6 @@ type Props = {
|
|
|
4
4
|
value: Theme;
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
};
|
|
7
|
-
export declare function ThemeProvider({ value, children }: Props): JSX.Element;
|
|
7
|
+
export declare function ThemeProvider({ value, children }: Props): React.JSX.Element;
|
|
8
8
|
export {};
|
|
9
9
|
//# sourceMappingURL=ThemeProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../../src/theming/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAGtC,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../../src/theming/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAGtC,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,KAAK,qBAIvD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import type { NavigationContainerRef, ParamListBase } from '@react-navigation/core';
|
|
2
|
-
|
|
3
|
-
export declare function useBackButton(ref: React.RefObject<NavigationContainerRef<ParamListBase>>): void;
|
|
3
|
+
export declare function useBackButton(_: React.RefObject<NavigationContainerRef<ParamListBase>>): void;
|
|
4
4
|
//# sourceMappingURL=useBackButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBackButton.d.ts","sourceRoot":"","sources":["../../../src/useBackButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,aAAa,EACd,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"useBackButton.d.ts","sourceRoot":"","sources":["../../../src/useBackButton.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,aAAa,EACd,MAAM,wBAAwB,CAAC;AAEhC,wBAAgB,aAAa,CAC3B,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC,QAI1D"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NavigationContainerRef, ParamListBase } from '@react-navigation/core';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
export declare function useBackButton(ref: React.RefObject<NavigationContainerRef<ParamListBase>>): void;
|
|
4
|
+
//# sourceMappingURL=useBackButton.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBackButton.native.d.ts","sourceRoot":"","sources":["../../../src/useBackButton.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,aAAa,EACd,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,wBAAgB,aAAa,CAC3B,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC,QAwB5D"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { NavigationAction } from '@react-navigation/core';
|
|
1
|
+
import { type NavigationAction } from '@react-navigation/core';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { GestureResponderEvent } from 'react-native';
|
|
3
|
+
import { type GestureResponderEvent } from 'react-native';
|
|
4
4
|
export type Props<ParamList extends ReactNavigation.RootParamList, RouteName extends keyof ParamList = keyof ParamList> = ({
|
|
5
5
|
screen: Extract<RouteName, string>;
|
|
6
6
|
href?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLinkProps.d.ts","sourceRoot":"","sources":["../../../src/useLinkProps.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,gBAAgB,
|
|
1
|
+
{"version":3,"file":"useLinkProps.d.ts","sourceRoot":"","sources":["../../../src/useLinkProps.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,gBAAgB,EAKtB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,qBAAqB,EAAY,MAAM,cAAc,CAAC;AAIpE,MAAM,MAAM,KAAK,CACf,SAAS,SAAS,eAAe,CAAC,aAAa,EAC/C,SAAS,SAAS,MAAM,SAAS,GAAG,MAAM,SAAS,IAEjD,CAAC;IACC,MAAM,EAAE,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,gBAAgB,CAAC;CAC3B,GAAG,CAAC,SAAS,SAAS,SAAS,CAAC,SAAS,CAAC,GACvC;IAAE,MAAM,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CAAE,GACjC;IAAE,MAAM,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CAAE,CAAC,CAAC,GACtC;IACE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,gBAAgB,CAAC;IACzB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB,CAAC;AA+BN;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,SAAS,SAAS,eAAe,CAAC,aAAa,EAAE,EAC5E,MAAM,EACN,MAAM,EACN,IAAI,EACJ,MAAM,GACP,EAAE,KAAK,CAAC,SAAS,CAAC;;;kBAMX,gBAAgB,CAAC,iBAAiB,EAAE,UAAU,CAAC,GAAG,qBAAqB;EA8D9E"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NavigationContainerRef, ParamListBase } from '@react-navigation/core';
|
|
1
|
+
import { type NavigationContainerRef, type ParamListBase } from '@react-navigation/core';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import type { LinkingOptions } from './types';
|
|
4
4
|
/**
|
|
@@ -6,7 +6,7 @@ import type { LinkingOptions } from './types';
|
|
|
6
6
|
*/
|
|
7
7
|
export declare const series: (cb: () => Promise<void>) => () => void;
|
|
8
8
|
type Options = LinkingOptions<ParamListBase>;
|
|
9
|
-
export declare function useLinking(ref: React.RefObject<NavigationContainerRef<ParamListBase>>, { enabled, config, getStateFromPath, getPathFromState, getActionFromState, }: Options): {
|
|
9
|
+
export declare function useLinking(ref: React.RefObject<NavigationContainerRef<ParamListBase>>, { enabled, config, getStateFromPath, getPathFromState, getActionFromState, }: Options, onUnhandledLinking: (lastUnhandledLining: string | undefined) => void): {
|
|
10
10
|
getInitialState: () => PromiseLike<(Partial<Omit<Readonly<{
|
|
11
11
|
key: string;
|
|
12
12
|
index: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLinking.d.ts","sourceRoot":"","sources":["../../../src/useLinking.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,sBAAsB,
|
|
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"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { NavigationContainerRef, ParamListBase } from '@react-navigation/core';
|
|
1
|
+
import { type NavigationContainerRef, type ParamListBase } from '@react-navigation/core';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import type { LinkingOptions } from './types';
|
|
4
4
|
type Options = LinkingOptions<ParamListBase>;
|
|
5
|
-
export declare function useLinking(ref: React.RefObject<NavigationContainerRef<ParamListBase>>, { enabled, prefixes, filter, config, getInitialURL, subscribe, getStateFromPath, getActionFromState, }: Options): {
|
|
5
|
+
export declare function useLinking(ref: React.RefObject<NavigationContainerRef<ParamListBase>>, { enabled, prefixes, filter, config, getInitialURL, subscribe, getStateFromPath, getActionFromState, }: Options, onUnhandledLinking: (lastUnhandledLining: string | undefined) => void): {
|
|
6
6
|
getInitialState: () => PromiseLike<(Partial<Omit<Readonly<{
|
|
7
7
|
key: string;
|
|
8
8
|
index: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLinking.native.d.ts","sourceRoot":"","sources":["../../../src/useLinking.native.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,sBAAsB,
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useThenable.d.ts","sourceRoot":"","sources":["../../../src/useThenable.tsx"],"names":[],"mappings":"AAEA,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"useThenable.d.ts","sourceRoot":"","sources":["../../../src/useThenable.tsx"],"names":[],"mappings":"AAEA,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC,CAAC,CAAC,4BAuC1D"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type NavigationState, type PartialState } from '@react-navigation/core';
|
|
2
|
+
export declare function useUnhandledLinking(): {
|
|
3
|
+
lastUnhandledLink: string | undefined;
|
|
4
|
+
getStateForRouteNamesChange: (currentState: NavigationState) => PartialState<NavigationState> | undefined;
|
|
5
|
+
clearUnhandledLink: () => void;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=useUnhandledLinking.d.ts.map
|
|
@@ -0,0 +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;AA0BhC,wBAAgB,mBAAmB;;gDAUjB,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.5",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
7
7
|
"react-navigation",
|
|
@@ -37,26 +37,26 @@
|
|
|
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.5",
|
|
41
41
|
"escape-string-regexp": "^4.0.0",
|
|
42
42
|
"fast-deep-equal": "^3.1.3",
|
|
43
|
-
"nanoid": "
|
|
43
|
+
"nanoid": "3.3.6",
|
|
44
|
+
"use-latest-callback": "^0.1.9"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
|
-
"@testing-library/react-native": "^
|
|
47
|
-
"@types/react": "~18.
|
|
47
|
+
"@testing-library/react-native": "^12.3.1",
|
|
48
|
+
"@types/react": "~18.2.33",
|
|
48
49
|
"@types/react-dom": "~18.0.10",
|
|
49
|
-
"
|
|
50
|
-
"del-cli": "^5.0.0",
|
|
50
|
+
"del-cli": "^5.1.0",
|
|
51
51
|
"react": "18.2.0",
|
|
52
52
|
"react-dom": "18.2.0",
|
|
53
|
-
"react-native": "0.
|
|
54
|
-
"react-native-builder-bob": "^0.
|
|
55
|
-
"typescript": "^
|
|
53
|
+
"react-native": "0.72.6",
|
|
54
|
+
"react-native-builder-bob": "^0.23.1",
|
|
55
|
+
"typescript": "^5.2.2"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"react": "*",
|
|
59
|
-
"react-native": "
|
|
59
|
+
"react-native": "0.72.6"
|
|
60
60
|
},
|
|
61
61
|
"react-native-builder-bob": {
|
|
62
62
|
"source": "src",
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
]
|
|
73
73
|
]
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "858a8746a5c007a623206c920f70d55935ed39b4"
|
|
76
76
|
}
|
package/src/Link.tsx
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
type GestureResponderEvent,
|
|
4
|
+
Platform,
|
|
5
|
+
Text,
|
|
6
|
+
type TextProps,
|
|
7
|
+
} from 'react-native';
|
|
3
8
|
|
|
4
|
-
import {
|
|
9
|
+
import { useTheme } from './theming/useTheme';
|
|
10
|
+
import { type Props as LinkProps, useLinkProps } from './useLinkProps';
|
|
5
11
|
|
|
6
12
|
type Props<ParamList extends ReactNavigation.RootParamList> =
|
|
7
13
|
LinkProps<ParamList> &
|
|
@@ -31,8 +37,10 @@ export function Link<ParamList extends ReactNavigation.RootParamList>({
|
|
|
31
37
|
params,
|
|
32
38
|
action,
|
|
33
39
|
href,
|
|
40
|
+
style,
|
|
34
41
|
...rest
|
|
35
42
|
}: Props<ParamList>) {
|
|
43
|
+
const { colors, fonts } = useTheme();
|
|
36
44
|
// @ts-expect-error: This is already type-checked by the prop types
|
|
37
45
|
const props = useLinkProps<ParamList>({ screen, params, action, href });
|
|
38
46
|
|
|
@@ -56,5 +64,6 @@ export function Link<ParamList extends ReactNavigation.RootParamList>({
|
|
|
56
64
|
web: { onClick: onPress } as any,
|
|
57
65
|
default: { onPress },
|
|
58
66
|
}),
|
|
67
|
+
style: [{ color: colors.primary }, fonts.regular, style],
|
|
59
68
|
});
|
|
60
69
|
}
|
package/src/LinkingContext.tsx
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import type { ParamListBase } from '@react-navigation/core';
|
|
2
|
+
import type { LinkingOptions } from '@react-navigation/native/src/types';
|
|
2
3
|
import * as React from 'react';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
const MISSING_CONTEXT_ERROR = "Couldn't find a LinkingContext context.";
|
|
5
6
|
|
|
6
7
|
export const LinkingContext = React.createContext<{
|
|
7
|
-
options
|
|
8
|
-
}>({
|
|
8
|
+
options?: LinkingOptions<ParamListBase>;
|
|
9
|
+
}>({
|
|
10
|
+
get options(): any {
|
|
11
|
+
throw new Error(MISSING_CONTEXT_ERROR);
|
|
12
|
+
},
|
|
13
|
+
});
|
|
9
14
|
|
|
10
15
|
LinkingContext.displayName = 'LinkingContext';
|
|
@@ -3,13 +3,15 @@ import {
|
|
|
3
3
|
getActionFromState,
|
|
4
4
|
getPathFromState,
|
|
5
5
|
getStateFromPath,
|
|
6
|
-
NavigationContainerProps,
|
|
7
|
-
NavigationContainerRef,
|
|
8
|
-
|
|
6
|
+
type NavigationContainerProps,
|
|
7
|
+
type NavigationContainerRef,
|
|
8
|
+
type NavigationState,
|
|
9
|
+
type ParamListBase,
|
|
9
10
|
validatePathConfig,
|
|
10
11
|
} from '@react-navigation/core';
|
|
11
12
|
import * as React from 'react';
|
|
12
13
|
import { I18nManager } from 'react-native';
|
|
14
|
+
import useLatestCallback from 'use-latest-callback';
|
|
13
15
|
|
|
14
16
|
import { LinkingContext } from './LinkingContext';
|
|
15
17
|
import { LocaleDirContext } from './LocaleDirContext';
|
|
@@ -21,12 +23,14 @@ import type {
|
|
|
21
23
|
LocaleDirection,
|
|
22
24
|
Theme,
|
|
23
25
|
} from './types';
|
|
26
|
+
import { UnhandledLinkingContext } from './UnhandledLinkingContext';
|
|
24
27
|
import { useBackButton } from './useBackButton';
|
|
25
28
|
import { useDocumentTitle } from './useDocumentTitle';
|
|
26
29
|
import { useLinking } from './useLinking';
|
|
27
30
|
import { useThenable } from './useThenable';
|
|
28
31
|
|
|
29
32
|
declare global {
|
|
33
|
+
// eslint-disable-next-line no-var
|
|
30
34
|
var REACT_NAVIGATION_DEVTOOLS: WeakMap<
|
|
31
35
|
NavigationContainerRef<any>,
|
|
32
36
|
{ readonly linking: LinkingOptions<any> }
|
|
@@ -66,6 +70,8 @@ function NavigationContainerInner(
|
|
|
66
70
|
linking,
|
|
67
71
|
fallback = null,
|
|
68
72
|
documentTitle,
|
|
73
|
+
onReady,
|
|
74
|
+
onStateChange,
|
|
69
75
|
...rest
|
|
70
76
|
}: Props<ParamListBase>,
|
|
71
77
|
ref?: React.Ref<NavigationContainerRef<ParamListBase> | null>
|
|
@@ -82,12 +88,52 @@ function NavigationContainerInner(
|
|
|
82
88
|
useBackButton(refContainer);
|
|
83
89
|
useDocumentTitle(refContainer, documentTitle);
|
|
84
90
|
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
91
|
+
const [lastUnhandledLink, setLastUnhandledLink] = React.useState<
|
|
92
|
+
string | undefined
|
|
93
|
+
>();
|
|
94
|
+
|
|
95
|
+
const { getInitialState } = useLinking(
|
|
96
|
+
refContainer,
|
|
97
|
+
{
|
|
98
|
+
enabled: isLinkingEnabled,
|
|
99
|
+
prefixes: [],
|
|
100
|
+
...linking,
|
|
101
|
+
},
|
|
102
|
+
setLastUnhandledLink
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
const linkingContext = React.useMemo(() => ({ options: linking }), [linking]);
|
|
106
|
+
|
|
107
|
+
const unhandledLinkingContext = React.useMemo(
|
|
108
|
+
() => ({ lastUnhandledLink, setLastUnhandledLink }),
|
|
109
|
+
[lastUnhandledLink, setLastUnhandledLink]
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
const onReadyForLinkingHandling = useLatestCallback(() => {
|
|
113
|
+
// If the screen path matches lastUnhandledLink, we do not track it
|
|
114
|
+
const path = refContainer.current?.getCurrentRoute()?.path;
|
|
115
|
+
setLastUnhandledLink((previousLastUnhandledLink) => {
|
|
116
|
+
if (previousLastUnhandledLink === path) {
|
|
117
|
+
return undefined;
|
|
118
|
+
}
|
|
119
|
+
return previousLastUnhandledLink;
|
|
120
|
+
});
|
|
121
|
+
onReady?.();
|
|
89
122
|
});
|
|
90
123
|
|
|
124
|
+
const onStateChangeForLinkingHandling = useLatestCallback(
|
|
125
|
+
(state: Readonly<NavigationState> | undefined) => {
|
|
126
|
+
// If the screen path matches lastUnhandledLink, we do not track it
|
|
127
|
+
const path = refContainer.current?.getCurrentRoute()?.path;
|
|
128
|
+
setLastUnhandledLink((previousLastUnhandledLink) => {
|
|
129
|
+
if (previousLastUnhandledLink === path) {
|
|
130
|
+
return undefined;
|
|
131
|
+
}
|
|
132
|
+
return previousLastUnhandledLink;
|
|
133
|
+
});
|
|
134
|
+
onStateChange?.(state);
|
|
135
|
+
}
|
|
136
|
+
);
|
|
91
137
|
// Add additional linking related info to the ref
|
|
92
138
|
// This will be used by the devtools
|
|
93
139
|
React.useEffect(() => {
|
|
@@ -112,8 +158,6 @@ function NavigationContainerInner(
|
|
|
112
158
|
|
|
113
159
|
React.useImperativeHandle(ref, () => refContainer.current);
|
|
114
160
|
|
|
115
|
-
const linkingContext = React.useMemo(() => ({ options: linking }), [linking]);
|
|
116
|
-
|
|
117
161
|
const isLinkingReady =
|
|
118
162
|
rest.initialState != null || !isLinkingEnabled || isResolved;
|
|
119
163
|
|
|
@@ -125,17 +169,21 @@ function NavigationContainerInner(
|
|
|
125
169
|
|
|
126
170
|
return (
|
|
127
171
|
<LocaleDirContext.Provider value={direction}>
|
|
128
|
-
<
|
|
129
|
-
<
|
|
130
|
-
<
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
172
|
+
<UnhandledLinkingContext.Provider value={unhandledLinkingContext}>
|
|
173
|
+
<LinkingContext.Provider value={linkingContext}>
|
|
174
|
+
<ThemeProvider value={theme}>
|
|
175
|
+
<BaseNavigationContainer
|
|
176
|
+
{...rest}
|
|
177
|
+
onReady={onReadyForLinkingHandling}
|
|
178
|
+
onStateChange={onStateChangeForLinkingHandling}
|
|
179
|
+
initialState={
|
|
180
|
+
rest.initialState == null ? initialState : rest.initialState
|
|
181
|
+
}
|
|
182
|
+
ref={refContainer}
|
|
183
|
+
/>
|
|
184
|
+
</ThemeProvider>
|
|
185
|
+
</LinkingContext.Provider>
|
|
186
|
+
</UnhandledLinkingContext.Provider>
|
|
139
187
|
</LocaleDirContext.Provider>
|
|
140
188
|
);
|
|
141
189
|
}
|
package/src/ServerContainer.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CurrentRenderContext } from '@react-navigation/core';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
|
-
import { ServerContext, ServerContextType } from './ServerContext';
|
|
4
|
+
import { ServerContext, type ServerContextType } from './ServerContext';
|
|
5
5
|
import type { ServerContainerRef } from './types';
|
|
6
6
|
|
|
7
7
|
type Props = ServerContextType & {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
const MISSING_CONTEXT_ERROR =
|
|
4
|
+
"Couldn't find an UnhandledLinkingContext context.";
|
|
5
|
+
|
|
6
|
+
export const UnhandledLinkingContext = React.createContext<{
|
|
7
|
+
lastUnhandledLink: string | undefined;
|
|
8
|
+
setLastUnhandledLink: (lastUnhandledUrl: string | undefined) => void;
|
|
9
|
+
}>({
|
|
10
|
+
get lastUnhandledLink(): any {
|
|
11
|
+
throw new Error(MISSING_CONTEXT_ERROR);
|
|
12
|
+
},
|
|
13
|
+
get setLastUnhandledLink(): any {
|
|
14
|
+
throw new Error(MISSING_CONTEXT_ERROR);
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
UnhandledLinkingContext.displayName = 'UnhandledLinkingContext';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
let location = new URL('', 'http://example.com');
|
|
2
2
|
|
|
3
3
|
let listeners: (() => void)[] = [];
|
|
4
4
|
let entries = [{ state: null, href: location.href }];
|
|
@@ -12,7 +12,7 @@ const history = {
|
|
|
12
12
|
},
|
|
13
13
|
|
|
14
14
|
pushState(state: any, _: string, path: string) {
|
|
15
|
-
|
|
15
|
+
location = new URL(path, location.origin);
|
|
16
16
|
|
|
17
17
|
currentState = state;
|
|
18
18
|
entries = entries.slice(0, index + 1);
|
|
@@ -21,7 +21,7 @@ const history = {
|
|
|
21
21
|
},
|
|
22
22
|
|
|
23
23
|
replaceState(state: any, _: string, path: string) {
|
|
24
|
-
|
|
24
|
+
location = new URL(path, location.origin);
|
|
25
25
|
|
|
26
26
|
currentState = state;
|
|
27
27
|
entries[index] = { state, href: location.href };
|
|
@@ -35,7 +35,7 @@ const history = {
|
|
|
35
35
|
) {
|
|
36
36
|
index += n;
|
|
37
37
|
const entry = entries[index];
|
|
38
|
-
|
|
38
|
+
location = new URL(entry.href);
|
|
39
39
|
currentState = entry.state;
|
|
40
40
|
listeners.forEach((cb) => cb());
|
|
41
41
|
}
|
|
@@ -65,7 +65,9 @@ const removeEventListener = (type: 'popstate', listener: () => void) => {
|
|
|
65
65
|
|
|
66
66
|
export const window = {
|
|
67
67
|
document: { title: '' },
|
|
68
|
-
location
|
|
68
|
+
get location() {
|
|
69
|
+
return location;
|
|
70
|
+
},
|
|
69
71
|
history,
|
|
70
72
|
addEventListener,
|
|
71
73
|
removeEventListener,
|
package/src/index.tsx
CHANGED
|
@@ -12,4 +12,5 @@ export { useLinkProps } from './useLinkProps';
|
|
|
12
12
|
export { useLinkTools } from './useLinkTools';
|
|
13
13
|
export { useLocale } from './useLocale';
|
|
14
14
|
export { useScrollToTop } from './useScrollToTop';
|
|
15
|
+
export { useUnhandledLinking } from './useUnhandledLinking';
|
|
15
16
|
export * from '@react-navigation/core';
|