Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

scroll to a input on button click react native

I cant gurantee this is the best approach.

Add this.scroll.scrollTo({ x: calculatedStartPositionOfTheScreen}) to your button Press handler https://facebook.github.io/react-native/docs/scrollview#scrollto

e.g

<View>
    ...
    <View style={styles.ButtonContainer}>
        <Button title="Screen 1" onPress={() => { this.scroll.scrollTo({ x: 0 }) }} />
    </View>
    <View style={styles.ButtonContainer}>
        <Button title="Screen 2" onPress={() => { this.scroll.scrollTo({ x: screenWidth }) }} />
    </View>
    <View style={styles.ButtonContainer}>
        <Button title="Screen 3" onPress={() => { this.scroll.scrollTo({ x: screenWidth * 2 }) }} />
    </View>
    ...
    <ScrollView
        horizontal={true}
        pagingEnabled={true}
        showsHorizontalScrollIndicator={false}
        ref={(node) => this.scroll = node}
    >
    ...
    </ScrollView>
</View >
Comment

PREVIOUS NEXT
Code Example
Javascript :: download xml file asp.net web api and angularjs 
Javascript :: where does tls come in the osi layer 
Javascript :: outline none react native web 
Javascript :: global variables using strict mode 
Javascript :: all callbacks and function for iCheck plugin 
Javascript :: show each element of an array in a different line 
Javascript :: fat arrow return object 
Javascript :: jqiery bpopup append 
Javascript :: override print command javascript 
Javascript :: routing in react jps 
Javascript :: compile pdf with javascript 
Javascript :: close all function of react in vscode mac 
Javascript :: react js error stackoverflaw 
Javascript :: Comparison Primitive operations Methods 
Javascript :: runjs 
Javascript :: set value localstorage javascript 
Javascript :: jquery 3.2 1 min js download 
Javascript :: random number without rand function 
Javascript :: find every character string match JavaScript 
Javascript :: organize api calls react native folder 
Javascript :: update a particular holder view in recycler 
Javascript :: random number in range javascript 
Javascript :: js hex to string 
Javascript :: image uploading payload 
Javascript :: appendchild js 
Javascript :: use variable in form action vuejs 
Javascript :: how to add fcc cdn to local react projcet 
Javascript :: Temporarily Edit Text on Any Website 
Javascript :: update instance in sequelize 
Javascript :: how to return a value to the parent function from ajax javascript 
ADD CONTENT
Topic
Content
Source link
Name
2+4 =