Need to have a layout where I have a vertically aligned text in the center and button at the right bottom:
NOTE: The text should be vertically aligned inside the whole viewport - from top to bttom - like for example the button has an absolute position and is out of the flow (prever to avoid using absolute positioning) https://i.stack.imgur.com/7omuN.jpg
Tried flexDirection: "column"
and alignItems: "center"
for the container and marginTop: "auto"
for the button but this only pushes button at the bottom
Some experiments with the other direction: https://snack.expo.io/Bybw8xsXS
<View style={styles.container}>
<Text style={styles.text}>
Change code in the editor and watch it change on your phone! Save to get
a shareable url.
</Text>
<View style={styles.buttonContainer}>
<View style={styles.button} />
</View>
</View>
container: {
marginTop: 80,
height: 250,
borderColor: 'red',
borderWidth: 1,
// flex: 1,
flexDirection: 'row',
// alignItems: 'center',
alignContent: 'center',
flexWrap: 'wrap',
},
text: {
fontSize: 18,
borderWidth: 1,
borderColor: 'green',
},
buttonContainer: {
width: '100%',
borderWidth: 1,
borderColor: 'purple',
alignSelf: 'flex-end',
},
button: {
borderRadius: 10,
width: 50,
height: 25,
backgroundColor: 'pink',
alignSelf: 'flex-end',
}
Leaving this here: React-Native Flexbox - Position One Item at Vertical Center and other at Bottom