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 :: how to reset auto numeric js for input 
Javascript :: javascript fillstyle 
Javascript :: convert object to json javascript 
Javascript :: how to check if object exists in javascript 
Javascript :: time difference in minutes in JS 
Javascript :: combine two arrays javascript 
Javascript :: javascript alphabet to number 
Javascript :: unexpected token export type react bottontab navigation 
Javascript :: js array intersection object 
Javascript :: change background image through props 
Javascript :: How to know react and react-native version 
Javascript :: fs move file 
Javascript :: generate unique id javascript 
Javascript :: change mouse highlight color js 
Javascript :: change name of html element javascript 
Javascript :: javascript add spaces to string 
Javascript :: sort array of objects javascript by value 
Javascript :: javascript redirect function 
Javascript :: get a element using name in jquery 
Javascript :: sort array of objects javascript 
Javascript :: how to start react project 
Javascript :: clear canvas 
Javascript :: vue go to particular route 
Javascript :: javascript create array of objects with map 
Javascript :: onclick event in angular 
Javascript :: js date after 1 year 
Javascript :: on uncheck checkbox hide button jquery 
Javascript :: regex pattern to validate email 
Javascript :: get previous route 
Javascript :: js multiply string 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =