Avatar Toast Notification
Dismissible top notification with avatar image and swipe-up gesture.
Component Features and Props
How to Use Avatar Toast Notification Component
Installation Guide for Avatar Toast Notification
Component Props
Specifications
| Prop | Type | Default | Description |
|---|---|---|---|
visibleReq | boolean | - | Control visibility |
avatarReq | string | - | Avatar image URI |
titleReq | string | - | Primary title text |
descriptionReq | string | - | Secondary description text |
onPress | () => void | - | Tap action callback |
onDismissReq | () => void | - | Dismiss 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 Image,
7 Animated,
8 PanResponder,
9 Dimensions,
10 Platform,
11 TouchableOpacity
12} from 'react-native';
13
14interface AvatarToastProps {
15 visible: boolean;
16 avatar: string;
17 title: string;
18 description: string;
19 onPress?: () => void;
20 onDismiss: () => void;Usage
Usage.tsx
import React, { useState } from 'react';
import { StyleSheet, View, Text, TouchableOpacity, SafeAreaView, StatusBar } from 'react-native';
import AvatarToast from './components/AvatarToast';
export default function App() {
const [showNotification, setShowNotification] = useState(false);
// Mock Data
const notificationData = {
avatar: 'https://i.pravatar.cc/150?u=premium_user',
title: 'Sarah Jenkins',
description: 'Sent you a message: "Are we still on for the meeting?"',
};
return (
<SafeAreaView style={styles.container}>
<StatusBar barStyle="dark-content" />
<View style={styles.content}>
<Text style={styles.brand}>Interactive UI</Text>100%
Interactive Preview running on Expo Web.
Gestures and animations are simulated.
100%
