0

I want to align text to the bottom right of a view. I have aligned the text to the right using

textAlign:'center'

Thanks

It'sNotMe
  • 1,184
  • 1
  • 9
  • 29
  • 3
    Does this answer your question? [Text vertical align in react native (using nativebase)](https://stackoverflow.com/questions/44337469/text-vertical-align-in-react-native-using-nativebase) – Umair Mubeen Jan 19 '21 at 17:17

1 Answers1

0

Working Example: Expo Snack

enter image description here

Here is how you can align your Text wherever you want with ease:

import * as React from 'react';
import { Text, View, StyleSheet } from 'react-native';
import Constants from 'expo-constants';

export default function App() {
  return (
    <View style={styles.container}>
      <View style={styles.card}>
        <View style={{ position: 'absolute', bottom: 10, right: 10 }}>
          <Text>Bottom Right</Text>
        </View>
        <View style={{ position: 'absolute', bottom: 10, left: 10 }}>
          <Text>Bottom Left</Text>
        </View>
        <View style={{ position: 'absolute', top: 10, right: 10 }}>
          <Text>Top Right</Text>
        </View>
        <View style={{ position: 'absolute', top: 10, left: 10 }}>
          <Text>Top Left</Text>
        </View>
      </View>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    paddingTop: Constants.statusBarHeight,
    backgroundColor: '#ecf0f1',
    padding: 8,
  },
  card: {
    width: 200,
    height: 200,
    borderRadius: 10,
    borderWidth: 5,
  },
});
Ketan Ramteke
  • 10,183
  • 2
  • 21
  • 41