@react-navigation/native 7.0.0-alpha.0 → 7.0.0-alpha.1
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 +3 -4
- package/lib/commonjs/Link.js.map +1 -1
- package/lib/commonjs/LinkingContext.js +2 -3
- package/lib/commonjs/LinkingContext.js.map +1 -1
- package/lib/commonjs/NavigationContainer.js +16 -18
- package/lib/commonjs/NavigationContainer.js.map +1 -1
- package/lib/commonjs/ServerContainer.js +5 -6
- package/lib/commonjs/ServerContainer.js.map +1 -1
- package/lib/commonjs/ServerContext.js +2 -3
- package/lib/commonjs/ServerContext.js.map +1 -1
- package/lib/commonjs/createMemoryHistory.js +1 -1
- package/lib/commonjs/createMemoryHistory.js.map +1 -1
- package/lib/commonjs/createStaticNavigation.js +3 -4
- package/lib/commonjs/createStaticNavigation.js.map +1 -1
- package/lib/commonjs/extractPathFromURL.js +1 -1
- package/lib/commonjs/extractPathFromURL.js.map +1 -1
- package/lib/commonjs/index.js +24 -25
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/theming/DarkTheme.js +5 -4
- package/lib/commonjs/theming/DarkTheme.js.map +1 -1
- package/lib/commonjs/theming/DefaultTheme.js +5 -4
- package/lib/commonjs/theming/DefaultTheme.js.map +1 -1
- package/lib/commonjs/theming/ThemeContext.js +4 -6
- package/lib/commonjs/theming/ThemeContext.js.map +1 -1
- package/lib/commonjs/theming/ThemeProvider.js +3 -4
- package/lib/commonjs/theming/ThemeProvider.js.map +1 -1
- package/lib/commonjs/theming/fonts.js +66 -0
- package/lib/commonjs/theming/fonts.js.map +1 -0
- package/lib/commonjs/theming/useTheme.js +3 -4
- package/lib/commonjs/theming/useTheme.js.map +1 -1
- package/lib/commonjs/useBackButton.js +1 -1
- package/lib/commonjs/useBackButton.js.map +1 -1
- package/lib/commonjs/useDocumentTitle.js +1 -1
- package/lib/commonjs/useDocumentTitle.js.map +1 -1
- package/lib/commonjs/useDocumentTitle.native.js +1 -1
- package/lib/commonjs/useDocumentTitle.native.js.map +1 -1
- package/lib/commonjs/useLinkProps.js +3 -4
- package/lib/commonjs/useLinkProps.js.map +1 -1
- package/lib/commonjs/useLinkTools.js +3 -4
- package/lib/commonjs/useLinkTools.js.map +1 -1
- package/lib/commonjs/useLinking.js +5 -5
- package/lib/commonjs/useLinking.js.map +1 -1
- package/lib/commonjs/useLinking.native.js +3 -4
- package/lib/commonjs/useLinking.native.js.map +1 -1
- package/lib/commonjs/useScrollToTop.js +1 -1
- package/lib/commonjs/useScrollToTop.js.map +1 -1
- package/lib/commonjs/useThenable.js +1 -1
- package/lib/commonjs/useThenable.js.map +1 -1
- package/lib/module/Link.js +2 -2
- package/lib/module/Link.js.map +1 -1
- package/lib/module/LinkingContext.js +1 -2
- package/lib/module/LinkingContext.js.map +1 -1
- package/lib/module/NavigationContainer.js +8 -9
- package/lib/module/NavigationContainer.js.map +1 -1
- package/lib/module/ServerContainer.js +2 -2
- package/lib/module/ServerContainer.js.map +1 -1
- package/lib/module/ServerContext.js +1 -2
- package/lib/module/ServerContext.js.map +1 -1
- package/lib/module/createMemoryHistory.js +1 -1
- package/lib/module/createMemoryHistory.js.map +1 -1
- package/lib/module/createStaticNavigation.js +2 -2
- package/lib/module/createStaticNavigation.js.map +1 -1
- package/lib/module/extractPathFromURL.js +1 -1
- package/lib/module/extractPathFromURL.js.map +1 -1
- package/lib/module/index.js +12 -12
- package/lib/module/index.js.map +1 -1
- package/lib/module/theming/DarkTheme.js +4 -3
- package/lib/module/theming/DarkTheme.js.map +1 -1
- package/lib/module/theming/DefaultTheme.js +4 -3
- package/lib/module/theming/DefaultTheme.js.map +1 -1
- package/lib/module/theming/ThemeContext.js +2 -3
- package/lib/module/theming/ThemeContext.js.map +1 -1
- package/lib/module/theming/ThemeProvider.js +2 -2
- package/lib/module/theming/ThemeProvider.js.map +1 -1
- package/lib/module/theming/fonts.js +59 -0
- package/lib/module/theming/fonts.js.map +1 -0
- package/lib/module/theming/useTheme.js +2 -2
- package/lib/module/theming/useTheme.js.map +1 -1
- package/lib/module/useBackButton.js +1 -1
- package/lib/module/useBackButton.js.map +1 -1
- package/lib/module/useDocumentTitle.js +1 -1
- package/lib/module/useDocumentTitle.js.map +1 -1
- package/lib/module/useDocumentTitle.native.js +1 -1
- package/lib/module/useDocumentTitle.native.js.map +1 -1
- package/lib/module/useLinkProps.js +2 -2
- package/lib/module/useLinkProps.js.map +1 -1
- package/lib/module/useLinkTools.js +2 -2
- package/lib/module/useLinkTools.js.map +1 -1
- package/lib/module/useLinking.js +3 -3
- package/lib/module/useLinking.js.map +1 -1
- package/lib/module/useLinking.native.js +2 -2
- package/lib/module/useLinking.native.js.map +1 -1
- package/lib/module/useScrollToTop.js +1 -1
- package/lib/module/useScrollToTop.js.map +1 -1
- package/lib/module/useThenable.js +1 -1
- package/lib/module/useThenable.js.map +1 -1
- package/lib/typescript/src/Link.d.ts +1 -1
- package/lib/typescript/src/Link.d.ts.map +1 -1
- package/lib/typescript/src/LinkingContext.d.ts +1 -2
- package/lib/typescript/src/LinkingContext.d.ts.map +1 -1
- package/lib/typescript/src/NavigationContainer.d.ts +2 -2
- package/lib/typescript/src/NavigationContainer.d.ts.map +1 -1
- package/lib/typescript/src/ServerContainer.d.ts +1 -2
- package/lib/typescript/src/ServerContainer.d.ts.map +1 -1
- package/lib/typescript/src/ServerContext.d.ts +1 -2
- package/lib/typescript/src/ServerContext.d.ts.map +1 -1
- package/lib/typescript/src/__mocks__/createStackNavigator.d.ts +1 -2
- package/lib/typescript/src/__mocks__/createStackNavigator.d.ts.map +1 -1
- package/lib/typescript/src/__mocks__/window.d.ts +1 -2
- package/lib/typescript/src/__mocks__/window.d.ts.map +1 -1
- package/lib/typescript/src/createMemoryHistory.d.ts +1 -1
- package/lib/typescript/src/createMemoryHistory.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/extractPathFromURL.d.ts +1 -1
- package/lib/typescript/src/extractPathFromURL.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +12 -12
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/theming/DarkTheme.d.ts +1 -2
- package/lib/typescript/src/theming/DarkTheme.d.ts.map +1 -1
- package/lib/typescript/src/theming/DefaultTheme.d.ts +1 -2
- package/lib/typescript/src/theming/DefaultTheme.d.ts.map +1 -1
- package/lib/typescript/src/theming/ThemeContext.d.ts +1 -2
- package/lib/typescript/src/theming/ThemeContext.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/theming/fonts.d.ts +53 -0
- package/lib/typescript/src/theming/fonts.d.ts.map +1 -0
- package/lib/typescript/src/theming/useTheme.d.ts +1 -1
- package/lib/typescript/src/theming/useTheme.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +11 -0
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/useBackButton.d.ts +1 -1
- package/lib/typescript/src/useBackButton.d.ts.map +1 -1
- package/lib/typescript/src/useDocumentTitle.d.ts +1 -1
- package/lib/typescript/src/useDocumentTitle.d.ts.map +1 -1
- package/lib/typescript/src/useDocumentTitle.native.d.ts +1 -1
- package/lib/typescript/src/useDocumentTitle.native.d.ts.map +1 -1
- package/lib/typescript/src/useLinkProps.d.ts +1 -1
- package/lib/typescript/src/useLinkProps.d.ts.map +1 -1
- package/lib/typescript/src/useLinkTools.d.ts +1 -1
- package/lib/typescript/src/useLinkTools.d.ts.map +1 -1
- package/lib/typescript/src/useLinking.d.ts +1 -1
- package/lib/typescript/src/useLinking.d.ts.map +1 -1
- package/lib/typescript/src/useLinking.native.d.ts +1 -1
- package/lib/typescript/src/useLinking.native.d.ts.map +1 -1
- package/lib/typescript/src/useScrollToTop.d.ts +1 -1
- package/lib/typescript/src/useScrollToTop.d.ts.map +1 -1
- package/lib/typescript/src/useThenable.d.ts +1 -1
- package/lib/typescript/src/useThenable.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/Link.tsx +2 -2
- package/src/LinkingContext.tsx +1 -3
- package/src/NavigationContainer.tsx +10 -12
- package/src/ServerContainer.tsx +2 -2
- package/src/ServerContext.tsx +1 -3
- package/src/__mocks__/createStackNavigator.tsx +1 -3
- package/src/__mocks__/window.tsx +1 -3
- package/src/createMemoryHistory.tsx +1 -1
- package/src/createStaticNavigation.tsx +2 -4
- package/src/extractPathFromURL.tsx +1 -1
- package/src/index.tsx +12 -12
- package/src/theming/DarkTheme.tsx +3 -3
- package/src/theming/DefaultTheme.tsx +3 -3
- package/src/theming/ThemeContext.tsx +2 -4
- package/src/theming/ThemeProvider.tsx +2 -2
- package/src/theming/fonts.tsx +63 -0
- package/src/theming/useTheme.tsx +2 -2
- package/src/types.tsx +22 -0
- package/src/useBackButton.tsx +1 -1
- package/src/useDocumentTitle.native.tsx +1 -1
- package/src/useDocumentTitle.tsx +1 -1
- package/src/useLinkProps.tsx +7 -4
- package/src/useLinkTools.tsx +2 -2
- package/src/useLinking.native.tsx +2 -2
- package/src/useLinking.tsx +3 -3
- package/src/useScrollToTop.tsx +1 -3
- package/src/useThenable.tsx +1 -1
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,
|
|
4
|
+
import { ServerContext, ServerContextType } from './ServerContext';
|
|
5
5
|
import type { ServerContainerRef } from './types';
|
|
6
6
|
|
|
7
7
|
type Props = ServerContextType & {
|
|
@@ -15,7 +15,7 @@ type Props = ServerContextType & {
|
|
|
15
15
|
* @param props.children Child elements to render the content.
|
|
16
16
|
* @param props.ref Ref object which contains helper methods.
|
|
17
17
|
*/
|
|
18
|
-
export
|
|
18
|
+
export const ServerContainer = React.forwardRef(function ServerContainer(
|
|
19
19
|
{ children, location }: Props,
|
|
20
20
|
ref: React.Ref<ServerContainerRef>
|
|
21
21
|
) {
|
package/src/ServerContext.tsx
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from '@react-navigation/core';
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
|
|
8
|
-
const createStackNavigator = createNavigatorFactory((props) => {
|
|
8
|
+
export const createStackNavigator = createNavigatorFactory((props) => {
|
|
9
9
|
const { state, descriptors, NavigationContent } = useNavigationBuilder(
|
|
10
10
|
StackRouter,
|
|
11
11
|
props
|
|
@@ -17,5 +17,3 @@ const createStackNavigator = createNavigatorFactory((props) => {
|
|
|
17
17
|
</NavigationContent>
|
|
18
18
|
);
|
|
19
19
|
});
|
|
20
|
-
|
|
21
|
-
export default createStackNavigator;
|
package/src/__mocks__/window.tsx
CHANGED
|
@@ -63,7 +63,7 @@ const removeEventListener = (type: 'popstate', listener: () => void) => {
|
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
const window = {
|
|
66
|
+
export const window = {
|
|
67
67
|
document: { title: '' },
|
|
68
68
|
location,
|
|
69
69
|
history,
|
|
@@ -73,5 +73,3 @@ const window = {
|
|
|
73
73
|
return window;
|
|
74
74
|
},
|
|
75
75
|
};
|
|
76
|
-
|
|
77
|
-
export default window;
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from '@react-navigation/core';
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
|
|
9
|
-
import NavigationContainer from './NavigationContainer';
|
|
9
|
+
import { NavigationContainer } from './NavigationContainer';
|
|
10
10
|
import type { LinkingOptions } from './types';
|
|
11
11
|
|
|
12
12
|
type Props = Omit<
|
|
@@ -26,9 +26,7 @@ type Props = Omit<
|
|
|
26
26
|
* @param tree Static navigation config.
|
|
27
27
|
* @returns Navigation component to use in your app.
|
|
28
28
|
*/
|
|
29
|
-
export
|
|
30
|
-
tree: StaticNavigation<any, any, any>
|
|
31
|
-
) {
|
|
29
|
+
export function createStaticNavigation(tree: StaticNavigation<any, any, any>) {
|
|
32
30
|
const Component = createComponentForStaticNavigation(tree, 'RootNavigator');
|
|
33
31
|
const linkingConfig = {
|
|
34
32
|
screens: tree.config.screens
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import escapeStringRegexp from 'escape-string-regexp';
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export function extractPathFromURL(prefixes: string[], url: string) {
|
|
4
4
|
for (const prefix of prefixes) {
|
|
5
5
|
const protocol = prefix.match(/^[^:]+:/)?.[0] ?? '';
|
|
6
6
|
const host = prefix
|
package/src/index.tsx
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
1
|
+
export { createStaticNavigation } from './createStaticNavigation';
|
|
2
|
+
export { Link } from './Link';
|
|
3
|
+
export { LinkingContext } from './LinkingContext';
|
|
4
|
+
export { NavigationContainer } from './NavigationContainer';
|
|
5
|
+
export { ServerContainer } from './ServerContainer';
|
|
6
|
+
export { DarkTheme } from './theming/DarkTheme';
|
|
7
|
+
export { DefaultTheme } from './theming/DefaultTheme';
|
|
8
|
+
export { ThemeProvider } from './theming/ThemeProvider';
|
|
9
|
+
export { useTheme } from './theming/useTheme';
|
|
10
10
|
export * from './types';
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
11
|
+
export { useLinkProps } from './useLinkProps';
|
|
12
|
+
export { useLinkTools } from './useLinkTools';
|
|
13
|
+
export { useScrollToTop } from './useScrollToTop';
|
|
14
14
|
export * from '@react-navigation/core';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Theme } from '../types';
|
|
2
|
+
import { fonts } from './fonts';
|
|
2
3
|
|
|
3
|
-
const DarkTheme: Theme = {
|
|
4
|
+
export const DarkTheme: Theme = {
|
|
4
5
|
dark: true,
|
|
5
6
|
colors: {
|
|
6
7
|
primary: 'rgb(10, 132, 255)',
|
|
@@ -10,6 +11,5 @@ const DarkTheme: Theme = {
|
|
|
10
11
|
border: 'rgb(39, 39, 41)',
|
|
11
12
|
notification: 'rgb(255, 69, 58)',
|
|
12
13
|
},
|
|
14
|
+
fonts,
|
|
13
15
|
};
|
|
14
|
-
|
|
15
|
-
export default DarkTheme;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Theme } from '../types';
|
|
2
|
+
import { fonts } from './fonts';
|
|
2
3
|
|
|
3
|
-
const DefaultTheme: Theme = {
|
|
4
|
+
export const DefaultTheme: Theme = {
|
|
4
5
|
dark: false,
|
|
5
6
|
colors: {
|
|
6
7
|
primary: 'rgb(0, 122, 255)',
|
|
@@ -10,6 +11,5 @@ const DefaultTheme: Theme = {
|
|
|
10
11
|
border: 'rgb(216, 216, 216)',
|
|
11
12
|
notification: 'rgb(255, 59, 48)',
|
|
12
13
|
},
|
|
14
|
+
fonts,
|
|
13
15
|
};
|
|
14
|
-
|
|
15
|
-
export default DefaultTheme;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
3
|
import type { Theme } from '../types';
|
|
4
|
-
import DefaultTheme from './DefaultTheme';
|
|
4
|
+
import { DefaultTheme } from './DefaultTheme';
|
|
5
5
|
|
|
6
|
-
const ThemeContext = React.createContext<Theme>(DefaultTheme);
|
|
6
|
+
export const ThemeContext = React.createContext<Theme>(DefaultTheme);
|
|
7
7
|
|
|
8
8
|
ThemeContext.displayName = 'ThemeContext';
|
|
9
|
-
|
|
10
|
-
export default ThemeContext;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
3
|
import type { Theme } from '../types';
|
|
4
|
-
import ThemeContext from './ThemeContext';
|
|
4
|
+
import { ThemeContext } from './ThemeContext';
|
|
5
5
|
|
|
6
6
|
type Props = {
|
|
7
7
|
value: Theme;
|
|
8
8
|
children: React.ReactNode;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
export
|
|
11
|
+
export function ThemeProvider({ value, children }: Props) {
|
|
12
12
|
return (
|
|
13
13
|
<ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>
|
|
14
14
|
);
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import type { Theme } from '../types';
|
|
4
|
+
|
|
5
|
+
const WEB_FONT_STACK =
|
|
6
|
+
'system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';
|
|
7
|
+
|
|
8
|
+
export const fonts = Platform.select({
|
|
9
|
+
web: {
|
|
10
|
+
regular: {
|
|
11
|
+
fontFamily: WEB_FONT_STACK,
|
|
12
|
+
fontWeight: '400',
|
|
13
|
+
},
|
|
14
|
+
medium: {
|
|
15
|
+
fontFamily: WEB_FONT_STACK,
|
|
16
|
+
fontWeight: '500',
|
|
17
|
+
},
|
|
18
|
+
bold: {
|
|
19
|
+
fontFamily: WEB_FONT_STACK,
|
|
20
|
+
fontWeight: '600',
|
|
21
|
+
},
|
|
22
|
+
heavy: {
|
|
23
|
+
fontFamily: WEB_FONT_STACK,
|
|
24
|
+
fontWeight: '700',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
ios: {
|
|
28
|
+
regular: {
|
|
29
|
+
fontFamily: 'System',
|
|
30
|
+
fontWeight: '400',
|
|
31
|
+
},
|
|
32
|
+
medium: {
|
|
33
|
+
fontFamily: 'System',
|
|
34
|
+
fontWeight: '500',
|
|
35
|
+
},
|
|
36
|
+
bold: {
|
|
37
|
+
fontFamily: 'System',
|
|
38
|
+
fontWeight: '600',
|
|
39
|
+
},
|
|
40
|
+
heavy: {
|
|
41
|
+
fontFamily: 'System',
|
|
42
|
+
fontWeight: '700',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
default: {
|
|
46
|
+
regular: {
|
|
47
|
+
fontFamily: 'sans-serif',
|
|
48
|
+
fontWeight: 'normal',
|
|
49
|
+
},
|
|
50
|
+
medium: {
|
|
51
|
+
fontFamily: 'sans-serif-medium',
|
|
52
|
+
fontWeight: 'normal',
|
|
53
|
+
},
|
|
54
|
+
bold: {
|
|
55
|
+
fontFamily: 'sans-serif',
|
|
56
|
+
fontWeight: '600',
|
|
57
|
+
},
|
|
58
|
+
heavy: {
|
|
59
|
+
fontFamily: 'sans-serif',
|
|
60
|
+
fontWeight: '700',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
} as const satisfies Record<string, Theme['fonts']>);
|
package/src/theming/useTheme.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
import ThemeContext from './ThemeContext';
|
|
3
|
+
import { ThemeContext } from './ThemeContext';
|
|
4
4
|
|
|
5
|
-
export
|
|
5
|
+
export function useTheme() {
|
|
6
6
|
const theme = React.useContext(ThemeContext);
|
|
7
7
|
|
|
8
8
|
return theme;
|
package/src/types.tsx
CHANGED
|
@@ -6,6 +6,22 @@ import type {
|
|
|
6
6
|
Route,
|
|
7
7
|
} from '@react-navigation/core';
|
|
8
8
|
|
|
9
|
+
type FontStyle = {
|
|
10
|
+
fontFamily: string;
|
|
11
|
+
fontWeight:
|
|
12
|
+
| 'normal'
|
|
13
|
+
| 'bold'
|
|
14
|
+
| '100'
|
|
15
|
+
| '200'
|
|
16
|
+
| '300'
|
|
17
|
+
| '400'
|
|
18
|
+
| '500'
|
|
19
|
+
| '600'
|
|
20
|
+
| '700'
|
|
21
|
+
| '800'
|
|
22
|
+
| '900';
|
|
23
|
+
};
|
|
24
|
+
|
|
9
25
|
export type Theme = {
|
|
10
26
|
dark: boolean;
|
|
11
27
|
colors: {
|
|
@@ -16,6 +32,12 @@ export type Theme = {
|
|
|
16
32
|
border: string;
|
|
17
33
|
notification: string;
|
|
18
34
|
};
|
|
35
|
+
fonts: {
|
|
36
|
+
regular: FontStyle;
|
|
37
|
+
medium: FontStyle;
|
|
38
|
+
bold: FontStyle;
|
|
39
|
+
heavy: FontStyle;
|
|
40
|
+
};
|
|
19
41
|
};
|
|
20
42
|
|
|
21
43
|
export type LinkingOptions<ParamList extends {}> = {
|
package/src/useBackButton.tsx
CHANGED
package/src/useDocumentTitle.tsx
CHANGED
|
@@ -9,7 +9,7 @@ import type { DocumentTitleOptions } from './types';
|
|
|
9
9
|
/**
|
|
10
10
|
* Set the document title for the active screen
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
12
|
+
export function useDocumentTitle(
|
|
13
13
|
ref: React.RefObject<NavigationContainerRef<ParamListBase>>,
|
|
14
14
|
{
|
|
15
15
|
enabled = true,
|
package/src/useLinkProps.tsx
CHANGED
|
@@ -10,7 +10,7 @@ import type { NavigationState, PartialState } from '@react-navigation/routers';
|
|
|
10
10
|
import * as React from 'react';
|
|
11
11
|
import { GestureResponderEvent, Platform } from 'react-native';
|
|
12
12
|
|
|
13
|
-
import LinkingContext from './LinkingContext';
|
|
13
|
+
import { LinkingContext } from './LinkingContext';
|
|
14
14
|
|
|
15
15
|
export type Props<
|
|
16
16
|
ParamList extends ReactNavigation.RootParamList,
|
|
@@ -67,9 +67,12 @@ const getStateFromParams = (
|
|
|
67
67
|
* @param props.href Optional absolute path to use for the href (e.g. `/feeds/hot`).
|
|
68
68
|
* @param props.action Optional action to use for in-page navigation. By default, the path is parsed to an action based on linking config.
|
|
69
69
|
*/
|
|
70
|
-
export
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
export function useLinkProps<ParamList extends ReactNavigation.RootParamList>({
|
|
71
|
+
screen,
|
|
72
|
+
params,
|
|
73
|
+
href,
|
|
74
|
+
action,
|
|
75
|
+
}: Props<ParamList>) {
|
|
73
76
|
const root = React.useContext(NavigationContainerRefContext);
|
|
74
77
|
const navigation = React.useContext(NavigationHelpersContext);
|
|
75
78
|
const { options } = React.useContext(LinkingContext);
|
package/src/useLinkTools.tsx
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from '@react-navigation/core';
|
|
11
11
|
import * as React from 'react';
|
|
12
12
|
|
|
13
|
-
import LinkingContext from './LinkingContext';
|
|
13
|
+
import { LinkingContext } from './LinkingContext';
|
|
14
14
|
|
|
15
15
|
type NavigationObject =
|
|
16
16
|
| NavigationHelpers<ParamListBase>
|
|
@@ -48,7 +48,7 @@ const getRootStateForNavigate = (
|
|
|
48
48
|
* Build destination link for a navigate action.
|
|
49
49
|
* Useful for showing anchor tags on the web for buttons that perform navigation.
|
|
50
50
|
*/
|
|
51
|
-
export
|
|
51
|
+
export function useLinkTools() {
|
|
52
52
|
const navigation = React.useContext(NavigationHelpersContext);
|
|
53
53
|
const linking = React.useContext(LinkingContext);
|
|
54
54
|
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
import * as React from 'react';
|
|
9
9
|
import { Linking, Platform } from 'react-native';
|
|
10
10
|
|
|
11
|
-
import extractPathFromURL from './extractPathFromURL';
|
|
11
|
+
import { extractPathFromURL } from './extractPathFromURL';
|
|
12
12
|
import type { LinkingOptions } from './types';
|
|
13
13
|
|
|
14
14
|
type ResultState = ReturnType<typeof getStateFromPathDefault>;
|
|
@@ -17,7 +17,7 @@ type Options = LinkingOptions<ParamListBase>;
|
|
|
17
17
|
|
|
18
18
|
let linkingHandlers: Symbol[] = [];
|
|
19
19
|
|
|
20
|
-
export
|
|
20
|
+
export function useLinking(
|
|
21
21
|
ref: React.RefObject<NavigationContainerRef<ParamListBase>>,
|
|
22
22
|
{
|
|
23
23
|
enabled = true,
|
package/src/useLinking.tsx
CHANGED
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
import isEqual from 'fast-deep-equal';
|
|
12
12
|
import * as React from 'react';
|
|
13
13
|
|
|
14
|
-
import createMemoryHistory from './createMemoryHistory';
|
|
15
|
-
import ServerContext from './ServerContext';
|
|
14
|
+
import { createMemoryHistory } from './createMemoryHistory';
|
|
15
|
+
import { ServerContext } from './ServerContext';
|
|
16
16
|
import type { LinkingOptions } from './types';
|
|
17
17
|
|
|
18
18
|
type ResultState = ReturnType<typeof getStateFromPathDefault>;
|
|
@@ -96,7 +96,7 @@ let linkingHandlers: Symbol[] = [];
|
|
|
96
96
|
|
|
97
97
|
type Options = LinkingOptions<ParamListBase>;
|
|
98
98
|
|
|
99
|
-
export
|
|
99
|
+
export function useLinking(
|
|
100
100
|
ref: React.RefObject<NavigationContainerRef<ParamListBase>>,
|
|
101
101
|
{
|
|
102
102
|
enabled = true,
|
package/src/useScrollToTop.tsx
CHANGED
|
@@ -48,9 +48,7 @@ function getScrollableNode(ref: React.RefObject<ScrollableWrapper>) {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
export
|
|
52
|
-
ref: React.RefObject<ScrollableWrapper>
|
|
53
|
-
) {
|
|
51
|
+
export function useScrollToTop(ref: React.RefObject<ScrollableWrapper>) {
|
|
54
52
|
const navigation = useNavigation();
|
|
55
53
|
const route = useRoute();
|
|
56
54
|
|
package/src/useThenable.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export function useThenable<T>(create: () => PromiseLike<T>) {
|
|
4
4
|
const [promise] = React.useState(create);
|
|
5
5
|
|
|
6
6
|
let initialState: [boolean, T | undefined] = [false, undefined];
|