1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Expo/React Native iOSでパスワード入力欄にフォーカスすると一瞬フリーズした話

1
Last updated at Posted at 2026-05-07

環境

  • Expo 54
  • React Native 0.81.5
  • iOS
  • TextInput
  • secureTextEntry

起きたこと

新規登録画面で、パスワード入力欄にフォーカスした瞬間だけ、画面が一時的に固まるような挙動があった。

メール入力欄では発生せず、secureTextEntry を使っているパスワード欄と確認用パスワード欄で発生した。

最初の実装

<TextInput
  value={password}
  onChangeText={setPassword}
  placeholder="8文字以上"
  autoCapitalize="none"
  secureTextEntry={!showPassword}
/>

この状態だと、iOS側がパスワード入力欄として扱い、キーチェーンやパスワード候補などのAutoFill UIを出そうとしているように見えた。

React Native公式ドキュメントでも、textContentType はiOSに入力内容の意味を伝えるためのpropsとして説明されている。

試したこと

まず textContentType="none" を指定してAutoFillを無効化しようとした。

<TextInput
  secureTextEntry={!showPassword}
  textContentType="none"
/>

ただ、自分の環境ではこれだけでは改善しなかった。

効いた対応

最終的に、パスワード欄に以下を追加したところ改善した。

<TextInput
  value={password}
  onChangeText={setPassword}
  placeholder="8文字以上"
  placeholderTextColor="#aaaaaa"
  autoCapitalize="none"
  autoCorrect={false}
  keyboardType="ascii-capable"
  secureTextEntry={!showPassword}
  spellCheck={false}
  textContentType="oneTimeCode"
/>

確認用パスワード欄にも同じ指定を入れた。

<TextInput
  value={confirmPassword}
  onChangeText={setConfirmPassword}
  placeholder="もう一度入力"
  placeholderTextColor="#aaaaaa"
  autoCapitalize="none"
  autoCorrect={false}
  keyboardType="ascii-capable"
  secureTextEntry={!showConfirmPassword}
  spellCheck={false}
  textContentType="oneTimeCode"
/>

oneTimeCode は本来SMSなどのワンタイムコード入力向けの指定だが、今回のケースではiOSのパスワード候補UIを避ける回避策として効いた。

公式ドキュメント上でも、oneTimeCode は textContentType の指定値として存在している。

注意点

textContentType="oneTimeCode" は、意味としてはパスワード入力欄に対して正攻法ではない。

iOSのパスワード生成や保存候補を使わせたい場合は、newPassword や passwordRules を使うほうが自然である。

React Native公式にも、newPassword と passwordRules を使うとiOSにパスワード要件を伝えられると書かれている。

今回の対応は、iOSのパスワード候補UIがフォーカス時のフリーズっぽい挙動につながっている場合の回避策として使った。

まとめ

Expo/React Native + iOSで、secureTextEntry の TextInput にフォーカスした瞬間に固まる場合は、以下を確認すると良さそう。

  • textContentType を明示する
  • autoCorrect={false} を指定する
  • spellCheck={false} を指定する
  • keyboardType="ascii-capable" を指定する
  • textContentType="none" で改善しない場合、回避策として oneTimeCode を試す

自分のケースでは、パスワード欄に textContentType="oneTimeCode" を指定することで改善した。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?