import { StyledProvider, createConfig } from "@gluestack-style/react"const config = createConfig({aliases: {bg: "backgroundColor",bgColor: "backgroundColor",rounded: "borderRadius",h: "height",w: "width",},tokens: {colors: {primary0: "#ffffff",primary400: "#c084fc",primary500: "#a855f7",primary600: "#9333ea",},space: {4: 16,5: 20,6: 24,},radii: {sm: 4,md: 6,},letterSpacings: {md: 0,},lineHeights: {sm: 20,md: 22,},fontWeights: {normal: "400",medium: "500",},fontSizes: {sm: 14,md: 16,},mediaQueries: {sm: "@media (min-width: 480px)",md: "@media (min-width: 768px)",},},globalStyle: {variants: {shadow: {softShadow: {shadowOffset: {width: 0,height: 0,},shadowRadius: 10,shadowOpacity: 0.1,_android: {shadowColor: "$primary500",elevation: 5,shadowOpacity: 0.05,},},},},},} as const)const App = () => (<StyledProvider config={config}><YourApp /></StyledProvider>)
import React from "react"import { View, Pressable, Text } from "react-native"import { styled, StyledProvider } from "@gluestack-style/react"import { config } from "./gluestack-style.config"const StyledComponent = styled(View,{p: "$4",_dark: {bg: "$info600",},_light: {bg: "$info800",},},{})export function ColorMode({ ...args }) {const [currentColorMode, setCurrentColorMode] = React.useState("light")return (<StyledProvider config={config} colorMode={currentColorMode}><Pressablestyle={{backgroundColor: "gray",padding: 12,marginBottom: 12,}}onPress={() => {setCurrentColorMode(currentColorMode === "dark" ? "light" : "dark")}}><Text style={{ color: "white" }}>Toggle {currentColorMode === "dark" ? "light" : "dark"}</Text></Pressable><StyledComponent /></StyledProvider>)}
import React from "react"import { Pressable, Text } from "react-native"import {styled,StyledProvider,createGlobalStylesWeb,} from "@gluestack-style/react"import { config } from "./gluestack-style.config"const globalStyles = createGlobalStylesWeb({body: {bg: "$red500",},".className": {body: {bg: "$info600",},},})const StyledButton = styled(Pressable, {bg: "$primary600",px: "$6",py: "$4",_dark: {bg: "$info600",},_light: {bg: "$info800",},})const App = () => {return (<StyledProvider config={config} globalStyleInjector={globalStyles}><StyledButton /></StyledProvider>)}