Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

AppText.tsx

51 lines1.5 KB

1import {
2 Platform,
3 Text as RNText,
4 TextInput as RNTextInput,
5 type TextInputProps as RNTextInputProps,
6 type TextProps as RNTextProps,
7} from "react-native";
8​
9import { cn } from "../lib/cn";
10​
11export type AppTextProps = RNTextProps & { readonly className?: string };
12​
13/**
14 * Thin wrapper around RN Text with default font-family and foreground color.
15 * Uses Uniwind className — no manual style parsing.
16 */
17export function AppText({ className, ...props }: AppTextProps) {
18 return (
19 <RNText
20 className={cn("font-sans text-foreground", className)}
21 selectionColorClassName={Platform.OS === "android" ? "accent-focus/32" : undefined}
22 {...props}
23 />
24 );
26​
27export type AppTextInputProps = Omit<RNTextInputProps, "placeholderTextColor"> & {
28 readonly className?: string;
29 readonly ref?: React.Ref<RNTextInput>;
30};
31​
32/**
33 * Thin wrapper around RN TextInput with default input styling.
34 * Uses Uniwind className — no manual style parsing.
35 */
36export function AppTextInput({ className, ref, ...props }: AppTextInputProps) {
37 return (
38 <RNTextInput
39 ref={ref}
40 className={cn(
41 "min-h-13.5 rounded-2xl border border-input-border bg-input px-3.5 py-3 font-sans text-base text-foreground",
42 className,
43 )}
44 placeholderTextColorClassName="accent-placeholder"
45 selectionColorClassName={"accent-focus/32"}
46 cursorColorClassName={"accent-focus"}
47 selectionHandleColorClassName={Platform.OS === "android" ? "accent-focus" : undefined}
48 {...props}
49 />
50 );