Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.
/ rn-toast Public archive

A easy to use react native toasting component 🔥 🔥

License

Notifications You must be signed in to change notification settings

pacifio/rn-toast

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React native toasting


forthebadgeforthebadgeforthebadgeforthebadge

A simple react native component for creating toasts / alerts . Something similar named react-native-easy-toast does exist but it does not respond to touches meaning that the only difference between rn-toast-alert and react-native-easy-toast is that rn-toast-alert is using pan responder and the other one is not . It looks something like this after installing

example

Table of contents

Installation

npm install --save rn-toast-alert
OR
yarn add rn-toast-alert

Usage

import React from "react";
import { View, Text, Image } from "react-native";
import Toast from "rn-toast-alert";

class App extends React.Component {
  render() {
    return (
      <View>
        <Toast ref="toast" />
        <Button
          title="Toggle toast"
          onPress={() => {
            this.refs.toast.showToast("Toasting", {
              backgroundColor: "#000000",
              textColor: "#ffffff",
              duration: 1500,
              round: false,
              position: "top"
            });
          }}
        />
      </View>
    );
  }
}

export default App;

Options

All of them are not required :)

Props Type default Description
backgroundColor string #000000 Background color for the toast
textColor string #000000 Color of the text
duration number 2500 Time until the toast gets closed
round boolean true Sets the border radius to 14 if true and 5 if false
customStyles object {} Custom style

Created by Adib Mohsin . MIT license