one 1.24.5 → 1.24.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/fork/useLinking.cjs +3 -2
- package/dist/cjs/router/conditionalSlotPathname.test.cjs +137 -0
- package/dist/cjs/router/conditionalSlotPathname.test.native.js +193 -0
- package/dist/cjs/router/conditionalSlotPathname.test.native.js.map +1 -0
- package/dist/cjs/router/isStateAwaitingNavigatorMount.cjs +48 -0
- package/dist/cjs/router/isStateAwaitingNavigatorMount.native.js +71 -0
- package/dist/cjs/router/isStateAwaitingNavigatorMount.native.js.map +1 -0
- package/dist/cjs/router/router.cjs +5 -0
- package/dist/cjs/router/router.native.js +5 -0
- package/dist/cjs/router/router.native.js.map +1 -1
- package/dist/cjs/views/RootErrorBoundary.cjs +14 -12
- package/dist/cjs/views/RootErrorBoundary.native.js.map +1 -1
- package/dist/esm/fork/useLinking.mjs +4 -3
- package/dist/esm/fork/useLinking.mjs.map +1 -1
- package/dist/esm/router/conditionalSlotPathname.test.mjs +114 -0
- package/dist/esm/router/conditionalSlotPathname.test.mjs.map +1 -0
- package/dist/esm/router/conditionalSlotPathname.test.native.js +167 -0
- package/dist/esm/router/conditionalSlotPathname.test.native.js.map +1 -0
- package/dist/esm/router/isStateAwaitingNavigatorMount.mjs +23 -0
- package/dist/esm/router/isStateAwaitingNavigatorMount.mjs.map +1 -0
- package/dist/esm/router/isStateAwaitingNavigatorMount.native.js +43 -0
- package/dist/esm/router/isStateAwaitingNavigatorMount.native.js.map +1 -0
- package/dist/esm/router/router.mjs +5 -0
- package/dist/esm/router/router.mjs.map +1 -1
- package/dist/esm/router/router.native.js +5 -0
- package/dist/esm/router/router.native.js.map +1 -1
- package/dist/esm/views/RootErrorBoundary.mjs +14 -12
- package/dist/esm/views/RootErrorBoundary.mjs.map +1 -1
- package/dist/esm/views/RootErrorBoundary.native.js.map +1 -1
- package/package.json +9 -9
- package/src/fork/useLinking.ts +13 -12
- package/src/router/conditionalSlotPathname.test.tsx +147 -0
- package/src/router/isStateAwaitingNavigatorMount.ts +64 -0
- package/src/router/router.ts +13 -0
- package/src/views/RootErrorBoundary.web.tsx +18 -13
- package/types/fork/useLinking.d.ts.map +1 -1
- package/types/layouts/Drawer.d.ts +50 -50
- package/types/layouts/Stack.d.ts +42 -42
- package/types/layouts/Tabs.d.ts +42 -42
- package/types/router/conditionalSlotPathname.test.d.ts +2 -0
- package/types/router/conditionalSlotPathname.test.d.ts.map +1 -0
- package/types/router/isStateAwaitingNavigatorMount.d.ts +28 -0
- package/types/router/isStateAwaitingNavigatorMount.d.ts.map +1 -0
- package/types/router/router.d.ts.map +1 -1
- package/types/ui/TabContext.d.ts +6 -6
- package/types/ui/TabContext.d.ts.map +1 -1
- package/types/ui/Tabs.shared.d.ts +12 -12
- package/types/views/RootErrorBoundary.web.d.ts.map +1 -1
package/src/fork/useLinking.ts
CHANGED
|
@@ -35,7 +35,9 @@ import {
|
|
|
35
35
|
import {
|
|
36
36
|
consumePendingNavigationAction,
|
|
37
37
|
rootState as routerRootState,
|
|
38
|
+
routeNode,
|
|
38
39
|
} from '../router/router'
|
|
40
|
+
import { isStateAwaitingNavigatorMount } from '../router/isStateAwaitingNavigatorMount'
|
|
39
41
|
import { ServerLocationContext } from '../router/serverLocationContext'
|
|
40
42
|
import { clearAllSlotStates } from '../views/Navigator'
|
|
41
43
|
import { createMemoryHistory } from './createMemoryHistory'
|
|
@@ -626,20 +628,19 @@ export function useLinking(
|
|
|
626
628
|
const pendingPath = pendingPopStatePathRef.current
|
|
627
629
|
const route = findFocusedRoute(state)
|
|
628
630
|
|
|
629
|
-
// guard:
|
|
630
|
-
// mounted
|
|
631
|
-
// (
|
|
632
|
-
//
|
|
633
|
-
// from
|
|
634
|
-
//
|
|
635
|
-
//
|
|
636
|
-
|
|
637
|
-
if (route && /^\(.*\)$/.test(route.name)) {
|
|
631
|
+
// @modified - guard: the container state only carries the navigators that
|
|
632
|
+
// are mounted, so a layout that renders anything other than its <Slot />
|
|
633
|
+
// (late mount during hydration, an auth gate, a loading state) makes
|
|
634
|
+
// react-navigation publish a state truncated at that layout. computing a
|
|
635
|
+
// path from it picks the first child alphabetically (e.g. /deploy) instead
|
|
636
|
+
// of the route the URL names. same predicate router.updateState uses, so
|
|
637
|
+
// the URL and usePathname() cannot disagree about it.
|
|
638
|
+
if (isStateAwaitingNavigatorMount(state, routeNode)) {
|
|
638
639
|
if (process.env.ONE_DEBUG_ROUTER) {
|
|
639
640
|
console.info(
|
|
640
|
-
`[one] 📜 onStateChange - skipping:
|
|
641
|
-
route
|
|
642
|
-
`
|
|
641
|
+
`[one] 📜 onStateChange - skipping: navigator below`,
|
|
642
|
+
route?.name,
|
|
643
|
+
`has not mounted`
|
|
643
644
|
)
|
|
644
645
|
}
|
|
645
646
|
return
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import TestRenderer, { act } from 'react-test-renderer'
|
|
3
|
+
import { describe, expect, it } from 'vitest'
|
|
4
|
+
import { usePathname } from '../hooks'
|
|
5
|
+
import { Root } from '../Root'
|
|
6
|
+
import { Slot } from '../views/Navigator'
|
|
7
|
+
|
|
8
|
+
// react-test-renderer needs both of these; neither exists in a bare node env
|
|
9
|
+
;(globalThis as any).IS_REACT_ACT_ENVIRONMENT = true
|
|
10
|
+
;(globalThis as any).requestAnimationFrame ??= (cb: any) => setTimeout(() => cb(0), 0)
|
|
11
|
+
;(globalThis as any).cancelAnimationFrame ??= (id: any) => clearTimeout(id)
|
|
12
|
+
|
|
13
|
+
const routerRoot = 'app'
|
|
14
|
+
|
|
15
|
+
// route modules are passed as objects rather than importers so the route context
|
|
16
|
+
// resolves them synchronously; bumping the version makes Root build a fresh
|
|
17
|
+
// route tree per test instead of reusing the module-level cache
|
|
18
|
+
function makeRoutes(modules: Record<string, { default: React.ComponentType<any> }>) {
|
|
19
|
+
globalThis['__vxrnVersion'] = ((globalThis['__vxrnVersion'] as number) ?? 0) + 1
|
|
20
|
+
const routes: Record<string, unknown> = {}
|
|
21
|
+
for (const [file, module] of Object.entries(modules)) {
|
|
22
|
+
routes[`/${routerRoot}/${file}`] = module
|
|
23
|
+
}
|
|
24
|
+
return routes as any
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const slotLayout = { default: () => <Slot /> }
|
|
28
|
+
const leaf = (label: string) => ({ default: () => label })
|
|
29
|
+
|
|
30
|
+
// `/project/:projectId/:sessionId` lives four navigators below the root, under a
|
|
31
|
+
// route group, so a gate on the group's layout leaves three of them unmounted
|
|
32
|
+
function routeTreeWithGate(gate: React.ComponentType<{ children: React.ReactNode }>) {
|
|
33
|
+
const Gate = gate
|
|
34
|
+
return makeRoutes({
|
|
35
|
+
'_layout.tsx': slotLayout,
|
|
36
|
+
'(app)/_layout.tsx': {
|
|
37
|
+
default: () => (
|
|
38
|
+
<Gate>
|
|
39
|
+
<Slot />
|
|
40
|
+
</Gate>
|
|
41
|
+
),
|
|
42
|
+
},
|
|
43
|
+
'(app)/index.tsx': leaf('app-index'),
|
|
44
|
+
'(app)/project/_layout.tsx': slotLayout,
|
|
45
|
+
'(app)/project/[projectId]/_layout.tsx': slotLayout,
|
|
46
|
+
'(app)/project/[projectId]/[sessionId]/_layout.tsx': slotLayout,
|
|
47
|
+
'(app)/project/[projectId]/[sessionId]/index.tsx': leaf('session'),
|
|
48
|
+
'(site)/_layout.tsx': slotLayout,
|
|
49
|
+
'(site)/pricing.tsx': leaf('pricing'),
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function renderAt(path: string, routes: any) {
|
|
54
|
+
let renderer: TestRenderer.ReactTestRenderer
|
|
55
|
+
act(() => {
|
|
56
|
+
renderer = TestRenderer.create(
|
|
57
|
+
<Root path={path} routes={routes} routerRoot={routerRoot} isClient={false} />
|
|
58
|
+
)
|
|
59
|
+
})
|
|
60
|
+
return renderer!
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function bodyText(renderer: TestRenderer.ReactTestRenderer) {
|
|
64
|
+
const collect = (node: any): string =>
|
|
65
|
+
typeof node === 'string'
|
|
66
|
+
? node
|
|
67
|
+
: Array.isArray(node)
|
|
68
|
+
? node.map(collect).join('')
|
|
69
|
+
: node
|
|
70
|
+
? collect(node.children ?? [])
|
|
71
|
+
: ''
|
|
72
|
+
return collect(renderer.toJSON())
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
describe('a layout that renders something other than its <Slot />', () => {
|
|
76
|
+
it('does not move the pathname while the URL stands still', () => {
|
|
77
|
+
const pathnames: string[] = []
|
|
78
|
+
let setBlocked: ((blocked: boolean) => void) | undefined
|
|
79
|
+
|
|
80
|
+
function Probe() {
|
|
81
|
+
const pathname = usePathname()
|
|
82
|
+
if (pathnames[pathnames.length - 1] !== pathname) pathnames.push(pathname)
|
|
83
|
+
return null
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function Gate({ children }: { children: React.ReactNode }) {
|
|
87
|
+
const [blocked, set] = React.useState(true)
|
|
88
|
+
setBlocked = set
|
|
89
|
+
return (
|
|
90
|
+
<>
|
|
91
|
+
<Probe />
|
|
92
|
+
{blocked ? 'placeholder' : children}
|
|
93
|
+
</>
|
|
94
|
+
)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const renderer = renderAt('/project/p1/main', routeTreeWithGate(Gate))
|
|
98
|
+
|
|
99
|
+
// the gate starts blocked, so the three navigators below it never mounted
|
|
100
|
+
expect(bodyText(renderer)).toBe('placeholder')
|
|
101
|
+
|
|
102
|
+
act(() => setBlocked!(false))
|
|
103
|
+
expect(bodyText(renderer)).toBe('session')
|
|
104
|
+
|
|
105
|
+
act(() => setBlocked!(true))
|
|
106
|
+
expect(bodyText(renderer)).toBe('placeholder')
|
|
107
|
+
|
|
108
|
+
act(() => setBlocked!(false))
|
|
109
|
+
|
|
110
|
+
// the address bar never moved, so neither may usePathname(). unmounting the
|
|
111
|
+
// navigators used to collapse it to '/', which is a route the app is not on
|
|
112
|
+
expect(pathnames).toEqual(['/project/p1/main'])
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
it('settles when the gate itself reads the pathname', async () => {
|
|
116
|
+
// an access gate that blocks project routes once a check says the route is
|
|
117
|
+
// not proven yet — the shape that turned the collapse into an unbounded
|
|
118
|
+
// loop, because blocking changed the very pathname the gate decides from
|
|
119
|
+
let renders = 0
|
|
120
|
+
let requestBlock: (() => void) | undefined
|
|
121
|
+
|
|
122
|
+
function Gate({ children }: { children: React.ReactNode }) {
|
|
123
|
+
const pathname = usePathname()
|
|
124
|
+
const [blockRequested, setBlockRequested] = React.useState(false)
|
|
125
|
+
requestBlock = () => setBlockRequested(true)
|
|
126
|
+
renders++
|
|
127
|
+
if (renders > 100) {
|
|
128
|
+
throw new Error(`gate rendered ${renders} times without settling`)
|
|
129
|
+
}
|
|
130
|
+
const blocked = blockRequested && pathname.startsWith('/project/')
|
|
131
|
+
return <>{blocked ? 'blocked' : children}</>
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const renderer = renderAt('/project/p1/main', routeTreeWithGate(Gate))
|
|
135
|
+
await act(async () => {})
|
|
136
|
+
expect(bodyText(renderer)).toBe('session')
|
|
137
|
+
|
|
138
|
+
await act(async () => requestBlock!())
|
|
139
|
+
await act(async () => {})
|
|
140
|
+
|
|
141
|
+
// blocking unmounts the navigators below, which must not report a pathname
|
|
142
|
+
// the gate reads as a different route — that flips the gate back open, which
|
|
143
|
+
// remounts them, which reports the project route again, forever
|
|
144
|
+
expect(bodyText(renderer)).toBe('blocked')
|
|
145
|
+
expect(renders).toBeLessThan(20)
|
|
146
|
+
})
|
|
147
|
+
})
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { OneRouter } from '../interfaces/router'
|
|
2
|
+
import type { RouteNode } from './Route'
|
|
3
|
+
|
|
4
|
+
type PartialState = {
|
|
5
|
+
index?: number
|
|
6
|
+
routes: Array<{ name: string; state?: PartialState }>
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// the same focus rule getPathFromState walks, so the predicate agrees with the
|
|
10
|
+
// pathname that state would serialize to
|
|
11
|
+
function focusedRouteOf(state: PartialState) {
|
|
12
|
+
return typeof state.index === 'number'
|
|
13
|
+
? state.routes[state.index]
|
|
14
|
+
: state.routes[state.routes.length - 1]
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* True when `state` stops short of the route the URL names because the
|
|
19
|
+
* navigator that owns the rest of it is not mounted.
|
|
20
|
+
*
|
|
21
|
+
* React Navigation rebuilds the container state from the navigators that are
|
|
22
|
+
* mounted right now: `useOnGetState` asks each one for its state and a route
|
|
23
|
+
* whose navigator is absent gets `state: undefined`. So a layout that renders
|
|
24
|
+
* anything other than its `<Slot />` — an auth gate, a loading state, an access
|
|
25
|
+
* check, a late mount during hydration — makes the container publish a state
|
|
26
|
+
* that is a TRUNCATION of the real location. Serializing that gives a pathname
|
|
27
|
+
* the app is not on: `/project/x/main` reads as `/`.
|
|
28
|
+
*
|
|
29
|
+
* The URL did not change, only the tree did, so nothing derived from the URL
|
|
30
|
+
* may move. A consumer that acts on the truncated pathname and in turn decides
|
|
31
|
+
* whether to render the routed subtree oscillates forever.
|
|
32
|
+
*/
|
|
33
|
+
export function isStateAwaitingNavigatorMount(
|
|
34
|
+
state: OneRouter.ResultState | PartialState | undefined,
|
|
35
|
+
rootNode: RouteNode | null
|
|
36
|
+
): boolean {
|
|
37
|
+
if (!rootNode) return false
|
|
38
|
+
|
|
39
|
+
let node = rootNode
|
|
40
|
+
let current = state as PartialState | undefined
|
|
41
|
+
|
|
42
|
+
while (current?.routes?.length) {
|
|
43
|
+
const route = focusedRouteOf(current)
|
|
44
|
+
if (!route) return false
|
|
45
|
+
|
|
46
|
+
// direct children only: a directory with no `_layout` is flattened into the
|
|
47
|
+
// parent navigator under a multi-segment route name, and that name is what
|
|
48
|
+
// the state carries, so a recursive search would match the wrong depth
|
|
49
|
+
const child = node.children.find((candidate) => candidate.route === route.name)
|
|
50
|
+
if (!child) return false
|
|
51
|
+
|
|
52
|
+
if (route.state) {
|
|
53
|
+
node = child
|
|
54
|
+
current = route.state
|
|
55
|
+
continue
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// deepest route this state carries. if the route tree says it still has
|
|
59
|
+
// child routes to render, its navigator has not mounted yet
|
|
60
|
+
return child.children.some((grandchild) => !grandchild.internal)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return false
|
|
64
|
+
}
|
package/src/router/router.ts
CHANGED
|
@@ -44,6 +44,7 @@ import {
|
|
|
44
44
|
} from './findRouteNode'
|
|
45
45
|
import type { UrlObject } from './getNormalizedStatePath'
|
|
46
46
|
import { getRouteInfo } from './getRouteInfo'
|
|
47
|
+
import { isStateAwaitingNavigatorMount } from './isStateAwaitingNavigatorMount'
|
|
47
48
|
import { getRouteArtifactPaths } from './getRouteArtifactPath'
|
|
48
49
|
import { getRoutes } from './getRoutes'
|
|
49
50
|
import { setLastAction } from './lastAction'
|
|
@@ -496,6 +497,18 @@ export function updateState(state: OneRouter.ResultState, nextStateParam = state
|
|
|
496
497
|
rootState = state
|
|
497
498
|
nextState = nextStateParam
|
|
498
499
|
|
|
500
|
+
// a layout that renders anything other than its <Slot /> leaves the navigator
|
|
501
|
+
// below it unmounted, and react-navigation then publishes a state truncated at
|
|
502
|
+
// that layout. the URL is unchanged, so route info must not move: serializing
|
|
503
|
+
// the truncation reports `/` for `/project/x/main`, and a layout whose gate
|
|
504
|
+
// reads the pathname then flips on its own report, forever.
|
|
505
|
+
if (isStateAwaitingNavigatorMount(state, routeNode)) {
|
|
506
|
+
if (process.env.ONE_DEBUG_ROUTER) {
|
|
507
|
+
console.info(`[one] 🧭 keeping ${routeInfo?.pathname}: a navigator has not mounted`)
|
|
508
|
+
}
|
|
509
|
+
return
|
|
510
|
+
}
|
|
511
|
+
|
|
499
512
|
const nextRouteInfo = getRouteInfo(state)
|
|
500
513
|
if (pendingNavigationPathname === nextRouteInfo.pathname) {
|
|
501
514
|
pendingNavigationPathname = undefined
|
|
@@ -40,20 +40,25 @@ export class RootErrorBoundary extends React.Component<
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
window
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
// this boundary also runs during SSR of a web build, where `window` doesn't
|
|
44
|
+
// exist. dispatching unconditionally threw here and replaced the render
|
|
45
|
+
// error above with `window is not defined`.
|
|
46
|
+
if (typeof window !== 'undefined') {
|
|
47
|
+
window.dispatchEvent(
|
|
48
|
+
new CustomEvent('one-error', {
|
|
49
|
+
detail: {
|
|
50
|
+
error: {
|
|
51
|
+
message: error.message,
|
|
52
|
+
stack: error.stack,
|
|
53
|
+
name: error.name,
|
|
54
|
+
},
|
|
55
|
+
componentStack: info.componentStack,
|
|
56
|
+
timestamp: Date.now(),
|
|
57
|
+
type: 'render',
|
|
50
58
|
},
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
},
|
|
55
|
-
})
|
|
56
|
-
)
|
|
59
|
+
})
|
|
60
|
+
)
|
|
61
|
+
}
|
|
57
62
|
}
|
|
58
63
|
|
|
59
64
|
handleRetry = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLinking.d.ts","sourceRoot":"","sources":["../../src/fork/useLinking.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAML,KAAK,sBAAsB,EAE3B,KAAK,aAAa,EAEnB,MAAM,wBAAwB,CAAA;AAE/B,OAAO,EAAE,gBAAgB,IAAI,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAEhF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAE9D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"useLinking.d.ts","sourceRoot":"","sources":["../../src/fork/useLinking.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAML,KAAK,sBAAsB,EAE3B,KAAK,aAAa,EAEnB,MAAM,wBAAwB,CAAA;AAE/B,OAAO,EAAE,gBAAgB,IAAI,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAEhF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAE9D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAqB9B,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAkG7D;;GAEG;AACH,eAAO,MAAM,MAAM,GAAI,IAAI,MAAM,OAAO,CAAC,IAAI,CAAC,eAO7C,CAAA;AAID,KAAK,OAAO,GAAG,cAAc,CAAC,aAAa,CAAC,CAAA;AAE5C,wBAAgB,UAAU,CACxB,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,sBAAsB,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,EAClE,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;2BAe5D,WAAW,CAAC,WAAW,GAAG,SAAS,CAAC;EA2mB9C"}
|
|
@@ -5,42 +5,42 @@ export declare const Drawer: React.ForwardRefExoticComponent<Omit<Omit<Omit<impo
|
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
layout?: ((props: {
|
|
7
7
|
state: DrawerNavigationState<ParamListBase>;
|
|
8
|
-
navigation: import("@react-navigation/
|
|
9
|
-
descriptors: Record<string, import("@react-navigation/
|
|
8
|
+
navigation: import("@react-navigation/core").NavigationHelpers<ParamListBase, {}>;
|
|
9
|
+
descriptors: Record<string, import("@react-navigation/core").Descriptor<DrawerNavigationOptions, import("@react-navigation/core").NavigationProp<ParamListBase, string, string | undefined, DrawerNavigationState<ParamListBase>, DrawerNavigationOptions, DrawerNavigationEventMap>, import("@react-navigation/core").RouteProp<ParamListBase, string>>>;
|
|
10
10
|
children: React.ReactNode;
|
|
11
11
|
}) => React.ReactElement) | undefined;
|
|
12
12
|
screenListeners?: Partial<{
|
|
13
|
-
drawerItemPress: import("@react-navigation/
|
|
14
|
-
transitionStart: import("@react-navigation/
|
|
15
|
-
transitionEnd: import("@react-navigation/
|
|
16
|
-
gestureStart: import("@react-navigation/
|
|
17
|
-
gestureEnd: import("@react-navigation/
|
|
18
|
-
gestureCancel: import("@react-navigation/
|
|
19
|
-
focus: import("@react-navigation/
|
|
20
|
-
blur: import("@react-navigation/
|
|
21
|
-
state: import("@react-navigation/
|
|
22
|
-
beforeRemove: import("@react-navigation/
|
|
13
|
+
drawerItemPress: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "drawerItemPress", true>;
|
|
14
|
+
transitionStart: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "transitionStart", unknown>;
|
|
15
|
+
transitionEnd: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "transitionEnd", unknown>;
|
|
16
|
+
gestureStart: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "gestureStart", unknown>;
|
|
17
|
+
gestureEnd: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "gestureEnd", unknown>;
|
|
18
|
+
gestureCancel: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "gestureCancel", unknown>;
|
|
19
|
+
focus: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "focus", unknown>;
|
|
20
|
+
blur: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "blur", unknown>;
|
|
21
|
+
state: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "state", unknown>;
|
|
22
|
+
beforeRemove: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "beforeRemove", true>;
|
|
23
23
|
}> | ((props: {
|
|
24
|
-
route: import("@react-navigation/
|
|
24
|
+
route: import("@react-navigation/core").RouteProp<ParamListBase, string>;
|
|
25
25
|
navigation: import("@react-navigation/drawer").DrawerNavigationProp<ParamListBase, string, string | undefined>;
|
|
26
26
|
}) => Partial<{
|
|
27
|
-
drawerItemPress: import("@react-navigation/
|
|
28
|
-
transitionStart: import("@react-navigation/
|
|
29
|
-
transitionEnd: import("@react-navigation/
|
|
30
|
-
gestureStart: import("@react-navigation/
|
|
31
|
-
gestureEnd: import("@react-navigation/
|
|
32
|
-
gestureCancel: import("@react-navigation/
|
|
33
|
-
focus: import("@react-navigation/
|
|
34
|
-
blur: import("@react-navigation/
|
|
35
|
-
state: import("@react-navigation/
|
|
36
|
-
beforeRemove: import("@react-navigation/
|
|
27
|
+
drawerItemPress: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "drawerItemPress", true>;
|
|
28
|
+
transitionStart: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "transitionStart", unknown>;
|
|
29
|
+
transitionEnd: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "transitionEnd", unknown>;
|
|
30
|
+
gestureStart: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "gestureStart", unknown>;
|
|
31
|
+
gestureEnd: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "gestureEnd", unknown>;
|
|
32
|
+
gestureCancel: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "gestureCancel", unknown>;
|
|
33
|
+
focus: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "focus", unknown>;
|
|
34
|
+
blur: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "blur", unknown>;
|
|
35
|
+
state: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "state", unknown>;
|
|
36
|
+
beforeRemove: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "beforeRemove", true>;
|
|
37
37
|
}>) | undefined;
|
|
38
38
|
screenOptions?: DrawerNavigationOptions | ((props: {
|
|
39
|
-
route: import("@react-navigation/
|
|
39
|
+
route: import("@react-navigation/core").RouteProp<ParamListBase, string>;
|
|
40
40
|
navigation: import("@react-navigation/drawer").DrawerNavigationProp<ParamListBase, string, string | undefined>;
|
|
41
41
|
theme: ReactNavigation.Theme;
|
|
42
42
|
}) => DrawerNavigationOptions) | undefined;
|
|
43
|
-
screenLayout?: ((props: import("@react-navigation/
|
|
43
|
+
screenLayout?: ((props: import("@react-navigation/core").ScreenLayoutArgs<ParamListBase, string, DrawerNavigationOptions, import("@react-navigation/drawer").DrawerNavigationProp<ParamListBase, string, string | undefined>>) => React.ReactElement) | undefined;
|
|
44
44
|
UNSTABLE_router?: (<Action extends Readonly<{
|
|
45
45
|
type: string;
|
|
46
46
|
payload?: object;
|
|
@@ -56,42 +56,42 @@ export declare const Drawer: React.ForwardRefExoticComponent<Omit<Omit<Omit<impo
|
|
|
56
56
|
children: React.ReactNode;
|
|
57
57
|
layout?: ((props: {
|
|
58
58
|
state: DrawerNavigationState<ParamListBase>;
|
|
59
|
-
navigation: import("@react-navigation/
|
|
60
|
-
descriptors: Record<string, import("@react-navigation/
|
|
59
|
+
navigation: import("@react-navigation/core").NavigationHelpers<ParamListBase, {}>;
|
|
60
|
+
descriptors: Record<string, import("@react-navigation/core").Descriptor<DrawerNavigationOptions, import("@react-navigation/core").NavigationProp<ParamListBase, string, string | undefined, DrawerNavigationState<ParamListBase>, DrawerNavigationOptions, DrawerNavigationEventMap>, import("@react-navigation/core").RouteProp<ParamListBase, string>>>;
|
|
61
61
|
children: React.ReactNode;
|
|
62
62
|
}) => React.ReactElement) | undefined;
|
|
63
63
|
screenListeners?: Partial<{
|
|
64
|
-
drawerItemPress: import("@react-navigation/
|
|
65
|
-
transitionStart: import("@react-navigation/
|
|
66
|
-
transitionEnd: import("@react-navigation/
|
|
67
|
-
gestureStart: import("@react-navigation/
|
|
68
|
-
gestureEnd: import("@react-navigation/
|
|
69
|
-
gestureCancel: import("@react-navigation/
|
|
70
|
-
focus: import("@react-navigation/
|
|
71
|
-
blur: import("@react-navigation/
|
|
72
|
-
state: import("@react-navigation/
|
|
73
|
-
beforeRemove: import("@react-navigation/
|
|
64
|
+
drawerItemPress: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "drawerItemPress", true>;
|
|
65
|
+
transitionStart: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "transitionStart", unknown>;
|
|
66
|
+
transitionEnd: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "transitionEnd", unknown>;
|
|
67
|
+
gestureStart: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "gestureStart", unknown>;
|
|
68
|
+
gestureEnd: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "gestureEnd", unknown>;
|
|
69
|
+
gestureCancel: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "gestureCancel", unknown>;
|
|
70
|
+
focus: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "focus", unknown>;
|
|
71
|
+
blur: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "blur", unknown>;
|
|
72
|
+
state: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "state", unknown>;
|
|
73
|
+
beforeRemove: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "beforeRemove", true>;
|
|
74
74
|
}> | ((props: {
|
|
75
|
-
route: import("@react-navigation/
|
|
75
|
+
route: import("@react-navigation/core").RouteProp<ParamListBase, string>;
|
|
76
76
|
navigation: import("@react-navigation/drawer").DrawerNavigationProp<ParamListBase, string, string | undefined>;
|
|
77
77
|
}) => Partial<{
|
|
78
|
-
drawerItemPress: import("@react-navigation/
|
|
79
|
-
transitionStart: import("@react-navigation/
|
|
80
|
-
transitionEnd: import("@react-navigation/
|
|
81
|
-
gestureStart: import("@react-navigation/
|
|
82
|
-
gestureEnd: import("@react-navigation/
|
|
83
|
-
gestureCancel: import("@react-navigation/
|
|
84
|
-
focus: import("@react-navigation/
|
|
85
|
-
blur: import("@react-navigation/
|
|
86
|
-
state: import("@react-navigation/
|
|
87
|
-
beforeRemove: import("@react-navigation/
|
|
78
|
+
drawerItemPress: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "drawerItemPress", true>;
|
|
79
|
+
transitionStart: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "transitionStart", unknown>;
|
|
80
|
+
transitionEnd: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "transitionEnd", unknown>;
|
|
81
|
+
gestureStart: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "gestureStart", unknown>;
|
|
82
|
+
gestureEnd: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "gestureEnd", unknown>;
|
|
83
|
+
gestureCancel: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "gestureCancel", unknown>;
|
|
84
|
+
focus: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "focus", unknown>;
|
|
85
|
+
blur: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "blur", unknown>;
|
|
86
|
+
state: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "state", unknown>;
|
|
87
|
+
beforeRemove: import("@react-navigation/core").EventListenerCallback<DrawerNavigationEventMap & import("@react-navigation/core").EventMapCore<DrawerNavigationState<ParamListBase>>, "beforeRemove", true>;
|
|
88
88
|
}>) | undefined;
|
|
89
89
|
screenOptions?: DrawerNavigationOptions | ((props: {
|
|
90
|
-
route: import("@react-navigation/
|
|
90
|
+
route: import("@react-navigation/core").RouteProp<ParamListBase, string>;
|
|
91
91
|
navigation: import("@react-navigation/drawer").DrawerNavigationProp<ParamListBase, string, string | undefined>;
|
|
92
92
|
theme: ReactNavigation.Theme;
|
|
93
93
|
}) => DrawerNavigationOptions) | undefined;
|
|
94
|
-
screenLayout?: ((props: import("@react-navigation/
|
|
94
|
+
screenLayout?: ((props: import("@react-navigation/core").ScreenLayoutArgs<ParamListBase, string, DrawerNavigationOptions, import("@react-navigation/drawer").DrawerNavigationProp<ParamListBase, string, string | undefined>>) => React.ReactElement) | undefined;
|
|
95
95
|
UNSTABLE_router?: (<Action extends Readonly<{
|
|
96
96
|
type: string;
|
|
97
97
|
payload?: object;
|