Skip to content

Commit 67c7bac

Browse files
committed
add slug on dir test example
1 parent 9db46b4 commit 67c7bac

File tree

3 files changed

+36
-2
lines changed

3 files changed

+36
-2
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { useParams } from 'one'
2+
import { Text } from 'react-native'
3+
4+
export async function generateStaticParams() {
5+
return [
6+
{
7+
slugOnDir: 'foo',
8+
slugOnFile: 'bar',
9+
},
10+
]
11+
}
12+
13+
export default function DirectorySlugTest() {
14+
const params = useParams()
15+
16+
return <Text testID="params-json">{JSON.stringify(params)}</Text>
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { useParams } from 'one'
2+
import { Text } from 'react-native'
3+
4+
export async function generateStaticParams() {
5+
return [
6+
{
7+
slugOnDir: 'foo',
8+
slugOnFile: 'bar',
9+
},
10+
]
11+
}
12+
13+
export default function DirectorySlugTest() {
14+
const params = useParams()
15+
16+
return <Text testID="params-json">{JSON.stringify(params)}</Text>
17+
}

tests/test/routes.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ declare module 'one' {
77
export namespace OneRouter {
88
export interface __routes<T extends string = string> extends Record<string, unknown> {
99
StaticRoutes: `/` | `/(auth-guard)` | `/(auth-guard)/auth-guard` | `/(blog)` | `/(blog)/blog/my-first-post` | `/(marketing)/about` | `/(sub-page-group)` | `/(sub-page-group)/sub-page` | `/(sub-page-group)/sub-page/sub` | `/(sub-page-group)/sub-page/sub2` | `/_sitemap` | `/about` | `/auth-guard` | `/blog/my-first-post` | `/expo-video` | `/hooks` | `/hooks/contents` | `/hooks/contents/page-1` | `/hooks/contents/page-2` | `/loader` | `/loader/other` | `/middleware` | `/not-found/deep/test` | `/not-found/fallback/test` | `/not-found/test` | `/server-data` | `/sheet` | `/spa/spapage` | `/ssr/basic` | `/sub-page` | `/sub-page/sub` | `/sub-page/sub2` | `/web-extensions`
10-
DynamicRoutes: `/not-found/+not-found` | `/not-found/deep/+not-found` | `/routes/subpath/${string}` | `/spa/${OneRouter.SingleRoutePart<T>}` | `/ssr/${OneRouter.SingleRoutePart<T>}` | `/ssr/${string}`
11-
DynamicRouteTemplate: `/not-found/+not-found` | `/not-found/deep/+not-found` | `/routes/subpath/[...subpath]` | `/spa/[spaparams]` | `/ssr/[...rest]` | `/ssr/[param]`
10+
DynamicRoutes: `/not-found/+not-found` | `/not-found/deep/+not-found` | `/routes/directory-slug/${OneRouter.SingleRoutePart<T>}/${OneRouter.SingleRoutePart<T>}` | `/routes/directory-slug/${OneRouter.SingleRoutePart<T>}/subdir/${OneRouter.SingleRoutePart<T>}` | `/routes/subpath/${string}` | `/spa/${OneRouter.SingleRoutePart<T>}` | `/ssr/${OneRouter.SingleRoutePart<T>}` | `/ssr/${string}`
11+
DynamicRouteTemplate: `/not-found/+not-found` | `/not-found/deep/+not-found` | `/routes/directory-slug/[slugOnDir]/[slugOnFile]` | `/routes/directory-slug/[slugOnDir]/subdir/[slugOnFile]` | `/routes/subpath/[...subpath]` | `/spa/[spaparams]` | `/ssr/[...rest]` | `/ssr/[param]`
1212
IsTyped: true
1313
}
1414
}

0 commit comments

Comments
 (0)