Skip to content
keyboard logo

キーボード最適化スキル

keyboard

iPhoneでのキーボード操作を最適化する。TextInputのキーボード回避、閉じる操作、入力補助を実装する。「キーボード対応して」「入力画面を直して」「キーボードが被る」などのリクエストで使用する。

SKILL.md

Full skill instructions

キーボード最適化スキル

TextInput を含む画面に対して、iPhoneでの快適なキーボード操作を実装する。

デザイン前提: Liquid Glass

本プロジェクトは @callstack/​liquid-glass による Liquid Glass デザインを前提とする。 キーボード周りの実装では以下を考慮する:

  • LiquidGlassView 内の TextInput は、ガラスエフェクトのブラーでプレースホルダーが見づらくなる可能性がある。テキストカラーに PlatformColor('labelColor') を使用する
  • キーボード上部のアクセサリビュー(送信ボタン等)にも LiquidGlassView を適用し、ガラス質感を統一する
  • フォールバック: isLiquidGlassSupported が false の場合は半透明背景に切り替える

対象ファイル

  • src/​screens/​**/​*.tsx — 画面コンポーネント
  • src/​components/​**/​*.tsx — フォーム系コンポーネント

引数が指定された場合はその画面のみ、省略時は TextInput を含む全画面を対象とする。

手順

1. 対象画面の特定

TextInput を含むファイルを検索する:

Grep: "TextInput" in src/​screens/ and src/​components/

2. KeyboardAvoidingView の適用

TextInput を含む画面のルートに KeyboardAvoidingView を追加する。

パターン:

import { KeyboardAvoidingView, Platform } from 'react-native';

// 画面コンポーネントのルートに追加
<KeyboardAvoidingView
  style={{ flex: 1 }}
  behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
  keyboardVerticalOffset={Platform.OS === 'ios' ? 0 : 0}
>
  {/​* 既存のコンテンツ */​}
</​KeyboardAvoidingView>

3. ScrollView の最適化

TextInput を含む ScrollView に以下を追加:

<ScrollView
  keyboardShouldPersistTaps="handled"
  keyboardDismissMode="interactive"
  contentContainerStyle={{ flexGrow: 1 }}
>

4. TextInput の入力補助

各 TextInput に以下のプロパティを適切に設定する:

入力の種類returnKeyTypeautoCapitalizekeyboardTypetextContentType
ユーザー名next or donenonedefaultusername
メールnext or donenoneemail-addressemailAddress
パスワードdonenonedefaultpassword / newPassword
検索searchnonedefault—
複数行テキストdefaultsentencesdefault—

5. キーボード閉じる操作

  • 単一フィールド: onSubmitEditing={() => Keyboard.dismiss()}
  • 複数フィールド: useRef で次のフィールドにフォーカス移動
  • 画面タップで閉じる: 必要に応じて TouchableWithoutFeedback + Keyboard.dismiss()

複数フィールドのフォーカス移動パターン:

import { useRef } from 'react';
import { TextInput, Keyboard } from 'react-native';

const emailRef = useRef<TextInput>(null);
const passwordRef = useRef<TextInput>(null);

<TextInput
  placeholder="ユーザー名"
  returnKeyType="next"
  onSubmitEditing={() => emailRef.current?.focus()}
  blurOnSubmit={false}
/>
<TextInput
  ref={emailRef}
  placeholder="メールアドレス"
  returnKeyType="next"
  onSubmitEditing={() => passwordRef.current?.focus()}
  blurOnSubmit={false}
/>
<TextInput
  ref={passwordRef}
  placeholder="パスワード"
  returnKeyType="done"
  onSubmitEditing={() => Keyboard.dismiss()}
/>

6. パスワード入力の最適化

<TextInput
  secureTextEntry={!showPassword}
  textContentType="password"
  autoComplete="password"
  autoCorrect={false}
/>

ルール

  • Platform.OS で iOS / Android を分岐し、behavior を適切に設定する
  • 既存のレイアウト・スタイルを壊さない
  • keyboardVerticalOffset はヘッダー高さに応じて調整する
  • 新規パッケージのインストールは最小限にする(React Native 標準 API を優先)
  • 変更後に TextInput のフォーカス・送信が正常に動作することを確認する

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View