Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Align Button to Bottom in ScrollView [duplicate]

I'm trying to align a button to bottom of the ScrollView and make the ScrollView fill the page. First screenshot is how it looks like and the second one is what I want.

Current Status

What I want

In the screenshots, ScrollView is not used since there aren't enough items but number of items inside of the ScrollView is not fixed.

Render():

<ScrollView style={styles.scrollViewContainer}>
      <View style={{flex: 1, justifyContent: 'space-between', flexDirection: 'column'}}>
        <View style={{flex: 1}}>
          <Text style={styles.bigTitle}>Title</Text>
          <View style={styles.formContainer}>
            <Text>Hello</Text>
            <Text>Hello</Text>
            <Text>Hello</Text>
            <Text>Hello</Text>
            <Text>Hello</Text>
            <Text>Hello</Text>
            <Text>Hello</Text>
            <Text>Hello</Text>
            <Text>Hello</Text>
            <Text>Hello</Text>
            <Text>Hello</Text>
          </View>
        </View>
        <SignupButton onPress={this.submit} title="Next Step" image={require("../Images/right_btn.png")} boldText={true} />
      </View>
    </ScrollView>

Style:

  scrollViewContainer: {
    backgroundColor: '#fff',
  },
  formContainer: {
    paddingTop: 10,
    paddingLeft: 50,
    paddingRight: 50,
    paddingBottom: 30,
  },
  bigTitle: {
    fontSize: 24,
    textAlign: 'center',
    marginTop: 20,
    marginBottom: 20,
  },
like image 390
Naim Berk Tumer Avatar asked Jul 29 '26 21:07

Naim Berk Tumer


1 Answers

Try adding justifyContent:'space-between' and flex:1 to contentContainerStyle to ScrollView

  <ScrollView style={style.container} contentContainerStyle={[{flex:1,justifyContent:'space-between'}]} >
    <LIST />
    <Button />
  </ScrollView>
like image 79
A-J-A Avatar answered Aug 01 '26 10:08

A-J-A



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!