@devries-cameron20 / t3code-1 / commits / 35bda28117
Fork 0

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

fix(mobile): Android secret requests no longer offer password manager logins (#29825)

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>

voida6 committed Nov 6, 2026 at 11:49 UTC 35bda281170f14d772183f8fc690579758343d10
7 files changed +240 -11
apps/mobile/modules/t3-native-controls/android/src/main/java/expo/modules/t3nativecontrols/T3SecretInputModule.kt new
+145
@@ -0,0 +1,145 @@
1 +package expo.modules.t3nativecontrols
2 +
3 +import android.content.Context
4 +import android.graphics.Color
5 +import android.graphics.Typeface
6 +import android.os.Build
7 +import android.text.Editable
8 +import android.text.InputType
9 +import android.text.TextWatcher
10 +import android.util.TypedValue
11 +import android.view.Gravity
12 +import android.view.KeyEvent
13 +import android.view.View
14 +import android.view.ViewGroup
15 +import android.view.inputmethod.EditorInfo
16 +import android.widget.EditText
17 +import expo.modules.kotlin.AppContext
18 +import expo.modules.kotlin.modules.Module
19 +import expo.modules.kotlin.modules.ModuleDefinition
20 +import expo.modules.kotlin.viewevent.EventDispatcher
21 +import expo.modules.kotlin.views.ExpoView
22 +
23 +class T3SecretInputModule : Module() {
24 + override fun definition() = ModuleDefinition {
25 + Name("T3SecretInput")
26 +
27 + View(T3SecretInputView::class) {
28 + Prop("value") { view: T3SecretInputView, value: String -> view.setValue(value) }
29 + Prop("placeholder") { view: T3SecretInputView, value: String ->
30 + view.input.hint = value
31 + }
32 + // Not "accessibilityLabel": React Native applies that to the outer view, not the EditText.
33 + Prop("inputLabel") { view: T3SecretInputView, value: String ->
34 + view.input.contentDescription = value
35 + }
36 + Prop("textColor") { view: T3SecretInputView, value: Int -> view.input.setTextColor(value) }
37 + Prop("placeholderColor") { view: T3SecretInputView, value: Int ->
38 + view.input.setHintTextColor(value)
39 + }
40 + Prop("cursorColor") { view: T3SecretInputView, value: Int -> view.setCursorColor(value) }
41 + Prop("fontSize") { view: T3SecretInputView, value: Float ->
42 + view.input.setTextSize(TypedValue.COMPLEX_UNIT_DIP, value)
43 + }
44 + Prop("editable") { view: T3SecretInputView, value: Boolean -> view.input.isEnabled = value }
45 + Events("onChangeText", "onSubmit")
46 + }
47 + }
48 +}
49 +
50 +/**
51 + * Masked single-line input for secret requests. React Native's own TextInput cannot opt out of
52 + * credential autofill, so password managers offer logins above the keyboard; this view owns the
53 + * EditText so it can.
54 + */
55 +class T3SecretInputView(context: Context, appContext: AppContext) : ExpoView(context, appContext) {
56 + // Yoga sizes this view; the EditText inside is laid out by Android.
57 + override val shouldUseAndroidLayout = true
58 +
59 + // Newer Android can request autofill even with importantForAutofill=no.
60 + // Reporting no autofill type keeps this input out of credential autofill.
61 + val input = object : EditText(context) {
62 + override fun getAutofillType(): Int = View.AUTOFILL_TYPE_NONE
63 + }
64 + private val onChangeText by EventDispatcher()
65 + private val onSubmit by EventDispatcher()
66 + private var applyingValue = false
67 +
68 + // Values sent to JS that its state has not echoed back yet. An echo of an older value would
69 + // otherwise overwrite characters typed in the meantime.
70 + private val unechoed = ArrayDeque<String>()
71 +
72 + init {
73 + input.background = null
74 + input.setPadding(0, 0, 0, 0)
75 + input.gravity = Gravity.CENTER_VERTICAL or Gravity.START
76 + // The autofill APIs arrive with API 26; minSdk is 24.
77 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
78 + input.importantForAutofill = IMPORTANT_FOR_AUTOFILL_NO
79 + }
80 + input.imeOptions = EditorInfo.IME_ACTION_DONE
81 + // Not setSingleLine(): that swaps out the password transformation. The password variation is
82 + // already single line, and the keyboard keeps typed text out of suggestions.
83 + input.inputType =
84 + InputType.TYPE_CLASS_TEXT or
85 + InputType.TYPE_TEXT_VARIATION_PASSWORD or
86 + InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
87 + // The password variation switches the typeface to monospace.
88 + input.typeface = Typeface.DEFAULT
89 + input.setTextColor(Color.BLACK)
90 + input.setHintTextColor(Color.GRAY)
91 + input.addTextChangedListener(
92 + object : TextWatcher {
93 + override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) = Unit
94 + override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) = Unit
95 + override fun afterTextChanged(s: Editable?) {
96 + if (applyingValue) return
97 + val value = s?.toString() ?: ""
98 + unechoed.addLast(value)
99 + onChangeText(mapOf("value" to value))
100 + }
101 + }
102 + )
103 + input.setOnEditorActionListener { _, actionId, event ->
104 + if (actionId == EditorInfo.IME_ACTION_DONE || event?.keyCode == KeyEvent.KEYCODE_ENTER) {
105 + // Hardware Enter reports IME_NULL on Android 13 and earlier, and both key down and key up.
106 + if (event == null || event.action == KeyEvent.ACTION_DOWN) {
107 + onSubmit(mapOf("value" to input.text.toString()))
108 + }
109 + true
110 + } else {
111 + false
112 + }
113 + }
114 + addView(
115 + input,
116 + LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
117 + )
118 + }
119 +
120 + /** Applies JS state without echoing it back, and without moving the caret on equal values. */
121 + fun setValue(value: String) {
122 + val echoed = unechoed.indexOf(value)
123 + if (echoed >= 0) {
124 + repeat(echoed + 1) { unechoed.removeFirst() }
125 + return
126 + }
127 + // A value JS chose itself, such as clearing after a save.
128 + unechoed.clear()
129 + if (input.text.toString() == value) return
130 + applyingValue = true
131 + input.setText(value)
132 + input.setSelection(input.text.length)
133 + applyingValue = false
134 + }
135 +
136 + fun setCursorColor(color: Int) {
137 + input.highlightColor = Color.argb(0x52, Color.red(color), Color.green(color), Color.blue(color))
138 + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) return
139 +
140 + input.textCursorDrawable = input.textCursorDrawable?.mutate()?.apply { setTint(color) }
141 + input.textSelectHandle?.mutate()?.setTint(color)
142 + input.textSelectHandleLeft?.mutate()?.setTint(color)
143 + input.textSelectHandleRight?.mutate()?.setTint(color)
144 + }
145 +}
apps/mobile/modules/t3-native-controls/expo-module.config.json
+2 -1
@@ -13,7 +13,8 @@
13 "expo.modules.t3nativecontrols.T3NativeControlsModule",
14 "expo.modules.t3nativecontrols.T3WorkspaceNavigationModule",
15 "expo.modules.t3nativecontrols.T3KeyboardCommandsModule",
16 - "expo.modules.t3nativecontrols.T3FoldPostureModule"
16 + "expo.modules.t3nativecontrols.T3FoldPostureModule",
17 + "expo.modules.t3nativecontrols.T3SecretInputModule"
18 ]
19 }
20 }
apps/mobile/src/components/ui/SecretTextInput.android.tsx new
+56
@@ -0,0 +1,56 @@
1 +import { requireNativeView } from "expo";
2 +import { processColor, View, type NativeSyntheticEvent, type ViewProps } from "react-native";
3 +
4 +import { flattenThemeColor } from "../../lib/mobileTheme";
5 +import { useUniwindTheme } from "../../lib/useUniwindTheme";
6 +import type { SecretTextInputProps } from "./SecretTextInput.types";
7 +
8 +interface NativeSecretInputProps extends ViewProps {
9 + readonly inputLabel: string;
10 + readonly value: string;
11 + readonly placeholder: string;
12 + readonly textColor: number;
13 + readonly placeholderColor: number;
14 + readonly cursorColor: number;
15 + readonly fontSize: number;
16 + readonly editable: boolean;
17 + readonly onChangeText: (event: NativeSyntheticEvent<{ readonly value: string }>) => void;
18 + readonly onSubmit: (event: NativeSyntheticEvent<{ readonly value: string }>) => void;
19 +}
20 +
21 +const NativeSecretInput = requireNativeView<NativeSecretInputProps>("T3SecretInput");
22 +
23 +const FONT_SIZE = 16;
24 +const LINE_HEIGHT = 24;
25 +
26 +function nativeColor(value: string) {
27 + const color = processColor(value);
28 + return typeof color === "number" ? color : 0;
29 +}
30 +
31 +/**
32 + * Android's React Native TextInput cannot opt out of credential autofill, so password managers
33 + * offer logins above the keyboard. This field is a native EditText that reports no autofill type.
34 + * The frame matches AppTextInput's.
35 + */
36 +export function SecretTextInput(props: SecretTextInputProps) {
37 + const theme = useUniwindTheme();
38 + const surface = theme["--color-input"];
39 + return (
40 + <View className="min-h-13.5 justify-center rounded-2xl border border-input-border bg-input px-3.5">
41 + <NativeSecretInput
42 + inputLabel={props.accessibilityLabel}
43 + value={props.value}
44 + placeholder={props.placeholder}
45 + textColor={nativeColor(flattenThemeColor(theme["--color-foreground"], surface))}
46 + placeholderColor={nativeColor(flattenThemeColor(theme["--color-placeholder"], surface))}
47 + cursorColor={nativeColor(flattenThemeColor(theme["--color-focus"], surface))}
48 + fontSize={FONT_SIZE}
49 + editable={props.editable}
50 + onChangeText={(event) => props.onChangeText(event.nativeEvent.value)}
51 + onSubmit={(event) => props.onSubmitEditing(event.nativeEvent.value)}
52 + style={{ height: LINE_HEIGHT }}
53 + />
54 + </View>
55 + );
56 +}
apps/mobile/src/components/ui/SecretTextInput.tsx new
+24
@@ -0,0 +1,24 @@
1 +import { AppTextInput } from "./AppText";
2 +import type { SecretTextInputProps } from "./SecretTextInput.types";
3 +
4 +/** Masked field for a value that must stay out of password managers and suggestions. */
5 +export function SecretTextInput(props: SecretTextInputProps) {
6 + return (
7 + <AppTextInput
8 + accessibilityLabel={props.accessibilityLabel}
9 + placeholder={props.placeholder}
10 + value={props.value}
11 + onChangeText={props.onChangeText}
12 + editable={props.editable}
13 + secureTextEntry
14 + autoCorrect={false}
15 + autoCapitalize="none"
16 + autoComplete="off"
17 + textContentType="none"
18 + importantForAutofill="no"
19 + spellCheck={false}
20 + returnKeyType="done"
21 + onSubmitEditing={(event) => props.onSubmitEditing(event.nativeEvent.text)}
22 + />
23 + );
24 +}
apps/mobile/src/components/ui/SecretTextInput.types.ts new
+9
@@ -0,0 +1,9 @@
1 +export interface SecretTextInputProps {
2 + readonly accessibilityLabel: string;
3 + readonly placeholder: string;
4 + readonly value: string;
5 + readonly onChangeText: (value: string) => void;
6 + /** Receives the field's current text, so a submit never uses a stale render of it. */
7 + readonly onSubmitEditing: (value: string) => void;
8 + readonly editable: boolean;
9 +}
apps/mobile/src/features/threads/SecretRequestCard.tsx
+3 -10
@@ -25,6 +25,7 @@ import { View, type ColorValue } from "react-native";
25
26 import { SymbolView, type AppSymbolName } from "../../components/ui/AppSymbol";
27 import { AppText as Text, AppTextInput as TextInput } from "../../components/ui/AppText";
28 +import { SecretTextInput } from "../../components/ui/SecretTextInput";
29 import { serverEnvironment } from "../../state/server";
30 import { useAtomCommand } from "../../state/use-atom-command";
31 import { Button } from "../../components/ui/Button";
@@ -157,21 +158,13 @@ function PendingSecretRequestForm(props: {
158 </View>
159 ) : null}
160 {source === null ? (
160 - <TextInput
161 + <SecretTextInput
162 accessibilityLabel={item.label}
163 placeholder={item.placeholder ?? SECRET_REQUEST_DEFAULT_PLACEHOLDER}
164 value={secret}
165 onChangeText={setSecret}
166 editable={!submitting}
166 - secureTextEntry
167 - autoCorrect={false}
168 - autoCapitalize="none"
169 - autoComplete="off"
170 - textContentType="none"
171 - importantForAutofill="no"
172 - spellCheck={false}
173 - returnKeyType="done"
174 - onSubmitEditing={save}
167 + onSubmitEditing={(value) => void send({ type: "save", secret: value })}
168 />
169 ) : (
170 <TextInput
vite.config.ts
+1
@@ -641,6 +641,7 @@ export default defineConfig({
641 "apps/mobile/src/features/threads/ThreadQueueControl.tsx",
642 "apps/mobile/src/features/review/ReviewCommentCard.tsx",
643 "apps/mobile/src/features/threads/thread-list-v2-items.tsx",
644 + "apps/mobile/src/components/ui/SecretTextInput.android.tsx",
645 "apps/mobile/src/lib/useMobileNavigationTheme.ts",
646 "apps/mobile/src/native/T3ComposerEditor.ios.tsx",
647 "apps/mobile/src/native/T3ComposerEditor.native.tsx",