Allow a list of css objects

This commit is contained in:
Zoe Roux
2022-11-26 01:49:43 +09:00
parent 061c735de5
commit 7d14bedf82
7 changed files with 98 additions and 37 deletions
+21 -1
View File
@@ -4,7 +4,7 @@
//
import { StatusBar } from "expo-status-bar";
import { Text, View, Pressable } from "react-native";
import { Text, View, Pressable, TextProps } from "react-native";
import { registerRootComponent } from "expo";
import { Stylable, useYoshiki, px } from "yoshiki/native";
import { H1 } from "@expo/html-elements";
@@ -45,6 +45,20 @@ const BoxWithoutProps = (props: Stylable) => {
);
};
const P = (props: TextProps) => {
const { css } = useYoshiki();
return (
<Text
{...css(
{
fontFamily: "toto",
},
props
)}
/>
);
};
function App() {
const { css } = useYoshiki();
@@ -60,6 +74,12 @@ function App() {
<Text>Open up App.tsx to start working on your app!</Text>
<CustomBox color="black" {...css({ borderColor: "red", borderWidth: px(3) })} />
<BoxWithoutProps {...css({ borderColor: "red", borderWidth: px(3) })} />
<P
accessibilityLabel="toto"
style={[undefined, false, { color: "red" }, [{ color: "green" }, false]]}
>
Test
</P>
<StatusBar style="auto" />
</View>
);
+19
View File
@@ -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 "yoshiki";
import "yoshiki/native";
declare module "yoshiki" {
interface Theme {
font: string;
}
}
declare module "yoshiki/native" {
interface Theme {
font: string;
}
}