Skip to content

Latest commit

 

History

History
87 lines (81 loc) · 2.68 KB

Toast.md

File metadata and controls

87 lines (81 loc) · 2.68 KB

Toast

NativeBase Toast can be used to display quick warning or error messages.

Preview ios Toast Preview android Toast

Syntax

import React, { Component } from 'react';
import { Container, Content, Toast, Button, Text, Icon } from 'native-base';
export default class Toast extends Component {
  constructor(props) {
    super(props);
    this.state = {
      showToast: false
    }
  }
  render() {
    return (
      <Container>
        <Content padder>
          <Button onPress={()=> Toast.show({
              supportedOrientations: ['portrait','landscape'],
              text: 'Wrong password!',
              position: 'bottom',
              buttonText: 'Okay'
            })}>
            <Text>Toast</Text>
          </Button>
        </Content>
      </Container>
    );
  }
}

Configuration

Key Value Option Description
text - string The text content to be shown in the toast.
buttonText - string The text to be displayed inside the button.
position bottom top, bottom, center Sets position for the toast.
type - danger,success,warning Sets context to the Toast.
duration - integer Milliseconds after which Toast disappers
supportedOrientations - Portrait, Landscape, Landscape-left, Landscape-right Allows the modal to be rotated to any of the specified orientations

Note: For Toast to work, it has to be called inside Container.