Chunky Snackbar
High-contrast, bold brutalist snackbar with stacking support.
Component Features and Props
How to Use Chunky Snackbar Component
Installation Guide for Chunky Snackbar
Component Props
Specifications
| Prop | Type | Default | Description |
|---|---|---|---|
itemReq | SnackbarMessage | - | Message object with id, text, severity |
onDismissReq | (id: string) => void | - | Dismiss callback |
indexReq | number | - | Stacking index |
Install
TERMINAL
$ npx expo install react-nativeComponent Code
Component.tsx
1import React, { useEffect, useRef } from 'react';
2import {
3 Text,
4 StyleSheet,
5 Animated,
6 View,
7 TouchableOpacity,
8 Dimensions
9} from 'react-native';
10
11export type Severity = 'success' | 'error' | 'warning' | 'info';
12
13export interface SnackbarMessage {
14 id: string;
15 text: string;
16 severity: Severity;
17}
18
19interface Props {
20 item: SnackbarMessage;Usage
Usage.tsx
import React, { useState } from 'react';
import {
StyleSheet,
View,
Text,
TouchableOpacity,
SafeAreaView,
ScrollView
} from 'react-native';
import ChunkySnackbar, { SnackbarMessage, Severity } from './components/ChunkySnackbar';
export default function App() {
const [messages, setMessages] = useState<SnackbarMessage[]>([]);
const addSnackbar = (severity: Severity) => {
const id = Date.now().toString();
const newMsg: SnackbarMessage = {
id,
severity,
text: severity === 'error' ? 'Critical system failure detected' : 'Action completed successfully',100%
Interactive Preview running on Expo Web.
Gestures and animations are simulated.
100%
