expo-router 0.0.26 → 0.0.28
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/build/exports.d.ts +14 -0
- package/build/exports.d.ts.map +1 -0
- package/build/exports.js +16 -0
- package/build/exports.js.map +1 -0
- package/build/index.d.ts +1 -14
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -16
- package/build/index.js.map +1 -1
- package/build/layouts/Drawer.d.ts +1 -0
- package/build/layouts/Drawer.d.ts.map +1 -1
- package/build/layouts/Drawer.js +1 -0
- package/build/layouts/Drawer.js.map +1 -1
- package/build/layouts/Stack.d.ts +1 -0
- package/build/layouts/Stack.d.ts.map +1 -1
- package/build/layouts/Stack.js +1 -0
- package/build/layouts/Stack.js.map +1 -1
- package/build/layouts/Tabs.d.ts +50 -8
- package/build/layouts/Tabs.d.ts.map +1 -1
- package/build/layouts/Tabs.js +34 -1
- package/build/layouts/Tabs.js.map +1 -1
- package/build/layouts/withLayoutContext.d.ts +1 -1
- package/build/layouts/withLayoutContext.d.ts.map +1 -1
- package/build/layouts/withLayoutContext.js +3 -2
- package/build/layouts/withLayoutContext.js.map +1 -1
- package/build/link/Link.d.ts +4 -3
- package/build/link/Link.d.ts.map +1 -1
- package/build/link/Link.js +3 -2
- package/build/link/Link.js.map +1 -1
- package/build/link/href.d.ts +1 -0
- package/build/link/href.d.ts.map +1 -1
- package/build/link/href.js +10 -2
- package/build/link/href.js.map +1 -1
- package/build/link/useLinkToPath.d.ts.map +1 -1
- package/build/link/useLinkToPath.js +8 -11
- package/build/link/useLinkToPath.js.map +1 -1
- package/build/views/Root.d.ts.map +1 -1
- package/build/views/Root.js +6 -4
- package/build/views/Root.js.map +1 -1
- package/drawer.d.ts +1 -0
- package/drawer.js +1 -0
- package/package.json +32 -11
- package/stack.d.ts +1 -0
- package/stack.js +1 -0
- package/tabs.d.ts +1 -0
- package/tabs.js +1 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { useFocusEffect } from "@react-navigation/native";
|
|
2
|
+
export { ErrorBoundaryProps } from "./views/Try";
|
|
3
|
+
export { withLayoutContext } from "./layouts/withLayoutContext";
|
|
4
|
+
export { ExpoRoot } from "./views/Root";
|
|
5
|
+
export { Unmatched } from "./views/Unmatched";
|
|
6
|
+
export { ErrorBoundary } from "./views/ErrorBoundary";
|
|
7
|
+
export { Layout, Children } from "./views/Layout";
|
|
8
|
+
export { Link, Redirect } from "./link/Link";
|
|
9
|
+
export { useLink } from "./link/useLink";
|
|
10
|
+
export { RootContainer } from "./ContextNavigationContainer";
|
|
11
|
+
export * as Linking from "./link/linking";
|
|
12
|
+
export { SplashScreen } from "./views/Splash";
|
|
13
|
+
export { useHref } from "./link/useHref";
|
|
14
|
+
//# sourceMappingURL=exports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAK1C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC"}
|
package/build/exports.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { useFocusEffect } from "@react-navigation/native";
|
|
2
|
+
export { withLayoutContext } from "./layouts/withLayoutContext";
|
|
3
|
+
export { ExpoRoot } from "./views/Root";
|
|
4
|
+
export { Unmatched } from "./views/Unmatched";
|
|
5
|
+
export { ErrorBoundary } from "./views/ErrorBoundary";
|
|
6
|
+
export { Layout, Children } from "./views/Layout";
|
|
7
|
+
export { Link, Redirect } from "./link/Link";
|
|
8
|
+
export { useLink } from "./link/useLink";
|
|
9
|
+
export { RootContainer } from "./ContextNavigationContainer";
|
|
10
|
+
import * as Linking_1 from "./link/linking";
|
|
11
|
+
export { Linking_1 as Linking };
|
|
12
|
+
// export { useRoutes } from "./Route";
|
|
13
|
+
// export { useScreens } from "./useScreens";
|
|
14
|
+
export { SplashScreen } from "./views/Splash";
|
|
15
|
+
export { useHref } from "./link/useHref";
|
|
16
|
+
//# sourceMappingURL=exports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAG1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;2BAEpC,gBAAgB;sBAA7B,OAAO;AAEnB,uCAAuC;AACvC,6CAA6C;AAE7C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["export { useFocusEffect } from \"@react-navigation/native\";\nexport { ErrorBoundaryProps } from \"./views/Try\";\n\nexport { withLayoutContext } from \"./layouts/withLayoutContext\";\n\nexport { ExpoRoot } from \"./views/Root\";\nexport { Unmatched } from \"./views/Unmatched\";\nexport { ErrorBoundary } from \"./views/ErrorBoundary\";\n\nexport { Layout, Children } from \"./views/Layout\";\nexport { Link, Redirect } from \"./link/Link\";\nexport { useLink } from \"./link/useLink\";\nexport { RootContainer } from \"./ContextNavigationContainer\";\n\nexport * as Linking from \"./link/linking\";\n\n// export { useRoutes } from \"./Route\";\n// export { useScreens } from \"./useScreens\";\n\nexport { SplashScreen } from \"./views/Splash\";\nexport { useHref } from \"./link/useHref\";\n"]}
|
package/build/index.d.ts
CHANGED
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
export { SplashScreen } from "./views/Splash";
|
|
2
|
-
export { useFocusEffect } from "@react-navigation/native";
|
|
3
|
-
export { ErrorBoundaryProps } from "./views/Try";
|
|
4
1
|
export { Stack } from "./layouts/Stack";
|
|
5
2
|
export { Tabs } from "./layouts/Tabs";
|
|
6
|
-
export
|
|
7
|
-
export { withLayoutContext } from "./layouts/withLayoutContext";
|
|
8
|
-
export { ExpoRoot } from "./views/Root";
|
|
9
|
-
export { Unmatched } from "./views/Unmatched";
|
|
10
|
-
export { ErrorBoundary } from "./views/ErrorBoundary";
|
|
11
|
-
export { Layout, Children } from "./views/Layout";
|
|
12
|
-
export { Link, Redirect } from "./link/Link";
|
|
13
|
-
export { useLink } from "./link/useLink";
|
|
14
|
-
export { useHref } from "./link/useHref";
|
|
15
|
-
export { RootContainer } from "./ContextNavigationContainer";
|
|
16
|
-
export * as Linking from "./link/linking";
|
|
3
|
+
export * from "./exports";
|
|
17
4
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,cAAc,WAAW,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -1,19 +1,4 @@
|
|
|
1
|
-
// export { useRoutes } from "./Route";
|
|
2
|
-
// export { useScreens } from "./useScreens";
|
|
3
|
-
export { SplashScreen } from "./views/Splash";
|
|
4
|
-
export { useFocusEffect } from "@react-navigation/native";
|
|
5
1
|
export { Stack } from "./layouts/Stack";
|
|
6
2
|
export { Tabs } from "./layouts/Tabs";
|
|
7
|
-
export
|
|
8
|
-
export { withLayoutContext } from "./layouts/withLayoutContext";
|
|
9
|
-
export { ExpoRoot } from "./views/Root";
|
|
10
|
-
export { Unmatched } from "./views/Unmatched";
|
|
11
|
-
export { ErrorBoundary } from "./views/ErrorBoundary";
|
|
12
|
-
export { Layout, Children } from "./views/Layout";
|
|
13
|
-
export { Link, Redirect } from "./link/Link";
|
|
14
|
-
export { useLink } from "./link/useLink";
|
|
15
|
-
export { useHref } from "./link/useHref";
|
|
16
|
-
export { RootContainer } from "./ContextNavigationContainer";
|
|
17
|
-
import * as Linking_1 from "./link/linking";
|
|
18
|
-
export { Linking_1 as Linking };
|
|
3
|
+
export * from "./exports";
|
|
19
4
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,cAAc,WAAW,CAAC","sourcesContent":["export { Stack } from \"./layouts/Stack\";\nexport { Tabs } from \"./layouts/Tabs\";\nexport * from \"./exports\";\n"]}
|
|
@@ -123,4 +123,5 @@ export declare const Drawer: import("react").ForwardRefExoticComponent<Omit<Omit
|
|
|
123
123
|
}, "children">> & import("react").RefAttributes<unknown>> & {
|
|
124
124
|
Screen: (props: import("../useScreens").ScreenProps<DrawerNavigationOptions>) => null;
|
|
125
125
|
};
|
|
126
|
+
export default Drawer;
|
|
126
127
|
//# sourceMappingURL=Drawer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../src/layouts/Drawer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,uBAAuB,EACxB,MAAM,0BAA0B,CAAC;AAMlC,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGD,CAAC"}
|
|
1
|
+
{"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../src/layouts/Drawer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,uBAAuB,EACxB,MAAM,0BAA0B,CAAC;AAMlC,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGD,CAAC;AAEnB,eAAe,MAAM,CAAC"}
|
package/build/layouts/Drawer.js
CHANGED
|
@@ -2,4 +2,5 @@ import { createDrawerNavigator, } from "@react-navigation/drawer";
|
|
|
2
2
|
import { withLayoutContext } from "./withLayoutContext";
|
|
3
3
|
const DrawerNavigator = createDrawerNavigator().Navigator;
|
|
4
4
|
export const Drawer = withLayoutContext(DrawerNavigator);
|
|
5
|
+
export default Drawer;
|
|
5
6
|
//# sourceMappingURL=Drawer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.js","sourceRoot":"","sources":["../../src/layouts/Drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,GAEtB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,eAAe,GAAG,qBAAqB,EAAE,CAAC,SAAS,CAAC;AAE1D,MAAM,CAAC,MAAM,MAAM,GAAG,iBAAiB,CAGrC,eAAe,CAAC,CAAC","sourcesContent":["import {\n createDrawerNavigator,\n DrawerNavigationOptions,\n} from \"@react-navigation/drawer\";\n\nimport { withLayoutContext } from \"./withLayoutContext\";\n\nconst DrawerNavigator = createDrawerNavigator().Navigator;\n\nexport const Drawer = withLayoutContext<\n DrawerNavigationOptions,\n typeof DrawerNavigator\n>(DrawerNavigator);\n"]}
|
|
1
|
+
{"version":3,"file":"Drawer.js","sourceRoot":"","sources":["../../src/layouts/Drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,GAEtB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,eAAe,GAAG,qBAAqB,EAAE,CAAC,SAAS,CAAC;AAE1D,MAAM,CAAC,MAAM,MAAM,GAAG,iBAAiB,CAGrC,eAAe,CAAC,CAAC;AAEnB,eAAe,MAAM,CAAC","sourcesContent":["import {\n createDrawerNavigator,\n DrawerNavigationOptions,\n} from \"@react-navigation/drawer\";\n\nimport { withLayoutContext } from \"./withLayoutContext\";\n\nconst DrawerNavigator = createDrawerNavigator().Navigator;\n\nexport const Drawer = withLayoutContext<\n DrawerNavigationOptions,\n typeof DrawerNavigator\n>(DrawerNavigator);\n\nexport default Drawer;\n"]}
|
package/build/layouts/Stack.d.ts
CHANGED
|
@@ -123,4 +123,5 @@ export declare const Stack: import("react").ForwardRefExoticComponent<Omit<Omit<
|
|
|
123
123
|
}, "children">> & import("react").RefAttributes<unknown>> & {
|
|
124
124
|
Screen: (props: import("../useScreens").ScreenProps<NativeStackNavigationOptions>) => null;
|
|
125
125
|
};
|
|
126
|
+
export default Stack;
|
|
126
127
|
//# sourceMappingURL=Stack.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stack.d.ts","sourceRoot":"","sources":["../../src/layouts/Stack.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,4BAA4B,EAC7B,MAAM,gCAAgC,CAAC;AAMxC,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGK,CAAC"}
|
|
1
|
+
{"version":3,"file":"Stack.d.ts","sourceRoot":"","sources":["../../src/layouts/Stack.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,4BAA4B,EAC7B,MAAM,gCAAgC,CAAC;AAMxC,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGK,CAAC;AAExB,eAAe,KAAK,CAAC"}
|
package/build/layouts/Stack.js
CHANGED
|
@@ -2,4 +2,5 @@ import { createNativeStackNavigator, } from "@react-navigation/native-stack";
|
|
|
2
2
|
import { withLayoutContext } from "./withLayoutContext";
|
|
3
3
|
const NativeStackNavigator = createNativeStackNavigator().Navigator;
|
|
4
4
|
export const Stack = withLayoutContext(NativeStackNavigator);
|
|
5
|
+
export default Stack;
|
|
5
6
|
//# sourceMappingURL=Stack.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stack.js","sourceRoot":"","sources":["../../src/layouts/Stack.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,GAE3B,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,oBAAoB,GAAG,0BAA0B,EAAE,CAAC,SAAS,CAAC;AAEpE,MAAM,CAAC,MAAM,KAAK,GAAG,iBAAiB,CAGpC,oBAAoB,CAAC,CAAC","sourcesContent":["import {\n createNativeStackNavigator,\n NativeStackNavigationOptions,\n} from \"@react-navigation/native-stack\";\n\nimport { withLayoutContext } from \"./withLayoutContext\";\n\nconst NativeStackNavigator = createNativeStackNavigator().Navigator;\n\nexport const Stack = withLayoutContext<\n NativeStackNavigationOptions,\n typeof NativeStackNavigator\n>(NativeStackNavigator);\n"]}
|
|
1
|
+
{"version":3,"file":"Stack.js","sourceRoot":"","sources":["../../src/layouts/Stack.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,GAE3B,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,oBAAoB,GAAG,0BAA0B,EAAE,CAAC,SAAS,CAAC;AAEpE,MAAM,CAAC,MAAM,KAAK,GAAG,iBAAiB,CAGpC,oBAAoB,CAAC,CAAC;AAExB,eAAe,KAAK,CAAC","sourcesContent":["import {\n createNativeStackNavigator,\n NativeStackNavigationOptions,\n} from \"@react-navigation/native-stack\";\n\nimport { withLayoutContext } from \"./withLayoutContext\";\n\nconst NativeStackNavigator = createNativeStackNavigator().Navigator;\n\nexport const Stack = withLayoutContext<\n NativeStackNavigationOptions,\n typeof NativeStackNavigator\n>(NativeStackNavigator);\n\nexport default Stack;\n"]}
|
package/build/layouts/Tabs.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { BottomTabNavigationOptions } from "@react-navigation/bottom-tabs";
|
|
3
|
-
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Href } from "../link/href";
|
|
4
|
+
export declare const Tabs: React.ForwardRefExoticComponent<Omit<Omit<import("@react-navigation/routers").DefaultRouterOptions<string> & {
|
|
4
5
|
id?: string | undefined;
|
|
5
|
-
children:
|
|
6
|
+
children: React.ReactNode;
|
|
6
7
|
screenListeners?: Partial<{
|
|
7
8
|
tabPress: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "tabPress">;
|
|
8
9
|
tabLongPress: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "tabLongPress">;
|
|
@@ -34,7 +35,7 @@ export declare const Tabs: import("react").ForwardRefExoticComponent<Omit<Omit<i
|
|
|
34
35
|
backBehavior?: import("@react-navigation/routers/lib/typescript/src/TabRouter").BackBehavior | undefined;
|
|
35
36
|
} & import("@react-navigation/bottom-tabs/lib/typescript/src/types").BottomTabNavigationConfig, "children" | "initialRouteName" | "screenOptions" | "id" | "screenListeners" | "defaultScreenOptions"> & import("@react-navigation/routers").DefaultRouterOptions<string> & {
|
|
36
37
|
id?: string | undefined;
|
|
37
|
-
children:
|
|
38
|
+
children: React.ReactNode;
|
|
38
39
|
screenListeners?: Partial<{
|
|
39
40
|
tabPress: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "tabPress">;
|
|
40
41
|
tabLongPress: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "tabLongPress">;
|
|
@@ -64,7 +65,7 @@ export declare const Tabs: import("react").ForwardRefExoticComponent<Omit<Omit<i
|
|
|
64
65
|
}) => BottomTabNavigationOptions) | undefined;
|
|
65
66
|
}, "children"> & Partial<Pick<Omit<import("@react-navigation/routers").DefaultRouterOptions<string> & {
|
|
66
67
|
id?: string | undefined;
|
|
67
|
-
children:
|
|
68
|
+
children: React.ReactNode;
|
|
68
69
|
screenListeners?: Partial<{
|
|
69
70
|
tabPress: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "tabPress">;
|
|
70
71
|
tabLongPress: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "tabLongPress">;
|
|
@@ -96,7 +97,7 @@ export declare const Tabs: import("react").ForwardRefExoticComponent<Omit<Omit<i
|
|
|
96
97
|
backBehavior?: import("@react-navigation/routers/lib/typescript/src/TabRouter").BackBehavior | undefined;
|
|
97
98
|
} & import("@react-navigation/bottom-tabs/lib/typescript/src/types").BottomTabNavigationConfig, "children" | "initialRouteName" | "screenOptions" | "id" | "screenListeners" | "defaultScreenOptions"> & import("@react-navigation/routers").DefaultRouterOptions<string> & {
|
|
98
99
|
id?: string | undefined;
|
|
99
|
-
children:
|
|
100
|
+
children: React.ReactNode;
|
|
100
101
|
screenListeners?: Partial<{
|
|
101
102
|
tabPress: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "tabPress">;
|
|
102
103
|
tabLongPress: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "tabLongPress">;
|
|
@@ -124,7 +125,48 @@ export declare const Tabs: import("react").ForwardRefExoticComponent<Omit<Omit<i
|
|
|
124
125
|
navigation: any;
|
|
125
126
|
options: BottomTabNavigationOptions;
|
|
126
127
|
}) => BottomTabNavigationOptions) | undefined;
|
|
127
|
-
}, "children">> &
|
|
128
|
-
Screen: (props: import("../useScreens").ScreenProps<
|
|
128
|
+
}, "children">> & React.RefAttributes<unknown>> & {
|
|
129
|
+
Screen: (props: import("../useScreens").ScreenProps<import("@react-navigation/elements").HeaderOptions & {
|
|
130
|
+
title?: string | undefined;
|
|
131
|
+
tabBarLabel?: string | ((props: {
|
|
132
|
+
focused: boolean;
|
|
133
|
+
color: string;
|
|
134
|
+
position: import("@react-navigation/bottom-tabs/lib/typescript/src/types").LabelPosition;
|
|
135
|
+
}) => React.ReactNode) | undefined;
|
|
136
|
+
tabBarShowLabel?: boolean | undefined;
|
|
137
|
+
tabBarLabelPosition?: import("@react-navigation/bottom-tabs/lib/typescript/src/types").LabelPosition | undefined;
|
|
138
|
+
tabBarLabelStyle?: import("react-native").StyleProp<import("react-native").TextStyle>;
|
|
139
|
+
tabBarAllowFontScaling?: boolean | undefined;
|
|
140
|
+
tabBarIcon?: ((props: {
|
|
141
|
+
focused: boolean;
|
|
142
|
+
color: string;
|
|
143
|
+
size: number;
|
|
144
|
+
}) => React.ReactNode) | undefined;
|
|
145
|
+
tabBarIconStyle?: import("react-native").StyleProp<import("react-native").TextStyle>;
|
|
146
|
+
tabBarBadge?: string | number | undefined;
|
|
147
|
+
tabBarBadgeStyle?: import("react-native").StyleProp<import("react-native").TextStyle>;
|
|
148
|
+
tabBarAccessibilityLabel?: string | undefined;
|
|
149
|
+
tabBarTestID?: string | undefined;
|
|
150
|
+
tabBarButton?: ((props: import("@react-navigation/bottom-tabs").BottomTabBarButtonProps) => React.ReactNode) | undefined;
|
|
151
|
+
tabBarActiveTintColor?: string | undefined;
|
|
152
|
+
tabBarInactiveTintColor?: string | undefined;
|
|
153
|
+
tabBarActiveBackgroundColor?: string | undefined;
|
|
154
|
+
tabBarInactiveBackgroundColor?: string | undefined;
|
|
155
|
+
tabBarItemStyle?: import("react-native").StyleProp<import("react-native").ViewStyle>;
|
|
156
|
+
tabBarHideOnKeyboard?: boolean | undefined;
|
|
157
|
+
tabBarVisibilityAnimationConfig?: {
|
|
158
|
+
show?: import("@react-navigation/bottom-tabs/lib/typescript/src/types").TabBarVisibilityAnimationConfig | undefined;
|
|
159
|
+
hide?: import("@react-navigation/bottom-tabs/lib/typescript/src/types").TabBarVisibilityAnimationConfig | undefined;
|
|
160
|
+
} | undefined;
|
|
161
|
+
tabBarStyle?: false | import("react-native").RegisteredStyle<import("react-native").ViewStyle> | import("react-native").Animated.Value | import("react-native").Animated.AnimatedInterpolation | import("react-native").Animated.WithAnimatedObject<import("react-native").ViewStyle> | import("react-native").Animated.WithAnimatedArray<import("react-native").Falsy | import("react-native").ViewStyle | import("react-native").RegisteredStyle<import("react-native").ViewStyle> | import("react-native").RecursiveArray<import("react-native").Falsy | import("react-native").ViewStyle | import("react-native").RegisteredStyle<import("react-native").ViewStyle>> | readonly (import("react-native").Falsy | import("react-native").ViewStyle | import("react-native").RegisteredStyle<import("react-native").ViewStyle>)[]> | null | undefined;
|
|
162
|
+
tabBarBackground?: (() => React.ReactNode) | undefined;
|
|
163
|
+
lazy?: boolean | undefined;
|
|
164
|
+
header?: ((props: import("@react-navigation/bottom-tabs").BottomTabHeaderProps) => React.ReactNode) | undefined;
|
|
165
|
+
headerShown?: boolean | undefined;
|
|
166
|
+
unmountOnBlur?: boolean | undefined;
|
|
167
|
+
} & {
|
|
168
|
+
href?: Href | null | undefined;
|
|
169
|
+
}>) => null;
|
|
129
170
|
};
|
|
171
|
+
export default Tabs;
|
|
130
172
|
//# sourceMappingURL=Tabs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../src/layouts/Tabs.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../src/layouts/Tabs.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,0BAA0B,EAE3B,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAMpC,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6Cf,CAAC;AAEH,eAAe,IAAI,CAAC"}
|
package/build/layouts/Tabs.js
CHANGED
|
@@ -1,6 +1,39 @@
|
|
|
1
|
+
import { Pressable } from "@bacons/react-views";
|
|
1
2
|
import { createBottomTabNavigator, } from "@react-navigation/bottom-tabs";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Platform } from "react-native";
|
|
5
|
+
import { Link } from "../link/Link";
|
|
2
6
|
import { withLayoutContext } from "./withLayoutContext";
|
|
3
7
|
// This is the only way to access the navigator.
|
|
4
8
|
const BottomTabNavigator = createBottomTabNavigator().Navigator;
|
|
5
|
-
export const Tabs = withLayoutContext(BottomTabNavigator)
|
|
9
|
+
export const Tabs = withLayoutContext(BottomTabNavigator, (screens) => {
|
|
10
|
+
// Support the `href` shortcut prop.
|
|
11
|
+
return screens.map((screen) => {
|
|
12
|
+
if (typeof screen.options !== "function" &&
|
|
13
|
+
screen.options?.href !== undefined) {
|
|
14
|
+
const { href, ...options } = screen.options;
|
|
15
|
+
if (options.tabBarButton) {
|
|
16
|
+
throw new Error("Cannot use `href` and `tabBarButton` together.");
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
...screen,
|
|
20
|
+
options: {
|
|
21
|
+
...options,
|
|
22
|
+
// Force the button to go to the user's profile
|
|
23
|
+
tabBarButton: (props) => {
|
|
24
|
+
if (href == null) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
const children = Platform.OS === "web" ? (props.children) : (React.createElement(Pressable, null, props.children));
|
|
28
|
+
return (React.createElement(Link, { ...props, style: [{ display: "flex" }, props.style],
|
|
29
|
+
// @ts-expect-error
|
|
30
|
+
href: href, asChild: Platform.OS !== "web", children: children }));
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return screen;
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
export default Tabs;
|
|
6
39
|
//# sourceMappingURL=Tabs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.js","sourceRoot":"","sources":["../../src/layouts/Tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,wBAAwB,GACzB,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"Tabs.js","sourceRoot":"","sources":["../../src/layouts/Tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAEL,wBAAwB,GACzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,gDAAgD;AAChD,MAAM,kBAAkB,GAAG,wBAAwB,EAAE,CAAC,SAAS,CAAC;AAEhE,MAAM,CAAC,MAAM,IAAI,GAAG,iBAAiB,CAGnC,kBAAkB,EAAE,CAAC,OAAO,EAAE,EAAE;IAChC,oCAAoC;IACpC,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;QAC5B,IACE,OAAO,MAAM,CAAC,OAAO,KAAK,UAAU;YACpC,MAAM,CAAC,OAAO,EAAE,IAAI,KAAK,SAAS,EAClC;YACA,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC;YAC5C,IAAI,OAAO,CAAC,YAAY,EAAE;gBACxB,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;aACnE;YACD,OAAO;gBACL,GAAG,MAAM;gBACT,OAAO,EAAE;oBACP,GAAG,OAAO;oBACV,+CAA+C;oBAC/C,YAAY,EAAE,CAAC,KAAK,EAAE,EAAE;wBACtB,IAAI,IAAI,IAAI,IAAI,EAAE;4BAChB,OAAO,IAAI,CAAC;yBACb;wBACD,MAAM,QAAQ,GACZ,QAAQ,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,CACtB,KAAK,CAAC,QAAQ,CACf,CAAC,CAAC,CAAC,CACF,oBAAC,SAAS,QAAE,KAAK,CAAC,QAAQ,CAAa,CACxC,CAAC;wBACJ,OAAO,CACL,oBAAC,IAAI,OACC,KAAK,EACT,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,KAAK,CAAC,KAAK,CAAC;4BACzC,mBAAmB;4BACnB,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,QAAQ,CAAC,EAAE,KAAK,KAAK,EAC9B,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;oBACJ,CAAC;iBACF;aACF,CAAC;SACH;QACD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,eAAe,IAAI,CAAC","sourcesContent":["import { Pressable } from \"@bacons/react-views\";\nimport {\n BottomTabNavigationOptions,\n createBottomTabNavigator,\n} from \"@react-navigation/bottom-tabs\";\nimport React from \"react\";\nimport { Platform } from \"react-native\";\n\nimport { Link } from \"../link/Link\";\nimport { Href } from \"../link/href\";\nimport { withLayoutContext } from \"./withLayoutContext\";\n\n// This is the only way to access the navigator.\nconst BottomTabNavigator = createBottomTabNavigator().Navigator;\n\nexport const Tabs = withLayoutContext<\n BottomTabNavigationOptions & { href?: Href | null },\n typeof BottomTabNavigator\n>(BottomTabNavigator, (screens) => {\n // Support the `href` shortcut prop.\n return screens.map((screen) => {\n if (\n typeof screen.options !== \"function\" &&\n screen.options?.href !== undefined\n ) {\n const { href, ...options } = screen.options;\n if (options.tabBarButton) {\n throw new Error(\"Cannot use `href` and `tabBarButton` together.\");\n }\n return {\n ...screen,\n options: {\n ...options,\n // Force the button to go to the user's profile\n tabBarButton: (props) => {\n if (href == null) {\n return null;\n }\n const children =\n Platform.OS === \"web\" ? (\n props.children\n ) : (\n <Pressable>{props.children}</Pressable>\n );\n return (\n <Link\n {...props}\n style={[{ display: \"flex\" }, props.style]}\n // @ts-expect-error\n href={href}\n asChild={Platform.OS !== \"web\"}\n children={children}\n />\n );\n },\n },\n };\n }\n return screen;\n });\n});\n\nexport default Tabs;\n"]}
|
|
@@ -8,7 +8,7 @@ export declare function useFilterScreenChildren(children: React.ReactNode, { isC
|
|
|
8
8
|
children: any[];
|
|
9
9
|
};
|
|
10
10
|
/** Return a navigator that automatically injects matched routes and renders nothing when there are no children. Return type with children prop optional */
|
|
11
|
-
export declare function withLayoutContext<TOptions extends object, T extends React.ComponentType<any>>(Nav: T): React.ForwardRefExoticComponent<React.PropsWithoutRef<PickPartial<React.ComponentProps<T>, "children">> & React.RefAttributes<unknown>> & {
|
|
11
|
+
export declare function withLayoutContext<TOptions extends object, T extends React.ComponentType<any>>(Nav: T, processor?: (options: ScreenProps<TOptions>[]) => ScreenProps<TOptions>[]): React.ForwardRefExoticComponent<React.PropsWithoutRef<PickPartial<React.ComponentProps<T>, "children">> & React.RefAttributes<unknown>> & {
|
|
12
12
|
Screen: (props: ScreenProps<TOptions>) => null;
|
|
13
13
|
};
|
|
14
14
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withLayoutContext.d.ts","sourceRoot":"","sources":["../../src/layouts/withLayoutContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAoB,WAAW,EAAE,MAAM,eAAe,CAAC;AAG9D,aAAK,WAAW,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;A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AAM,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC;CAChD,CA+BA"}
|
|
@@ -40,10 +40,11 @@ export function useFilterScreenChildren(children, { isCustomNavigator } = {}) {
|
|
|
40
40
|
}, [children]);
|
|
41
41
|
}
|
|
42
42
|
/** Return a navigator that automatically injects matched routes and renders nothing when there are no children. Return type with children prop optional */
|
|
43
|
-
export function withLayoutContext(Nav) {
|
|
43
|
+
export function withLayoutContext(Nav, processor) {
|
|
44
44
|
const Navigator = React.forwardRef(({ children: userDefinedChildren, ...props }, ref) => {
|
|
45
45
|
const { screens } = useFilterScreenChildren(userDefinedChildren);
|
|
46
|
-
const
|
|
46
|
+
const processed = processor ? processor(screens ?? []) : screens;
|
|
47
|
+
const sorted = useSortedScreens(processed ?? []);
|
|
47
48
|
// Prevent throwing an error when there are no screens.
|
|
48
49
|
if (!sorted.length) {
|
|
49
50
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withLayoutContext.js","sourceRoot":"","sources":["../../src/layouts/withLayoutContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAe,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAIzC,MAAM,UAAU,uBAAuB,CACrC,QAAyB,EACzB,EAAE,iBAAiB,KAAsC,EAAE;IAE3D,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACxB,MAAM,cAAc,GAAU,EAAE,CAAC;QACjC,MAAM,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;YACrD,IAAI,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,EAAE;gBACjE,IAAI,CAAC,KAAK,CAAC,KAAK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E,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YACpD,IAAI,KAAK,IAAI,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC,MAAM,EAAE;gBACjD,MAAM,IAAI,KAAK,CAAC,+BAA+B,GAAG,KAAK,CAAC,CAAC;aAC1D;SACF;QAED,OAAO;YACL,OAAO;YACP,QAAQ,EAAE,cAAc;SACzB,CAAC;IACJ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;AACjB,CAAC;AAED,2JAA2J;AAC3J,MAAM,UAAU,iBAAiB,CAI/B,GAAM,EACN,SAAyE;IAOzE,MAAM,SAAS,GAAG,KAAK,CAAC,UAAU,CAChC,CACE,EACE,QAAQ,EAAE,mBAAmB,EAC7B,GAAG,KAAK,EACyC,EACnD,GAAG,EACH,EAAE;QACF,MAAM,EAAE,OAAO,EAAE,GAAG,uBAAuB,CAAC,mBAAmB,CAAC,CAAC;QAEjE,MAAM,SAAS,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;QAEjE,MAAM,MAAM,GAAG,gBAAgB,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;QAEjD,uDAAuD;QACvD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;YAClB,OAAO,IAAI,CAAC;SACb;QAED,OAAO;QACL,mBAAmB;QACnB,oBAAC,GAAG,OAAK,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,GAAI,CAC/C,CAAC;IACJ,CAAC,CACF,CAAC;IAEF,mBAAmB;IACnB,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC;IAC1B,mBAAmB;IACnB,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import React from \"react\";\n\nimport { useSortedScreens, ScreenProps } from \"../useScreens\";\nimport { Screen } from \"../views/Screen\";\n\ntype PickPartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\n\nexport function useFilterScreenChildren(\n children: React.ReactNode,\n { isCustomNavigator }: { isCustomNavigator?: boolean } = {}\n) {\n return React.useMemo(() => {\n const customChildren: any[] = [];\n const screens = React.Children.map(children, (child) => {\n if (React.isValidElement(child) && child && child.type === Screen) {\n if (!child.props.name) {\n throw new Error(\n \"Screen must have a name prop when used as a child of a Layout\"\n );\n }\n if (process.env.NODE_ENV !== \"production\") {\n if (\n [\"children\", \"component\", \"getComponent\"].some(\n (key) => key in child.props\n )\n ) {\n throw new Error(\n \"Screen must not have a children, component, or getComponent prop when used as a child of a Layout\"\n );\n }\n }\n return child.props;\n } else {\n if (isCustomNavigator) {\n customChildren.push(child);\n } else {\n console.warn(\n \"Layout children must be of type Screen, all other children are ignored. To use custom children, create a custom <Layout />.\"\n );\n }\n }\n });\n\n // Add an assertion for development\n if (process.env.NODE_ENV !== \"production\") {\n // Assert if names are not unique\n const names = screens?.map((screen) => screen.name);\n if (names && new Set(names).size !== names.length) {\n throw new Error(\"Screen names must be unique: \" + names);\n }\n }\n\n return {\n screens,\n children: customChildren,\n };\n }, [children]);\n}\n\n/** Return a navigator that automatically injects matched routes and renders nothing when there are no children. Return type with children prop optional */\nexport function withLayoutContext<\n TOptions extends object,\n T extends React.ComponentType<any>\n>(\n Nav: T,\n processor?: (options: ScreenProps<TOptions>[]) => ScreenProps<TOptions>[]\n): React.ForwardRefExoticComponent<\n React.PropsWithoutRef<PickPartial<React.ComponentProps<T>, \"children\">> &\n React.RefAttributes<unknown>\n> & {\n Screen: (props: ScreenProps<TOptions>) => null;\n} {\n const Navigator = React.forwardRef(\n (\n {\n children: userDefinedChildren,\n ...props\n }: PickPartial<React.ComponentProps<T>, \"children\">,\n ref\n ) => {\n const { screens } = useFilterScreenChildren(userDefinedChildren);\n\n const processed = processor ? processor(screens ?? []) : screens;\n\n const sorted = useSortedScreens(processed ?? []);\n\n // Prevent throwing an error when there are no screens.\n if (!sorted.length) {\n return null;\n }\n\n return (\n // @ts-expect-error\n <Nav {...props} ref={ref} children={sorted} />\n );\n }\n );\n\n // @ts-expect-error\n Navigator.Screen = Screen;\n // @ts-expect-error\n return Navigator;\n}\n"]}
|
package/build/link/Link.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ declare type Props = {
|
|
|
7
7
|
href: Href;
|
|
8
8
|
/** Forward props to child component. Useful for custom buttons. */
|
|
9
9
|
asChild?: boolean;
|
|
10
|
-
/** Should replace the current
|
|
10
|
+
/** Should replace the current route without adding to the history. */
|
|
11
11
|
replace?: boolean;
|
|
12
12
|
onPress?: (e: React.MouseEvent<HTMLAnchorElement, MouseEvent> | GestureResponderEvent) => void;
|
|
13
13
|
} & (TextProps & {
|
|
@@ -18,10 +18,11 @@ export declare function Redirect({ href }: {
|
|
|
18
18
|
href: Href;
|
|
19
19
|
}): null;
|
|
20
20
|
/**
|
|
21
|
-
* Component to render link to another
|
|
21
|
+
* Component to render link to another route using a path.
|
|
22
22
|
* Uses an anchor tag on the web.
|
|
23
23
|
*
|
|
24
|
-
* @param props.href Absolute path to
|
|
24
|
+
* @param props.href Absolute path to route (e.g. `/feeds/hot`).
|
|
25
|
+
* @param props.replace Should replace the current route without adding to the history.
|
|
25
26
|
* @param props.asChild Forward props to child component. Useful for custom buttons.
|
|
26
27
|
* @param props.children Child elements to render the content.
|
|
27
28
|
*/
|
package/build/link/Link.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/link/Link.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAQ,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGtD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,qBAAqB,EAAY,MAAM,cAAc,CAAC;AAE/D,OAAO,EAAE,IAAI,EAAe,MAAM,QAAQ,CAAC;AAI3C,aAAK,KAAK,GAAG;IACX,2CAA2C;IAC3C,IAAI,EAAE,IAAI,CAAC;IAGX,mEAAmE;IACnE,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,
|
|
1
|
+
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/link/Link.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAQ,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGtD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,qBAAqB,EAAY,MAAM,cAAc,CAAC;AAE/D,OAAO,EAAE,IAAI,EAAe,MAAM,QAAQ,CAAC;AAI3C,aAAK,KAAK,GAAG;IACX,2CAA2C;IAC3C,IAAI,EAAE,IAAI,CAAC;IAGX,mEAAmE;IACnE,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,sEAAsE;IACtE,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,OAAO,CAAC,EAAE,CACR,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,EAAE,UAAU,CAAC,GAAG,qBAAqB,KACvE,IAAI,CAAC;CACX,GAAG,CAAC,SAAS,GAAG;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CAAC,CAAC;AAEhD,iEAAiE;AACjE,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,QAMhD;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,IAAI,s7BAAmC,CAAC"}
|
package/build/link/Link.js
CHANGED
|
@@ -17,10 +17,11 @@ export function Redirect({ href }) {
|
|
|
17
17
|
return null;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
|
-
* Component to render link to another
|
|
20
|
+
* Component to render link to another route using a path.
|
|
21
21
|
* Uses an anchor tag on the web.
|
|
22
22
|
*
|
|
23
|
-
* @param props.href Absolute path to
|
|
23
|
+
* @param props.href Absolute path to route (e.g. `/feeds/hot`).
|
|
24
|
+
* @param props.replace Should replace the current route without adding to the history.
|
|
24
25
|
* @param props.asChild Forward props to child component. Useful for custom buttons.
|
|
25
26
|
* @param props.children Child elements to render the content.
|
|
26
27
|
*/
|
package/build/link/Link.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.js","sourceRoot":"","sources":["../../src/link/Link.tsx"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,mCAAmC;AACnC,OAAO,EAAE,IAAI,EAAa,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAyB,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE/D,OAAO,EAAQ,WAAW,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AAkBtD,iEAAiE;AACjE,MAAM,UAAU,QAAQ,CAAC,EAAE,IAAI,EAAkB;IAC/C,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IACvB,cAAc,CAAC,GAAG,EAAE;QAClB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"Link.js","sourceRoot":"","sources":["../../src/link/Link.tsx"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,mCAAmC;AACnC,OAAO,EAAE,IAAI,EAAa,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAyB,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE/D,OAA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AE,OAAO,EAAE,OAAO,EAAS;YAChC,OAAO,EAAE,EAAE,OAAO,EAAE;SACrB,CAAC;KACH,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Fork of @react-navigation/native Link.tsx with `href` and `replace` support added and\n// `to` / `action` support removed.\nimport { Text, TextProps } from \"@bacons/react-views\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { useFocusEffect } from \"@react-navigation/native\";\nimport * as React from \"react\";\nimport { GestureResponderEvent, Platform } from \"react-native\";\n\nimport { Href, resolveHref } from \"./href\";\nimport { useLink } from \"./useLink\";\nimport useLinkToPathProps from \"./useLinkToPathProps\";\n\ntype Props = {\n /** Add a property which is familiar to */\n href: Href;\n\n // TODO(EvanBacon): This may need to be extracted for React Native style support.\n /** Forward props to child component. Useful for custom buttons. */\n asChild?: boolean;\n\n /** Should replace the current route without adding to the history. */\n replace?: boolean;\n\n onPress?: (\n e: React.MouseEvent<HTMLAnchorElement, MouseEvent> | GestureResponderEvent\n ) => void;\n} & (TextProps & { children: React.ReactNode });\n\n/** Redirects to the href as soon as the component is mounted. */\nexport function Redirect({ href }: { href: Href }) {\n const link = useLink();\n useFocusEffect(() => {\n link.replace(href);\n });\n return null;\n}\n\n/**\n * Component to render link to another route using a path.\n * Uses an anchor tag on the web.\n *\n * @param props.href Absolute path to route (e.g. `/feeds/hot`).\n * @param props.replace Should replace the current route without adding to the history.\n * @param props.asChild Forward props to child component. Useful for custom buttons.\n * @param props.children Child elements to render the content.\n */\nexport const Link = React.forwardRef(ExpoRouterLink);\n\nfunction ExpoRouterLink(\n { href, replace, asChild, ...rest }: Props,\n ref: React.ForwardedRef<Text>\n) {\n // TODO: Auto use router's client-side event.\n const resolvedHref = React.useMemo(() => resolveHref(href), [href]);\n\n const props = useLinkToPathProps({ href: resolvedHref, replace });\n\n const onPress = (\n e: React.MouseEvent<HTMLAnchorElement, MouseEvent> | GestureResponderEvent\n ) => {\n if (\"onPress\" in rest) {\n rest.onPress?.(e);\n }\n props.onPress(e);\n };\n\n return React.createElement(\n // @ts-expect-error: slot is not type-safe\n asChild ? Slot : Text,\n {\n ref,\n ...props,\n ...rest,\n ...Platform.select({\n web: { onClick: onPress } as any,\n default: { onPress },\n }),\n }\n );\n}\n"]}
|
package/build/link/href.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export declare type Href = string | {
|
|
|
4
4
|
/** Query parameters for the path. */
|
|
5
5
|
query?: Record<string, any>;
|
|
6
6
|
};
|
|
7
|
+
/** Resolve an href object into a fully qualified, relative href. */
|
|
7
8
|
export declare const resolveHref: (href: {
|
|
8
9
|
pathname?: string;
|
|
9
10
|
query?: Record<string, any>;
|
package/build/link/href.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"href.d.ts","sourceRoot":"","sources":["../../src/link/href.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"href.d.ts","sourceRoot":"","sources":["../../src/link/href.ts"],"names":[],"mappings":"AAEA,oBAAY,IAAI,GACZ,MAAM,GACN;IACE,mDAAmD;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC7B,CAAC;AAEN,oEAAoE;AACpE,eAAO,MAAM,WAAW,SAChB;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,MAAM,EAAE,GAAG,CAAC,CAAA;CAAE,GAAG,MAAM,KAChE,MAUF,CAAC"}
|
package/build/link/href.js
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
|
+
import { matchFragmentName } from "../matchers";
|
|
2
|
+
/** Resolve an href object into a fully qualified, relative href. */
|
|
1
3
|
export const resolveHref = (href) => {
|
|
2
4
|
if (typeof href === "string") {
|
|
3
|
-
return href ?? "";
|
|
5
|
+
return resolveHref({ pathname: href ?? "" });
|
|
4
6
|
}
|
|
5
|
-
const path = href.pathname ?? "";
|
|
7
|
+
const path = stripFragmentRoutes(href.pathname ?? "");
|
|
6
8
|
if (!href?.query) {
|
|
7
9
|
return path;
|
|
8
10
|
}
|
|
9
11
|
const { pathname, query } = createQualifiedPathname(path, { ...href.query });
|
|
10
12
|
return pathname + (Object.keys(query).length ? `?${createQuery(query)}` : "");
|
|
11
13
|
};
|
|
14
|
+
function stripFragmentRoutes(pathname) {
|
|
15
|
+
return pathname
|
|
16
|
+
.split("/")
|
|
17
|
+
.filter((segment) => matchFragmentName(segment) == null)
|
|
18
|
+
.join("/");
|
|
19
|
+
}
|
|
12
20
|
function createQualifiedPathname(pathname, query) {
|
|
13
21
|
for (const [key, value = ""] of Object.entries(query)) {
|
|
14
22
|
const dynamicKey = `[${key}]`;
|
package/build/link/href.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"href.js","sourceRoot":"","sources":["../../src/link/href.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"href.js","sourceRoot":"","sources":["../../src/link/href.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAWhD,oEAAoE;AACpE,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,IAAiE,EACzD,EAAE;IACV,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QAC5B,OAAO,WAAW,CAAC,EAAE,QAAQ,EAAE,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC;KAC9C;IACD,MAAM,IAAI,GAAG,mBAAmB,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;IACtD,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE;QAChB,OAAO,IAAI,CAAC;KACb;IACD,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,uBAAuB,CAAC,IAAI,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IAC7E,OAAO,QAAQ,GAAG,CAAC,MAAM,CAAC,I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CAAC;AAED,SAAS,WAAW,CAAC,KAA0B;IAC7C,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;SACtB,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;SACpC,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC","sourcesContent":["import { matchFragmentName } from \"../matchers\";\n\nexport type Href =\n | string\n | {\n /** Path representing the selected route `/[id]` */\n pathname?: string;\n /** Query parameters for the path. */\n query?: Record<string, any>;\n };\n\n/** Resolve an href object into a fully qualified, relative href. */\nexport const resolveHref = (\n href: { pathname?: string; query?: Record<string, any> } | string\n): string => {\n if (typeof href === \"string\") {\n return resolveHref({ pathname: href ?? \"\" });\n }\n const path = stripFragmentRoutes(href.pathname ?? \"\");\n if (!href?.query) {\n return path;\n }\n const { pathname, query } = createQualifiedPathname(path, { ...href.query });\n return pathname + (Object.keys(query).length ? `?${createQuery(query)}` : \"\");\n};\n\nfunction stripFragmentRoutes(pathname: string): string {\n return pathname\n .split(\"/\")\n .filter((segment) => matchFragmentName(segment) == null)\n .join(\"/\");\n}\n\nfunction createQualifiedPathname(pathname: string, query: Record<string, any>) {\n for (const [key, value = \"\"] of Object.entries(query)) {\n const dynamicKey = `[${key}]`;\n const deepDynamicKey = `[...${key}]`;\n if (pathname.includes(dynamicKey)) {\n pathname = pathname.replace(\n dynamicKey,\n Array.isArray(value) ? value.join(\"/\") : value\n );\n } else if (pathname.includes(deepDynamicKey)) {\n pathname = pathname.replace(\n deepDynamicKey,\n Array.isArray(value) ? value.join(\"/\") : value\n );\n } else {\n continue;\n }\n\n delete query[key];\n }\n return { pathname, query };\n}\n\nfunction createQuery(query: Record<string, any>) {\n return Object.keys(query)\n .map((key) => `${key}=${query[key]}`)\n .join(\"&\");\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLinkToPath.d.ts","sourceRoot":"","sources":["../../src/link/useLinkToPath.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useLinkToPath.d.ts","sourceRoot":"","sources":["../../src/link/useLinkToPath.ts"],"names":[],"mappings":"AAaA,wBAAgB,aAAa,SAKpB,MAAM,UAAU,MAAM,UAsC9B"}
|
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
import { getActionFromState, getStateFromPath, NavigationContainerRefContext, } from "@react-navigation/core";
|
|
2
2
|
import { LinkingContext } from "@react-navigation/native";
|
|
3
|
+
import * as Linking from "expo-linking";
|
|
3
4
|
import * as React from "react";
|
|
4
|
-
|
|
5
|
+
function isRemoteHref(href) {
|
|
6
|
+
return /:\/\//.test(href);
|
|
7
|
+
}
|
|
5
8
|
export function useLinkToPath() {
|
|
6
9
|
const navigation = React.useContext(NavigationContainerRefContext);
|
|
7
10
|
const linking = React.useContext(LinkingContext);
|
|
8
11
|
const linkTo = React.useCallback((to, event) => {
|
|
12
|
+
if (isRemoteHref(to)) {
|
|
13
|
+
Linking.openURL(to);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
9
16
|
if (navigation === undefined) {
|
|
10
17
|
throw new Error("Couldn't find a navigation object. Is your component inside NavigationContainer?");
|
|
11
18
|
}
|
|
12
|
-
if (!to.startsWith("/")) {
|
|
13
|
-
if (/:\/\//.test(to)) {
|
|
14
|
-
// Open external link
|
|
15
|
-
Linking.openURL(to);
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
throw new Error(`The href must start with '/' (${to}) or be a fully qualified URL.`);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
19
|
const { options } = linking;
|
|
23
20
|
const state = options?.getStateFromPath
|
|
24
21
|
? options.getStateFromPath(to, options.config)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLinkToPath.js","sourceRoot":"","sources":["../../src/link/useLinkToPath.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,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C,IAAI,KAAK,EAAE;YACT,MAAM,MAAM,GAAG,kBAAkB,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;YAE1D,IAAI,MAAM,KAAK,SAAS,EAAE;gBACxB,IAAI,KAAK,EAAE;oBACT,aAAa;oBACb,MAAM,CAAC,IAAI,GAAG,KAAK,CAAC;iBACrB;gBACD,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;aAC7B;iBAAM;gBACL,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;aACzB;SACF;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;SACpE;IACH,CAAC,EACD,CAAC,OAAO,EAAE,UAAU,CAAC,CACtB,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import {\n getActionFromState,\n getStateFromPath,\n NavigationContainerRefContext,\n} from \"@react-navigation/core\";\nimport { LinkingContext } from \"@react-navigation/native\";\nimport * as Linking from \"expo-linking\";\nimport * as React from \"react\";\n\nfunction isRemoteHref(href: string): boolean {\n return /:\\/\\//.test(href);\n}\n\nexport function useLinkToPath() {\n const navigation = React.useContext(NavigationContainerRefContext);\n const linking = React.useContext(LinkingContext);\n\n const linkTo = React.useCallback(\n (to: string, event?: string) => {\n if (isRemoteHref(to)) {\n Linking.openURL(to);\n return;\n }\n\n if (navigation === undefined) {\n throw new Error(\n \"Couldn't find a navigation object. Is your component inside NavigationContainer?\"\n );\n }\n\n const { options } = linking;\n\n const state = options?.getStateFromPath\n ? options.getStateFromPath(to, options.config)\n : getStateFromPath(to, options?.config);\n\n if (state) {\n const action = getActionFromState(state, options?.config);\n\n if (action !== undefined) {\n if (event) {\n // @ts-ignore\n action.type = event;\n }\n navigation.dispatch(action);\n } else {\n navigation.reset(state);\n }\n } else {\n throw new Error(\"Failed to parse the path to a navigation state.\");\n }\n },\n [linking, navigation]\n );\n\n return linkTo;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Root.d.ts","sourceRoot":"","sources":["../../src/views/Root.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"Root.d.ts","sourceRoot":"","sources":["../../src/views/Root.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAiB1C,wBAAgB,QAAQ,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,cAAc,CAAA;CAAE,eAUhE"}
|
package/build/views/Root.js
CHANGED
|
@@ -4,16 +4,18 @@ import { SafeAreaProvider } from "react-native-safe-area-context";
|
|
|
4
4
|
import { ContextNavigator } from "../ContextNavigator";
|
|
5
5
|
function getGestureHandlerRootView() {
|
|
6
6
|
try {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const { GestureHandlerRootView } = require("react-native-gesture-handler");
|
|
8
|
+
return function GestureHandler(props) {
|
|
9
|
+
return React.createElement(GestureHandlerRootView, { style: { flex: 1 }, ...props });
|
|
10
|
+
};
|
|
9
11
|
}
|
|
10
12
|
catch {
|
|
11
13
|
return React.Fragment;
|
|
12
14
|
}
|
|
13
15
|
}
|
|
16
|
+
const GestureHandlerRootView = getGestureHandlerRootView();
|
|
14
17
|
export function ExpoRoot({ context }) {
|
|
15
|
-
|
|
16
|
-
return (React.createElement(GestureHandlerRootView, { style: { flex: 1 } },
|
|
18
|
+
return (React.createElement(GestureHandlerRootView, null,
|
|
17
19
|
React.createElement(SafeAreaProvider, null,
|
|
18
20
|
React.createElement(ContextNavigator, { context: context }),
|
|
19
21
|
React.createElement(StatusBar, { style: "auto" }))));
|
package/build/views/Root.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Root.js","sourceRoot":"","sources":["../../src/views/Root.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAGvD,SAAS,yBAAyB;IAChC,IAAI;QACF,
|
|
1
|
+
{"version":3,"file":"Root.js","sourceRoot":"","sources":["../../src/views/Root.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAGvD,SAAS,yBAAyB;IAChC,IAAI;QACF,MAAM,EAAE,sBAAsB,EAAE,GAC9B,OAAO,CAAC,8BAA8B,CAAkD,CAAC;QAE3F,OAAO,SAAS,cAAc,CAAC,KAAU;YACvC,OAAO,oBAAC,sBAAsB,IAAC,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,KAAM,KAAK,GAAI,CAAC;QACnE,CAAC,CAAC;KACH;IAAC,MAAM;QACN,OAAO,KAAK,CAAC,QAAQ,CAAC;KACvB;AACH,CAAC;AAED,MAAM,sBAAsB,GAAG,yBAAyB,EAAE,CAAC;AAE3D,MAAM,UAAU,QAAQ,CAAC,EAAE,OAAO,EAA+B;IAC/D,OAAO,CACL,oBAAC,sBAAsB;QACrB,oBAAC,gBAAgB;YACf,oBAAC,gBAAgB,IAAC,OAAO,EAAE,OAAO,GAAI;YAEtC,oBAAC,SAAS,IAAC,KAAK,EAAC,MAAM,GAAG,CACT,CACI,CAC1B,CAAC;AACJ,CAAC","sourcesContent":["import { StatusBar } from \"expo-status-bar\";\nimport React from \"react\";\nimport { SafeAreaProvider } from \"react-native-safe-area-context\";\n\nimport { ContextNavigator } from \"../ContextNavigator\";\nimport { RequireContext } from \"../types\";\n\nfunction getGestureHandlerRootView() {\n try {\n const { GestureHandlerRootView } =\n require(\"react-native-gesture-handler\") as typeof import(\"react-native-gesture-handler\");\n\n return function GestureHandler(props: any) {\n return <GestureHandlerRootView style={{ flex: 1 }} {...props} />;\n };\n } catch {\n return React.Fragment;\n }\n}\n\nconst GestureHandlerRootView = getGestureHandlerRootView();\n\nexport function ExpoRoot({ context }: { context: RequireContext }) {\n return (\n <GestureHandlerRootView>\n <SafeAreaProvider>\n <ContextNavigator context={context} />\n {/* Users can override this by adding another StatusBar element anywhere higher in the component tree. */}\n <StatusBar style=\"auto\" />\n </SafeAreaProvider>\n </GestureHandlerRootView>\n );\n}\n"]}
|
package/drawer.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./build/layouts/Drawer";
|
package/drawer.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("./build/layouts/Drawer");
|
package/package.json
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-router",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.28",
|
|
4
4
|
"main": "build/index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"entry.js",
|
|
7
7
|
"build",
|
|
8
8
|
"babel.js",
|
|
9
|
-
"assets"
|
|
9
|
+
"assets",
|
|
10
|
+
"drawer.js",
|
|
11
|
+
"drawer.d.ts",
|
|
12
|
+
"stack.js",
|
|
13
|
+
"stack.d.ts",
|
|
14
|
+
"tabs.js",
|
|
15
|
+
"tabs.d.ts"
|
|
10
16
|
],
|
|
11
17
|
"repository": {
|
|
12
18
|
"url": "https://github.com/expo/router.git",
|
|
@@ -32,31 +38,46 @@
|
|
|
32
38
|
"peerDependencies": {
|
|
33
39
|
"expo": "^46.0.2",
|
|
34
40
|
"expo-splash-screen": "^0.16.2",
|
|
35
|
-
"metro": "~0.
|
|
36
|
-
"react-native-gesture-handler": "~2.5.0"
|
|
41
|
+
"metro": "~0.73.1",
|
|
42
|
+
"react-native-gesture-handler": "~2.5.0",
|
|
43
|
+
"react-native-reanimated": "~2.9.1",
|
|
44
|
+
"@react-navigation/drawer": "^6.4.4",
|
|
45
|
+
"react-native-safe-area-context": "4.3.1",
|
|
46
|
+
"react-native-screens": "~3.15.0"
|
|
47
|
+
},
|
|
48
|
+
"peerDependenciesMeta": {
|
|
49
|
+
"react-native-gesture-handler": {
|
|
50
|
+
"optional": true
|
|
51
|
+
},
|
|
52
|
+
"react-native-reanimated": {
|
|
53
|
+
"optional": true
|
|
54
|
+
},
|
|
55
|
+
"@react-navigation/drawer": {
|
|
56
|
+
"optional": true
|
|
57
|
+
}
|
|
37
58
|
},
|
|
38
59
|
"devDependencies": {
|
|
39
60
|
"@radix-ui/react-slot": "^1.0.0",
|
|
40
61
|
"@types/jest": "^26",
|
|
41
62
|
"expo-module-scripts": "^2.0.0",
|
|
42
63
|
"expo-splash-screen": "^0.16.2",
|
|
43
|
-
"jest": "^26.6.3"
|
|
64
|
+
"jest": "^26.6.3",
|
|
65
|
+
"react-native-safe-area-context": "4.3.1",
|
|
66
|
+
"react-native-screens": "~3.15.0",
|
|
67
|
+
"react-native-gesture-handler": "~2.5.0",
|
|
68
|
+
"react-native-reanimated": "~2.9.1",
|
|
69
|
+
"@react-navigation/drawer": "^6.4.4"
|
|
44
70
|
},
|
|
45
71
|
"dependencies": {
|
|
46
72
|
"@bacons/expo-metro-runtime": "^2.0.1",
|
|
47
73
|
"@bacons/react-views": "^1.1.3",
|
|
48
74
|
"@radix-ui/react-slot": "^1.0.0",
|
|
49
75
|
"@react-navigation/bottom-tabs": "^6.3.3",
|
|
50
|
-
"@react-navigation/drawer": "^6.4.4",
|
|
51
76
|
"@react-navigation/native": "^6.0.12",
|
|
52
77
|
"@react-navigation/native-stack": "^6.8.0",
|
|
53
78
|
"expo-constants": "~13.2.4",
|
|
54
79
|
"expo-linking": "^3.2.2",
|
|
55
80
|
"expo-splash-screen": "^0.16.2",
|
|
56
|
-
"expo-status-bar": "^1.4.0"
|
|
57
|
-
"react-native-gesture-handler": "~2.5.0",
|
|
58
|
-
"react-native-reanimated": "~2.9.1",
|
|
59
|
-
"react-native-safe-area-context": "4.3.1",
|
|
60
|
-
"react-native-screens": "~3.15.0"
|
|
81
|
+
"expo-status-bar": "^1.4.0"
|
|
61
82
|
}
|
|
62
83
|
}
|
package/stack.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./build/layouts/Stack";
|
package/stack.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("./build/layouts/Stack");
|
package/tabs.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./build/layouts/Tabs";
|
package/tabs.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("./build/layouts/Tabs");
|