reactnative-client
  • @dormakaba/digital-reactnative-client
  • Getting started
  • Changelog
  • Concerns
    • App State
    • Global / Local Snacks
    • Forms
    • Navigation
    • i18n
    • rest api
  • Utils
    • formatters
    • EventEmitter
    • Logger
    • settings
    • validate
    • misc
Powered by GitBook
On this page
  1. Concerns

Global / Local Snacks

PreviousApp StateNextForms

Last updated 6 years ago

Lets you show global are local (bound eg. to a form) notifications.

Code sample

import { Snack } from '@dormakaba/digital-reactnative-client';

<View>
  <Snack.Global />
  <View>
    <Snack.Local restricted="someForm" />
    <Text>Form:</Text>
  </View>
</View>

const message ={
  message: 'Hello'
};

// show a snack
Snack.show(message);

// hide a snack if not set to be dismissed automatically
Snack.hide(messageId);

the message has following options:

Property

Default

Description

id

uuid.v4

An unique id for the notification -> can be used for Snack.hide(id)

message

text to show in the notification

restricted

set this to show the message on a Snack.Local if not set it will be shown globally

dismiss

5000

message will be removed after this time; if restricted is set dismiss won't have a default value and it won't be removed automatically

type

info

any string of: info, success, warning, error