mirror of
https://github.com/zoriya/yoshiki.git
synced 2026-06-03 10:56:43 +00:00
Allow a list of css objects
This commit is contained in:
@@ -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>
|
||||
);
|
||||
|
||||
Vendored
+19
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user