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.

contentInsets always overwrites scrollIndicatorInsets of ScrollView/ListView

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
hramoscommented, May 31, 2017

Thanks for reporting this. Would you consider sending a PR? It seems like you’ve already done some of the work here.

2reactions
gabrielbullcommented, Jul 12, 2019

@Salakar This bug is back, the code from the PR seems to have disappeared. Can you open the issues again?

@timotew You provided the PR to fix this issue. Maybe you can help us understand why it’s back?

Read more comments on GitHub >

github_iconTop Results From Across the Web

scrollIndicatorInsets | Apple Developer Documentation
The distance the scroll indicators are inset from the edge of the scroll view. ... Use horizontalScrollIndicatorInsets and verticalScrollIndicatorInsets instead.
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