Incubator.Toast
A toast component for displaying non-disruptive messages to the user
(code example)
Usageβ
<Toast visible={isVisible} position={'top'} autoDismiss={5000} onDismiss={onDismiss} >
APIβ
actionβ
A single action for the user (showLoader will override this)
ButtonProps
autoDismissβ
Time of milliseconds to automatically invoke the onDismiss callback
number
backgroundColorβ
The toast background color
string
centerMessageβ
Should message be centered in the toast
boolean
containerStyleβ
Toast container style
ViewStyle
elevationβ
Android onlyβ
Custom elevation
number
enableHapticFeedbackβ
Whether to trigger an haptic feedback once the toast is shown (requires react-native-haptic-feedback dependency)
boolean
iconβ
A custom icon to render on the left side of the toast
ImageSourcePropType
iconColorβ
The icon color
string
messageβ
Toast message
string
messagePropsβ
Toast message props
TextProps
messageStyleβ
Toast message style
StyleProp<TextStyle>
onAnimationEndβ
Callback for end of toast animation
(visible?: boolean) => void
onDismissβ
Callback for the toast dismissal
() => void
positionβ
The position of the toast. 'top' or 'bottom'.
'top' | 'bottom'
presetβ
Pass to have preset UI
ToastPreset ('success' | 'failure' | 'general' | 'offline')
renderAttachmentβ
Render a custom view that will appear permanently above or below a Toast, depends on the Toast's position and animate with it when the Toast is made visible or dismissed
() => JSX.Element | undefined
showLoaderβ
Whether to show a loader
boolean
styleβ
Toast style
ViewStyle
swipeableβ
Whether to support dismissing the toast with a swipe gesture. Requires to pass onDismiss method to control visibility
boolean
testIDβ
The component test id
string
visibleβ
Whether to show or hide the toast
boolean
zIndexβ
Custom zIndex for toast
number