-

{t('Setup')}

- {t('Get @crossed/styled set up, step by step')} - + + +

{t('Setup')}

+ + {t('Get @crossed/styled set up, step by step')} + + + + + web + + + react-native + + + + + + + + + webpack + + + next + + + + + +

{t('Install dependencies')}

- - - - pnpm - - - npm - - - yarn - - - - + + + + pnpm i @crossed/styled @crossed/webpack + + - pnpm i @crossed/styled react-native-unistyles + pnpm i @crossed/styled @crossed/next-adapter - - - - npm i @crossed/styled react-native-unistyles - - - - - yarn add @crossed/styled react-native-unistyles - - - - -
- -

{t('Configure')}

-

- - You should finish installation and configure react-native-unistyles, - click{' '} - - here - - -

- - - - - {t('Server side renderer')} - - - For add style on server side rendering, you should add registry - on server components (nextjs app router) - - - - - {` -import type { PropsWithChildren } from 'react'; -import { Registry } from '@crossed/styled'; + + + + pnpm i @crossed/styled + + -export default function RootLayout({ - children -}: PropsWithChildren) { - return ( - - - - {children} - - - - ); + + +

{t('Configure builder')}

+ + {` +const StylePlugin = require('@crossed/webpack'); + +module.exports = { + /** your webpack config **/ + plugins: [new StylePlugin({ configPath: './src/style.config.ts' })] +}; + `} + + + {` +const withCrossed = require('@crossed/next-adapter'); + + +const nextConfig = withCrossed({ + configPath: './src/style.config.ts', +})({ /** your next config here */ }); + +module.exports = nextConfig; + `} + +
+
+ +

{t('Init registry')}

+

{t('Create style.config.ts file')}

+ {` +import { Registry } from '@crossed/styled/registry'; +import { BasePlugin, type CrossedBasePlugin } from '@crossed/styled/plugins'; + +// add base plugin or add yours +Registry.addPlugin(BasePlugin); + +declare module '@crossed/styled' { + export interface StyleSheet extends CrossedBasePlugin {} } -`} - -
-
- -

{t('Usage')}

- - {` + `} + + + + + {t('And import this file only once in your entry file')} + + import "./style.config"; + + + {t('And import this file in your _app.tsx')} + import "./style.config"; + + + {t('Only for app Router')} + + {t( + 'You should import style.config on your _layout root file (for server component) and in your global client component (generaly theme context provider)' + )} + + + + + + + +

{t('Usage')}

+ + {` import { styled } from '@crossed/styled'; import { Text } from "react-native"; const TextStyled = styled(Text, { - color: "red" + base: { color: "red" } }); function App () { return Hello World!; } `} - -
-
+ +