diff --git a/examples/expo-example/src/common.tsx b/examples/expo-example/src/common.tsx index 6c00755..750305e 100644 --- a/examples/expo-example/src/common.tsx +++ b/examples/expo-example/src/common.tsx @@ -4,20 +4,23 @@ // import { px, useYoshiki } from "yoshiki"; -import { P } from "./components/text"; +import { P } from "./components/text/text"; +import { Div } from "./components/div"; export const Card = () => { const { css } = useYoshiki(); return ( -

- Test -

+
+

+ Test +

+
); }; diff --git a/examples/expo-example/src/components/div.tsx b/examples/expo-example/src/components/div.tsx new file mode 100644 index 0000000..19e965a --- /dev/null +++ b/examples/expo-example/src/components/div.tsx @@ -0,0 +1,19 @@ +// +// Copyright (c) Zoe Roux and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for details. +// + +import { splitRender } from "yoshiki"; +import { View } from "react-native"; +import { ReactNode } from "react"; + +export const Div = splitRender( + function _DivWeb(props, ref) { + console.log(props); + return
; + }, + function _DivNat(props, ref) { + console.log(props) + return ; + }, +); diff --git a/examples/expo-example/src/components/text.d.ts b/examples/expo-example/src/components/text/text.d.ts similarity index 100% rename from examples/expo-example/src/components/text.d.ts rename to examples/expo-example/src/components/text/text.d.ts diff --git a/examples/expo-example/src/components/text.native.tsx b/examples/expo-example/src/components/text/text.native.tsx similarity index 100% rename from examples/expo-example/src/components/text.native.tsx rename to examples/expo-example/src/components/text/text.native.tsx diff --git a/examples/expo-example/src/components/text.web.tsx b/examples/expo-example/src/components/text/text.web.tsx similarity index 100% rename from examples/expo-example/src/components/text.web.tsx rename to examples/expo-example/src/components/text/text.web.tsx diff --git a/packages/yoshiki/src/index.ts b/packages/yoshiki/src/index.ts index c6ab52c..a9bc70e 100644 --- a/packages/yoshiki/src/index.ts +++ b/packages/yoshiki/src/index.ts @@ -5,11 +5,14 @@ import { useYoshiki as useWebYoshiki, + splitRender as webSplitRender, Platform, type Stylable as WebStylable, type StylableHoverable as WebStylableHoverable, type YsWeb, } from "./web"; +import * as Web from "./web/units"; + import type { Stylable as NativeStylable, StylableHoverable as NativeStylableHoverable, @@ -19,11 +22,12 @@ import type { import type { YsStyleProps } from "./native/generator"; import type { Theme } from "./theme"; import type { WithState, EnhancedStyle, Length } from "./type"; +import { ExoticComponent, ReactElement, Ref } from "react"; import type { ViewStyle, ImageStyle, TextStyle } from "react-native"; export const useYoshiki = (): { css: < - Style extends ViewStyle | TextStyle | ImageStyle, + Style extends ViewStyle & TextStyle & ImageStyle, State extends Partial>> | Record, >( css: EnhancedStyle