1.0.3 • Published 4 years ago

rn-easy-toast v1.0.3

Weekly downloads
2
License
ISC
Repository
github
Last release
4 years ago

rn-easy-toast

A react native simple toast module to show animated or default types of toast in android and iOS.

Installation

  • 1.Run npm i rn-easy-toast --save or yarn add rn-easy-toast
  • 2.import Toast from 'rn-easy-toast'

Demo

Example

import Toast, { ToastContainer } from 'rn-easy-toast'

Use Toast method to show toast

Toast({
  message : "Hii this is  test Toast!",
  delay : 5000
});

Use with a button

Toast({
  message : "Please try again",
  delay : 5000,
  position : "bottom",
  type : "wide",
  animation : "slideUpDown",
  button : {
    title : "retry",
    onPress = ()=>alert("retry pressed"),
    background : "#8ad2ff", 
    borderRadius : 5
  }
});

or use toast as a container with ToastContainer anywhere inside the component

<ToastContainer message="Hii this is  test Toast" delay={5000} />

Props

PropsTypeOptionalDefaultDescription
messagestringfalsetoast message
delaynumbertrue3000toast delay duration
positionstring, one of ('top','bottom')truebottomtoast position
typestring one of ('default','wide')truedefaulttype of toast
animationstring one of ('slideUpDown','slideRight', slideLeft)trueslideUpDown*only for type 'wide'
backgroundstringtrue'#121010'toast background color
borderRadiusnumbertrue100border radius ( default 0 for type wide)
textStylestyletrue{ color:'#8ad2ff' }custom style text
buttonobjecttrue{}to show button on toast ex. { title : "button", onPress=()=>{}, background : "#8ad2ff", borderRadius : 5, textStyle : {} }

Contribution

Issues and Pull requests are welcome.