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.

[Android] ScrollView is missing initial scroll position for Android

See original GitHub issue

ScrollView has a contentOffset prop for iOS, which sets the initial scroll offset. But it lacks on Android, so you can not set the initial scroll position.

For anyone who can make this, these are the attributes in Android’s native ScrollView.

android:scrollX     The initial horizontal scroll offset, in pixels. 
android:scrollY     The initial vertical scroll offset, in pixels. 

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:63
  • Comments:82 (27 by maintainers)

github_iconTop GitHub Comments

73reactions
madox2commented, Jun 10, 2016

When I try to call scrollTo from componentDidMount method it does not scroll. I have to use workaround with setTimeout to make it work:

componentDidMount() {
  setTimeout(() => this.refs._scrollView.scrollTo({ x: 100, y: 0 }) , 0);
}
25reactions
stale[bot]commented, Dec 26, 2017

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to set the starting position of a ScrollView? - Stack Overflow
The problem is that the ScrollView doesn't know its size before it been laid out. A solution is to ...
Read more >
[Android] ScrollView is missing initial scroll position for Android
[Android] ScrollView is missing initial scroll position for Android. mkonicek. Moved from https://github.com/facebook/react-native/issues/6849.
Read more >
ScrollView - Android Developers
Position the scroll bar at the default position as determined by the system. int, SCROLLBAR_POSITION_LEFT. Position the scroll bar along the left edge....
Read more >
ScrollView - React Native
When true, the scroll view stops on the next index (in relation to scroll position at release) regardless of how fast the gesture...
Read more >
How To Set The Starting Position Of A Scrollview - ADocLib
Carousel states are lost upon recycling and scrolling away :( Now override the onViewRecycled to store the position of the first visible item...
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