init: 初始化模板项目

This commit is contained in:
2025-08-25 11:57:14 +08:00
commit aaa949bd7d
90 changed files with 20722 additions and 0 deletions

55
apps/next/pages/_app.tsx Normal file
View File

@@ -0,0 +1,55 @@
import '@tamagui/core/reset.css'
import '@tamagui/font-inter/css/400.css'
import '@tamagui/font-inter/css/700.css'
import 'raf/polyfill'
import type React from 'react'
import Head from 'next/head'
import type { SolitoAppProps } from 'solito'
import { NextTamaguiProvider } from 'app/provider/NextTamaguiProvider'
import { config } from '@my/ui'
if (process.env.NODE_ENV === 'production') {
require('../public/tamagui.css')
}
function MyApp({ Component, pageProps }: SolitoAppProps) {
return (
<>
<Head>
<title>Tamagui Pages Router</title>
<meta name="description" content="Tamagui, Solito, Expo & Next.js" />
<link rel="icon" href="/favicon.ico" />
<style
dangerouslySetInnerHTML={{
// the first time this runs you'll get the full CSS including all themes
// after that, it will only return CSS generated since the last call
__html: config.getNewCSS(),
}}
/>
<style
dangerouslySetInnerHTML={{
__html: config.getCSS({
// if you are using "outputCSS" option, you should use this "exclude"
// if not, then you can leave the option out
exclude: process.env.NODE_ENV === 'production' ? 'design-system' : null,
}),
}}
/>
<script
dangerouslySetInnerHTML={{
// avoid flash of animated things on enter:
__html: `document.documentElement.classList.add('t_unmounted')`,
}}
/>
</Head>
<NextTamaguiProvider>
<Component {...pageProps} />
</NextTamaguiProvider>
</>
)
}
export default MyApp

View File

@@ -0,0 +1,65 @@
import { Children } from 'react'
import { AppRegistry } from 'react-native'
import NextDocument, {
type DocumentContext,
type DocumentInitialProps,
Head,
Html,
Main,
NextScript,
} from 'next/document'
import { config } from '@my/ui'
export default class Document extends NextDocument {
static async getInitialProps(ctx: DocumentContext): Promise<DocumentInitialProps> {
AppRegistry.registerComponent('Main', () => Main)
const page = await ctx.renderPage()
// @ts-ignore
const { getStyleElement } = AppRegistry.getApplication('Main')
/**
* Note: be sure to keep tamagui styles after react-native-web styles like it is here!
* So Tamagui styles can override the react-native-web styles.
*/
const styles = [
getStyleElement(),
<style
key="tamagui-css"
dangerouslySetInnerHTML={{
__html: config.getCSS({
exclude: process.env.NODE_ENV === 'development' ? null : 'design-system',
}),
}}
/>,
<style
jsx
global
key="tamagui-css"
>{`
html {
font-family: 'Inter';
}
`}</style>,
]
return { ...page, styles: Children.toArray(styles) }
}
render() {
return (
<Html>
<Head>
<meta
httpEquiv="X-UA-Compatible"
content="IE=edge"
/>
</Head>
<body>
<Main />
<NextScript />
</body>
</Html>
)
}
}

View File

@@ -0,0 +1,17 @@
import { UserDetailScreen } from 'app/features/user/detail-screen'
import Head from 'next/head'
import { createParam } from 'solito'
const { useParam } = createParam<{ id: string }>()
export default function Page() {
const [id] = useParam('id') as unknown as string
return (
<>
<Head>
<title>User</title>
</Head>
<UserDetailScreen id={id} />
</>
)
}

View File

@@ -0,0 +1,5 @@
import { HomeScreen } from 'app/features/home/screen'
export default function Page() {
return <HomeScreen pagesMode={true} />
}