LoginSignup
0
1

More than 1 year has passed since last update.

SafeAreaViewをScrollView内で使用するときの注意点

Posted at

TL;DR

ScrollView内でSafeAreaView使うときは、ScrollViewにcontentInsetAdjustmentBehavior="automatic"のpropsを渡せばスクロールがぶっ壊れない。

<ScrollView contentInsetAdjustmentBehavior="automatic"> 
  <SafeAreaView>
    {/* Long Content */}
  </SafeAreaView>
</ScrollView>

はじめに

React Nativeには、AndroidとiOSを同時に開発できる利点があります。
一方で、AndroidにはAndroidの、iOSにはiOSにしか無い仕様も存在し、その一つにiOSのセーフエリアがあります。

セーフエリアには、上部のセーフエリア(Status Bar)と下部のセーフエリア(Home Indicator)の2つが存在します。
React Nativeでは、SafeAreaViewというコンポーネントを利用することで、よしなにセーフエリア領域を扱うことができます。

ScrollView内で使用するときの注意

<ScrollView contentInsetAdjustmentBehavior="automatic"> 
  <SafeAreaView>
    {/* Long Content */}
  </SafeAreaView>
</ScrollView>
0
1
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
1