contentInsets always overwrites scrollIndicatorInsets of ScrollView/ListView
See original GitHub issueDescription
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:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Thanks for reporting this. Would you consider sending a PR? It seems like you’ve already done some of the work here.
@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?