Skip to content

contentInsets always overwrites scrollIndicatorInsets of ScrollView/ListView #13025

@allenhsu

Description

@allenhsu

Description

I set contentInsets and scrollIndicatorInsets of a ScrollView, actually ListView, to different values. But seems the value of contentInsets always overwrites the scrollIndicatorInsets one.

Reproduction

https://sketch.expo.io/Byi2M7psg

In this demo, scrollIndicatorInsets.top is 20, it's expected to be 100. After deleting contentInset={{top: 20, left: 0, right: 0, bottom: 0}}, the scrollIndicatorInsets is correct.

Solution

On line 262 of https://github.com/facebook/react-native/blob/master/React/Views/RCTView.m#L262 scrollIndicatorInsets is set to baseInset which is contentInset most of the time. This method is called when setContentInset for RCTScrollView.

On line 372 of https://github.com/facebook/react-native/blob/v0.42.3/React/Views/RCTComponentData.m#L372 when enumerate props, the order should not be predictable, but actually contentInset always comes after scrollIndicatorInsets during my debugging. So contentInset always overwrites scrollIndicatorInsets unless it's Zero (returned on if (UIEdgeInsetsEqualToEdgeInsets(contentInset, _contentInset)) return).

Additional Information

  • React Native version: 0.42.3
  • Platform: iOS
  • Operating System: MacOS
  • Dev tools: iOS 10.2.1

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions