0
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?

More than 5 years have passed since last update.

【ReactNative】キーボード外をタップした際にキーボードを収納する

Posted at

はじめに

ReactNativeでTextInputなどの画面でキーボード外をタップしたときにキーボードを収納するようにしたいと思ったら意外にサクッとできました

サンプルコード

ScrollView で対象の要素を囲むだけです。

sample.js
<ScrollView
  contentContainerStyle={{flexGrow: 1}}
  keyboardShouldPersistTaps='handled'
  scrollEnabled={false} // スクロールさせたくなければ無効化する
>
  // 対象の要素
</ ScrollView>
0
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
0
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?