Can't align button to the bottom left of the screen - React Native

can definition
can synonym
can verb
can y
can noun meaning
can band
cant
can't

I would like to position my button to the bottom left of the screen. I have tried using bottom: 0 and left: 0, but that did not do anything. I researched a bit and discovered that I need to set the position: 'absolute'. However, when I do this, my button disappears completely.

How can I position by the button to the bottom left of the screen?

Here is my code:

    import React, { Component } from 'react';
import { Button,Alert, TouchableOpacity,Image } from 'react-native'

import {
  AppRegistry,
  StyleSheet,
  Text,
  View,
} from 'react-native';

class Project extends Component {
  render() {
    return (
      <View style={{backgroundColor: '#375D81', flex: 1}}>
         <View style = {styles.container}>
           <TouchableOpacity style = {styles.buttonText} onPress={() => { Alert.alert('You tapped the button!')}}>
             <Text>
              Button
             </Text>
           </TouchableOpacity>
        </View>
      </View>
    );
  }
}

const styles = StyleSheet.create({
 main: {
   backgroundColor: 'blue'
 },
 container: {
  alignItems: 'center',
 },
  buttonText: {
      borderWidth: 1,
      padding: 25,      
      borderColor: 'black',
      backgroundColor: '#C4D7ED',
      borderRadius: 15,
      bottom: 0,
      left: 0,
      width: 100,
      height: 100,
      position: 'absolute'
   }
});

AppRegistry.registerComponent('Project', () => Project);

You've forgotten to flex your container. Add: flex: 1 in there and you're all good:

container: {
  alignItems: 'center',
  flex: 1
},

Can, Can may refer to: Contents. 1 Containers; 2 Music; 3 Other; 4 See also. Containers[edit]. Aluminum can · Drink can · Oil can · Steel and tin cans · Trash can  Can definition, to be able to; have the ability, power, or skill to: She can solve the problem easily, I'm sure. See more.

React-native elements are "rendered" from the top left when defining their position absolutely. This means when you are defining bottom: 0 and left: 0, this is rendering the item where you want horizontally, but vertically it will be off the screen. switch to

position 'absolute',
bottom: 100,
left: 0,

This should be what you are looking for

The Official CAN / Spoon Records Website, VerbEdit. can (third-person singular simple present can, present participle -, simple past could, past participle (obsolete except in adjectival use) couth). Define can. can synonyms, can pronunciation, can translation, English dictionary definition of can. to be able to, have the power or skill to: I can take a bus to the

You just need to set a width and height to your button then:

 justifyContent: 'flex-end'

That's it

App.js

import React from 'react';
import { View, TouchableOpacity, Text } from 'react-native';
import styles from './styles';

class Example extends React.Component {
  render() {
    return (
      <View style={styles.container}>
        <TouchableOpacity style={styles.button}>
          <Text style={styles.text}>Button</Text>
        </TouchableOpacity>
      </View>
    );
  }
}

export default Example;

styles.js

export default {
  container: {
    flex: 1,
    justifyContent: 'flex-end',
  },

  button: {
    justifyContent: 'center',
    textAlign: 'center',
    width: 70,
    height: 40,
    backgroundColor: 'green',
    borderRadius: 10,
    margin: 20,
  },
  text: {
    color: 'white',
    textAlign: 'center',
    margin: 10,
  },
};

You will get something like this:

See Expo Snack: snack.expo.io/@abranhe/button-left

Can, can meaning: 1. to be able to: 2. used to say that you can and will do something: 3. to be allowed to: . Learn more. 110 synonyms of can from the Merriam-Webster Thesaurus, plus 97 related words, definitions, and antonyms. Find another word for can. Can: to bring (as an action or operation) to an immediate end.

can, 1.4Used to indicate that something is typically the case. 'antique clocks can seem out of place in modern homes'. More example sentences. A Controller Area Network (CAN bus) is a robust vehicle bus standard designed to allow microcontrollers and devices to communicate with each other's applications without a host computer. It is a message-based protocol , designed originally for multiplex electrical wiring within automobiles to save on copper, but can also be used in many other

CAN, can. (kæn). n. 1. a container, esp for liquids, usually of thin sheet metal: a petrol can;  Looking for online definition of CAN or what CAN stands for? CAN is listed in the World's largest and most authoritative dictionary database of abbreviations and acronyms The Free Dictionary

Can, Can-Am offers a complete lineup of Off-Road vehicles (ATV, Side-by-Side) and 3-​wheel motorcycles (Spyder or Ryker). Choose your playground now and enjoy  Can(stylised as CAN) was a German experimental rockband formed in Colognein 1968 by the core quartet of Holger Czukay(bass, tape editing), Irmin Schmidt(keyboards), Michael Karoli(guitar), and Jaki Liebezeit(drums).

Comments
  • It still results in the same outcome, with a blank screen. Even with experimenting with the values.
  • I found the solution by removing the view with the style 'container'. If someone could just answer why this works.