Navigate back to the homepage

React native ScrollView scroll to position

React Native
October 11th, 2020 · 1 min read

Hello Friends,

Welcome To Infinitbility!

The simplest way of scroll to position in react native using ScrollView ref.


The simplest way of auto-scroll store scrolled position on our state and use in the vertical and horizontal auto-scroll.

but how it is possible auto-scroll in react native?

for auto-scroll, we are use scrollView as a ref, and ScrollView provides scrollTo function for scrolling on any position in a scroll view.

First Create Refs on Class

Refs provide a way to access DOM nodes or React elements created in the render method. ~ from the react-native document

1class MyComponent extends React.Component {
2 constructor(props) {
3 super(props);
4 this.ScrollView = React.createRef();
5 }

Store scrolled height and width on state

State generally use in react-native to store data.

2 showsVerticalScrollIndicator={false}
3 // define ref
4 ref={ref => (this.ScrollView = ref)}
5 // use for store scrolled value
6 onScroll={event =>
7 this.setState({horizontalScroll:event.nativeEvent.contentOffset.x, VerticalScroll:event.nativeEvent.contentOffset.y})
8 }
10// Your list data

Use ScrollView ref to scroll to a destination position

1// auto scroll function
4 // X use for horizontal
5 let horizontalScroll = this.state.horizontalScroll;
7 // Y use for Vertical
8 let VerticalScroll = this.state.VerticalScroll;
10 this.ScrollView.scrollTo({x: horizontalScroll, y: VerticalScroll, animated: true});

Thanks for reading…

More From React Native Tutorial


1. Introduction To React Native

2. React Native Environment Setup using expo

3. React Native Environment Setup for windows

4. React Native Environment setup on Mac OS

5. React Native Environment setup on linux

6. React Native Project Structure

7. React Native State

8. React Native Props

9. React Native Styling

10. React Native Flexbox

11. React Native Text

12. React Native Textinput

13. React Native Commands

14. React Native ScrollView


1. React Native Dark Mode

2. React Native Fonts

3. React Native SQLite

4. React Native DatepickerAndroid

5. React native ScrollView scroll to position

6. How to align icon with text in react native

7. React Native Image

8. React Native Firebase Crashlytics

9. React Native Async Storage

10. React Native Share

Error & Issue Solution

1. Task :app:transformDexArchiveWithDexMergerForDebug FAILED In React Native

2. Expiring Daemon because JVM heap space is exhausted In React Native

3. Task :app:transformNativeLibsWithMergeJniLibsForDebug FAILED In React Native

4. Unable to determine the current character, it is not a string, number, array, or object in react native

5. App crashed immediately after install react native video or track player

6. how to delete SQLite database in android react native

7. React native material dropdown twice click issue

8. How to get the current route in react-navigation?

9. how to disable drawer on the drawer navigation screen?

10. Image not showing in ios 14 react native

11. React Native image picker launchimagelibrary on second time issue

12. how to open any link from react native render Html

13. Network request failed in react native fetch

14. React Native upload video example

Follow me on Twitter

Join our email list and get notified about new content

No worries, I respect your privacy and I will never abuse your email.

Every week, on Tuesday, you will receive a list of free tutorials I made during the week (I write one every day) and news on other training products I create.

Looking For React Native Tutorial?

we are trying to create the best Tutorial for react native developers.

When you want a daily updates about React Native Tutorial or infinitbility update subscribe to our newsletter.

Read React Native Tutorial

Request New Tutorial or Article on mail [email protected]

Guide book

Guidebook: The Javascript Monorepo Photoshop Guide



More articles from Infinitbility

laravel pagination with customization

If you want to customize your pagination view and want to understand the flow of Laravel pagination then you are right place.

October 11th, 2020 · 1 min read

react-native-sqlite-storage examples of query

Examples of Query Uses In react-native-sqlite-storage.

October 11th, 2020 · 2 min read
© 2020–2022 Infinitbility
Link to $ to $ to $ to $ to $ to $mailto:[email protected]