The best way to control Claude Code, Codex and more from any computer or phone

main
tsx 40 lines 1.47 KB
Raw
1 import { useState } from "react";
2 import { View } from "react-native";
3
4 import { AppTextInput } from "./AppText";
5 import { SecretRevealButton } from "./SecretRevealButton";
6 import type { SecretTextInputProps } from "./SecretTextInput.types";
7
8 /** Masked field for a value that must stay out of password managers and suggestions. */
9 export function SecretTextInput({ onMount, secret = true, ...props }: SecretTextInputProps) {
10 const [revealed, setRevealed] = useState(false);
11 const returnKeyType = props.returnKeyType ?? "done";
12 return (
13 <View className="justify-center">
14 <AppTextInput
15 ref={onMount}
16 className={secret ? "pr-12" : undefined}
17 accessibilityLabel={props.accessibilityLabel}
18 placeholder={props.placeholder}
19 value={props.value}
20 onChangeText={props.onChangeText}
21 editable={props.editable}
22 secureTextEntry={secret && !revealed}
23 autoCorrect={false}
24 autoCapitalize="none"
25 autoComplete="off"
26 textContentType="none"
27 importantForAutofill="no"
28 spellCheck={false}
29 returnKeyType={returnKeyType}
30 submitBehavior={returnKeyType === "next" ? "submit" : "blurAndSubmit"}
31 onSubmitEditing={(event) => props.onSubmitEditing(event.nativeEvent.text)}
32 />
33 {secret ? (
34 <View className="absolute right-1.5">
35 <SecretRevealButton revealed={revealed} onPress={() => setRevealed(!revealed)} />
36 </View>
37 ) : null}
38 </View>
39 );
40 }