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

AppText.tsx

50 lines1.4 KB

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