Skip to content

Commit

Permalink
cleanup tamagui example
Browse files Browse the repository at this point in the history
  • Loading branch information
natew committed Jan 8, 2025
1 parent 2a553b4 commit 6c0560b
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 24 deletions.
4 changes: 2 additions & 2 deletions apps/onestack.dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"serve:railway": "one serve --host 0.0.0.0",
"subset-font-pn": "tsx ./helpers/subset-font.ts",
"test": "yarn test:dev && yarn test:prod",
"test:dev": "TEST_ONLY=dev vitest run --mode dev",
"test:prod": "TEST_ONLY=prod vitest run --mode prod"
"test:dev": "TEST_ONLY=dev yarn vitest run --mode dev",
"test:prod": "TEST_ONLY=prod yarn vitest run --mode prod"
},
"dependencies": {
"@docsearch/react": "^3.6.1",
Expand Down
32 changes: 13 additions & 19 deletions examples/one-tamagui/app/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import './_layout.css'
import '~/tamagui/tamagui.css'

import { SchemeProvider, useColorScheme } from '@vxrn/color-scheme'
import { SchemeProvider } from '@vxrn/color-scheme'
import { LoadProgressBar, Slot } from 'one'
import { isWeb, TamaguiProvider } from 'tamagui'
import config from '~/tamagui/tamagui.config'
import { isWeb, View } from 'tamagui'
import { TamaguiRootProvider } from '../src/tamagui/TamaguiRootProvider'

export default function Layout() {
return (
Expand All @@ -14,25 +14,19 @@ export default function Layout() {
<meta httpEquiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5" />
<link rel="icon" href="/favicon.svg" />

<title>👋</title>
</head>

<LoadProgressBar />
<body>
<LoadProgressBar />

<SchemeProvider>
<TamaguiRootProvider>
<Slot />
</TamaguiRootProvider>
</SchemeProvider>
<SchemeProvider>
<TamaguiRootProvider>
<Slot />
</TamaguiRootProvider>
</SchemeProvider>
</body>
</html>
)
}

const TamaguiRootProvider = ({ children }: { children: React.ReactNode }) => {
const [scheme] = useColorScheme()

return (
<TamaguiProvider disableInjectCSS config={config} defaultTheme={scheme} disableRootThemeClass>
{children}
</TamaguiProvider>
)
}
2 changes: 1 addition & 1 deletion examples/one-tamagui/routes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { OneRouter } from 'one'
declare module 'one' {
export namespace OneRouter {
export interface __routes<T extends string = string> extends Record<string, unknown> {
StaticRoutes: `/` | `/_sitemap`
StaticRoutes: `/` | `/TamaguiRootProvider` | `/_sitemap`
DynamicRoutes: never
DynamicRouteTemplate: never
IsTyped: true
Expand Down
13 changes: 13 additions & 0 deletions examples/one-tamagui/src/tamagui/TamaguiRootProvider.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { useColorScheme } from '@vxrn/color-scheme'
import { TamaguiProvider } from 'tamagui'
import config from './tamagui.config'

export const TamaguiRootProvider = ({ children }: { children: React.ReactNode }) => {
const [scheme] = useColorScheme()

return (
<TamaguiProvider disableInjectCSS config={config} defaultTheme={scheme} disableRootThemeClass>
{children}
</TamaguiProvider>
)
}
3 changes: 3 additions & 0 deletions next.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
1.0:

- root layout doesnt HMR
- hmr native tamagui example gives:
Error: [vite] cannot find entry point module 'virtual:one-entry'.
- react-native-safe-area-context
- were using Compat version from react-navigation seems to not work directly on web, need to fix/document
- restore GestureHandlerRootView
Expand Down
4 changes: 2 additions & 2 deletions tests/test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"private": true,
"type": "module",
"scripts": {
"test:dev": "TEST_ONLY=dev vitest --run --reporter=dot --color=false",
"test:prod": "TEST_ONLY=prod vitest --run --reporter=dot --color=false",
"test:dev": "TEST_ONLY=dev yarn vitest --run --reporter=dot --color=false",
"test:prod": "TEST_ONLY=prod yarn vitest --run --reporter=dot --color=false",
"test": "yarn test:dev && yarn test:prod",
"build:web": "one build",
"clean": "one clean",
Expand Down

0 comments on commit 6c0560b

Please sign in to comment.