Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

react native scrollview item bottom

/*
The key is the contentContainerStyle property
(doc: https://facebook.github.io/react-native/docs/scrollview#contentcontainerstyle).
"These styles will be applied to the scroll view content container which wraps all of the child views. "

After setting flexGrow: 1, justifyContent: 'space-between',
flexDirection: 'column' in contentContainerStyle,
one can set justifyContent: 'flex-start' for the upper container view 
with the text, and justifyContent: 'flex-end' for the lower 
container view with the buttons. 
*/

<ScrollView
  contentContainerStyle={{ flexGrow: 1, justifyContent: 'space-between', flexDirection: 'column' }}
  style={{ backgroundColor: 'white', paddingBottom: 20 }}
>
  <View style={{ flex: 1, justifyContent: 'flex-start' }}>
    <Text>Some text with different length in different cases, or some input fileds.</Text>
  </View>
  <View style={{ flex: 1, justifyContent: 'flex-end' }}>
    <View>
      <TouchableOpacity style={[commonStyles.greenButton, styles.buttonPadding]}>
        <Text style={commonStyles.greenButtonTitle}>Next</Text>
      </TouchableOpacity>
    </View>
    <View>
      <TouchableOpacity style={styles.cancelButtonContainer}>
        <Text style={styles.cancelButton}>Cancel</Text>
      </TouchableOpacity>
    </View>
  </View>
</ScrollView>
Comment

PREVIOUS NEXT
Code Example
Javascript :: first name last name concatenate javascript with ternary operator 
Javascript :: how to do subtraction in javascript 
Javascript :: take off element form end of array 
Javascript :: pass infinite argument in function 
Javascript :: javascript sort array of objects by key value ascending and descending order 
Javascript :: find duplicates array javascript 
Javascript :: get array from string javascript 
Javascript :: closure example 
Javascript :: filter properties from object javascript 
Javascript :: unicode in javascript 
Javascript :: how to unfreeze object in javascript 
Javascript :: disable js in chrome dev tools 
Javascript :: jquery get parent element 
Javascript :: splice state react 
Javascript :: angularjs select placeholder 
Javascript :: passing data in route react 
Javascript :: add multiple images inside the DOM js 
Javascript :: jquery edit href 
Javascript :: javascript expression 
Javascript :: python to java script 
Javascript :: javascript get last element in array 
Javascript :: how to name a file path in document.geteleementbyid 
Javascript :: how to interrupt scroll with jquery 
Javascript :: use length to resize an array 
Javascript :: loading button jquery 
Javascript :: if condition to whether json object has jsonarray or jsonobject 
Javascript :: javascript check number length 
Javascript :: react native run android common error 
Python :: abc list 
Python :: sqlalchemy python install 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =