question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Scrolling interacts strangely with SafeAreaView on iPhone X

See original GitHub issue

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

(Expo) Packages: (wanted => installed) react: 16.0.0 => 16.0.0 react-native: https://github.com/expo/react-native/archive/sdk-23.0.0.tar.gz => 0.50.3

Steps to Reproduce

  1. Put a SafeAreaView around content inside of a ScrollView.
  2. Make sure there is plenty of content to scroll through.
  3. Run the app on an iPhone X or in the iPhone X Simulator.

Expected Behavior

Scrolling should behave as normally, with the SafeAreaView in effect when the scroll position is at the beginning and end of the content.

Actual Behavior

Scrolling is difficult, and often results in janky behavior. The more complex and long the content, the worse it is.

Here’s a gif of the behavior:

example

Note how the content continuously changes position, even when not scrolling.

Reproducible Demo

https://snack.expo.io/rkiomUcgz

Make sure to use an iPhone X device, or download and open in XDE to install it on the iPhone X Simulator.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:24
  • Comments:25 (7 by maintainers)

github_iconTop GitHub Comments

38reactions
ceciliaschiebelcommented, Sep 23, 2018

I had the same situation, and contentInsetAdjustmentBehavior worked for me

<ScrollView contentInsetAdjustmentBehavior="automatic">
      <SafeAreaView>
            {/* long content here */}
      </SafeAreaView>
</ScrollView>

from react-native repo, ScrollView code says:

/**
   * This property specifies how the safe area insets are used to modify the
   * content area of the scroll view. The default value of this property is
   * "never". Available on iOS 11 and later.
   * @platform ios
   */
  contentInsetAdjustmentBehavior?: ?(
    | 'automatic'
    | 'scrollableAxes'
    | 'never'
    | 'always'
  ),
5reactions
david-arteagacommented, Sep 1, 2019

I am on react-native 0.59.9 and when I set contentInsetAdjustmentBehavior="automatic" on ScrollView, FlatList or SectionList, the padding is correctly added at the bottom and the content is allowed to scroll beneath the bottom part where the “home button” is. There is no need to use a SafeAreaView to achieve this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Safari on iPhone X scrolling is VE… | Apple Developer Forums
Safari on iPhone X scrolling is VERY choppy and laggy ... The scrolling of choosing which tab to go to in the tab...
Read more >
ScrollView - React Native
iOS. ​. When true, the scroll view bounces vertically when it reaches the end even if the content is smaller than the scroll...
Read more >
[Solved]-The SafeAreaView causes weird gap on screen
The issue might be with the conflicting SafeAreaView in the Navigation component. You can skip the bottom padding for the SafeArea like this,...
Read more >
Last view added to content view of scrollview goes behind the ...
Scroll view subclasses like table view and collection view handles this problem automatically if you pin the bottom anchor to safe area. Since ......
Read more >
Supporting safe areas | React Navigation
Notch on the iPhone X. While React Native exports a SafeAreaView component, it has some inherent issues, i.e. if a screen containing safe...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found