Mini Sheet Snackbar
A hybrid snackbar/bottom-sheet for more complex notifications with actions.
Component Features and Props
How to Use Mini Sheet Snackbar Component
Installation Guide for Mini Sheet Snackbar
Component Props
Specifications
| Prop | Type | Default | Description |
|---|---|---|---|
visibleReq | boolean | - | Control visibility |
titleReq | string | - | Sheet title |
descriptionReq | string | - | Sheet description |
actions | Action[] | - | Array of action buttons |
theme | 'light' | 'dark' | light | Color theme |
onCloseReq | () => void | - | Close callback |
Install
TERMINAL
$ npx expo install react-nativeComponent Code
Component.tsx
1import React, { useEffect, useRef } from 'react';
2import {
3 StyleSheet,
4 View,
5 Text,
6 Animated,
7 PanResponder,
8 Dimensions,
9 TouchableOpacity,
10 Platform,
11} from 'react-native';
12
13const { height: SCREEN_HEIGHT } = Dimensions.get('window');
14const SHEET_HEIGHT = 220;
15
16interface Action {
17 label: string;
18 onPress: () => void;
19 primary?: boolean;
20}Usage
Usage.tsx
// mini-sheet-snackbar
import React, { useState } from 'react';
import { StyleSheet, View, Text, TouchableOpacity, SafeAreaView, StatusBar } from 'react-native';
import MiniSheetSnackbar from './components/MiniSheetSnackbar';
export default function App() {
const [sheetVisible, setSheetVisible] = useState(false);
const handleAction = (type: string) => {
console.log(`${type} pressed`);
setSheetVisible(false);
};
return (
<SafeAreaView style={styles.container}>
<StatusBar barStyle="dark-content" />
<View style={styles.main}>
<Text style={styles.logo}>Uilora</Text>
<Text style={styles.sub}>Component Library</Text>100%
Interactive Preview running on Expo Web.
Gestures and animations are simulated.
100%
