The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { |
| 2 | Platform, |
| 3 | Text as RNText, |
| 4 | TextInput as RNTextInput, |
| 5 | type TextInputInstance, |
| 6 | type TextInputProps as RNTextInputProps, |
| 7 | type TextProps as RNTextProps, |
| 8 | } from "react-native"; |
| 9 | |
| 10 | import { MOBILE_TEXT_CLASSES } from "../../lib/typography"; |
| 11 | |
| 12 | import { cn } from "../../lib/cn"; |
| 13 | |
| 14 | export type AppTextProps = RNTextProps & { |
| 15 | readonly className?: string; |
| 16 | readonly textRole?: keyof typeof MOBILE_TEXT_CLASSES; |
| 17 | }; |
| 18 | |
| 19 | export function AppText({ className, textRole, ...props }: AppTextProps) { |
| 20 | return ( |
| 21 | <RNText |
| 22 | className={cn( |
| 23 | "font-sans text-foreground", |
| 24 | textRole && MOBILE_TEXT_CLASSES[textRole], |
| 25 | className, |
| 26 | )} |
| 27 | selectionColorClassName={Platform.OS === "android" ? "accent-focus/32" : undefined} |
| 28 | {...props} |
| 29 | /> |
| 30 | ); |
| 31 | } |
| 32 | |
| 33 | export type AppTextInputProps = Omit<RNTextInputProps, "placeholderTextColor"> & { |
| 34 | readonly className?: string; |
| 35 | readonly ref?: React.Ref<TextInputInstance>; |
| 36 | }; |
| 37 | |
| 38 | export function AppTextInput({ className, ref, ...props }: AppTextInputProps) { |
| 39 | return ( |
| 40 | <RNTextInput |
| 41 | ref={ref} |
| 42 | className={cn( |
| 43 | "min-h-13.5 rounded-2xl border border-input-border bg-input px-3.5 py-3 font-sans text-base text-foreground", |
| 44 | className, |
| 45 | )} |
| 46 | placeholderTextColorClassName="accent-placeholder" |
| 47 | selectionColorClassName={"accent-focus/32"} |
| 48 | cursorColorClassName={"accent-focus"} |
| 49 | selectionHandleColorClassName={Platform.OS === "android" ? "accent-focus" : undefined} |
| 50 | {...props} |
| 51 | /> |
| 52 | ); |
| 53 | } |