Snackbar

A Snackbar provides brief messages about app processes at the bottom of screen.

bpk-component-snackbar

Backpack React Native snackbar component.

Default

Day Night
bpk-component-snackbar default iPhone 8 simulator bpk-component-snackbar default iPhone 8 simulator - dark mode
bpk-component-snackbar default Google Pixel emulator bpk-component-snackbar default Google Pixel emulator - dark mode

Title and icon

Day Night
bpk-component-snackbar title-and-icon iPhone 8 simulator bpk-component-snackbar title-and-icon iPhone 8 simulator - dark mode
bpk-component-snackbar title-and-icon Google Pixel emulator bpk-component-snackbar title-and-icon Google Pixel emulator - dark mode

Action

Day Night
bpk-component-snackbar action iPhone 8 simulator bpk-component-snackbar action iPhone 8 simulator - dark mode
bpk-component-snackbar action Google Pixel emulator bpk-component-snackbar action Google Pixel emulator - dark mode

Icon action

Day Night
bpk-component-snackbar icon-action iPhone 8 simulator bpk-component-snackbar icon-action iPhone 8 simulator - dark mode
bpk-component-snackbar icon-action Google Pixel emulator bpk-component-snackbar icon-action Google Pixel emulator - dark mode

Installation

Check the main Readme for a complete installation guide.

Usage


                                                
                                                import React from 'react';
                                                import BpkAlert from 'backpack-react-native/bpk-component-alert';
                                                import BpkButton from 'backpack-react-native/bpk-component-button';
                                                import { icons } from 'backpack-react-native/bpk-component-icon';
                                                import BpkSnackbar, { SNACKBAR_LENGTHS } from 'backpack-react-native/bpk-component-snackbar';
                                                
                                                export default () => (
                                                  <BpkButton
                                                    title="Show"
                                                    onPress={() => {
                                                      BpkSnackbar.show({
                                                        text: 'Snackbar text',
                                                        duration: SNACKBAR_LENGTHS.short,
                                                        title: 'Title',
                                                        icon: icons.flight,
                                                        action: {
                                                          text: 'Action',
                                                          onPress: () => {
                                                            BpkAlert.alert('Action pressed');
                                                          }
                                                        }
                                                      })
                                                    }}
                                                  />
                                                );

Props

BpkSnackbar

Property PropType Required Default Value
duration number true SNACKBAR_LENGTHS.short
text string true -
title string false -
icon string false -
action object false -
action.text* string true -
action.icon* string true -
action.onPress function true -

NOTES

  • when action is provided action.text or action.icon should be provided, but not both at the same time.