mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
add orpc
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import * as NavigationBar from "expo-navigation-bar";
|
||||
import { Platform } from "react-native";
|
||||
import { NAV_THEME } from "@/lib/constants";
|
||||
|
||||
export async function setAndroidNavigationBar(theme: "light" | "dark") {
|
||||
if (Platform.OS !== "android") return;
|
||||
await NavigationBar.setButtonStyleAsync(theme === "dark" ? "light" : "dark");
|
||||
await NavigationBar.setBackgroundColorAsync(
|
||||
theme === "dark" ? NAV_THEME.dark.background : NAV_THEME.light.background,
|
||||
);
|
||||
}
|
||||
18
apps/cli/templates/frontend/native/lib/constants.ts
Normal file
18
apps/cli/templates/frontend/native/lib/constants.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
export const NAV_THEME = {
|
||||
light: {
|
||||
background: "hsl(0 0% 100%)",
|
||||
border: "hsl(240 5.9% 90%)",
|
||||
card: "hsl(0 0% 100%)",
|
||||
notification: "hsl(0 84.2% 60.2%)",
|
||||
primary: "hsl(240 5.9% 10%)",
|
||||
text: "hsl(240 10% 3.9%)",
|
||||
},
|
||||
dark: {
|
||||
background: "hsl(240 10% 3.9%)",
|
||||
border: "hsl(240 3.7% 15.9%)",
|
||||
card: "hsl(240 10% 3.9%)",
|
||||
notification: "hsl(0 72% 51%)",
|
||||
primary: "hsl(0 0% 98%)",
|
||||
text: "hsl(0 0% 98%)",
|
||||
},
|
||||
};
|
||||
12
apps/cli/templates/frontend/native/lib/use-color-scheme.ts
Normal file
12
apps/cli/templates/frontend/native/lib/use-color-scheme.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { useColorScheme as useNativewindColorScheme } from "nativewind";
|
||||
|
||||
export function useColorScheme() {
|
||||
const { colorScheme, setColorScheme, toggleColorScheme } =
|
||||
useNativewindColorScheme();
|
||||
return {
|
||||
colorScheme: colorScheme ?? "dark",
|
||||
isDarkColorScheme: colorScheme === "dark",
|
||||
setColorScheme,
|
||||
toggleColorScheme,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user