Skip to main content

API

ToastEmitter

The following set of props can be passed to the ToastEmitter component instance to specify certain defaults for all Toasts that are shown:

propdescriptiontypedefault value
positionDefault Toast positiontop or bottomtop
visibilityTimeNumber of milliseconds after which Toast automatically hides. Has effect only in conjunction with autoHide prop set to truenumber4000
autoHideWhen true, the visible Toast automatically hides after a certain number of milliseconds, specified by the visibilityTime propbooleantrue
topOffsetOffset from the top of the screen (in px). Has effect only when position is topnumber40
bottomOffsetOffset from the bottom of the screen (in px). Has effect only when position is bottomnumber40
keyboardOffsetOffset from the Keyboard (in px). Has effect only when position is bottom and Keyboard is visible (iOS only)number10
onShowCalled when any Toast is shown() => void
onHideCalled when any Toast hides() => void
onPressCalled on any Toast press() => void

addToast

The complete set of options is described below:

optiondescriptiontyperequireddefault value
typeToast type. available values: success, error, info, warning.stringyes
textText to display in the toaststringyes
durationNumber of milliseconds after which Toast automatically hides.numberno4000
onPressCalled on Toast press(hide: () => void) => voidno