Skip to content

GufranGaury1887/dsChat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’¬ dsChat

A modern, production-ready React Native chat application powered by react-native-ds-chat β€” a fully customizable, TypeScript-first chat UI library built from the ground up.


✨ Features

App

  • Real-time chat interface with smooth message animations
  • Custom message bubbles with gradient highlights and shadows
  • Custom input toolbar with attachment button and animated send button
  • Message status indicators (sending, sent, delivered, read, failed)
  • Image attachment support
  • Safe area handling for modern devices

Library (react-native-ds-chat)

  • Full chat UI with message bubbles, avatars, timestamps & status indicators
  • Optimized FlatList-based rendering with memoization
  • Typing indicator with animated dots
  • Day separators with smart date formatting (Today, Yesterday, weekday names)
  • Load earlier messages (infinite scroll)
  • Keyboard-aware layout with platform-specific handling
  • Complete theming system with light & dark themes
  • Every component is customizable via render props
  • Strict TypeScript types throughout
  • Zero heavy external dependencies

πŸ›  Tech Stack

Layer Technology
Framework React Native 0.81.5
Platform Expo SDK 54
Language TypeScript 5.9
React React 19.1
Architecture New Architecture enabled
Chat UI Library react-native-ds-chat
Build Tool react-native-builder-bob

πŸ“ Project Structure

dsChat/
β”œβ”€β”€ App.js                      # Default Expo entry (not used as root)
β”œβ”€β”€ index.js                    # App entry point β€” registers ChatScreen
β”œβ”€β”€ app.json                    # Expo configuration
β”œβ”€β”€ package.json                # Root dependencies & scripts
β”œβ”€β”€ tsconfig.json               # TypeScript configuration
β”‚
β”œβ”€β”€ src/
β”‚   └── Screens/
β”‚       └── ChatScreen.tsx      # Main chat screen with custom components
β”‚
β”œβ”€β”€ rn-DS-chat-UI/              # Chat UI library (local package)
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ index.ts            # Library entry point & exports
β”‚   β”‚   β”œβ”€β”€ types.ts            # TypeScript type definitions
β”‚   β”‚   β”œβ”€β”€ theme.ts            # Light/Dark theme system
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   β”œβ”€β”€ Chat.tsx            # Main Chat orchestrator
β”‚   β”‚   β”‚   β”œβ”€β”€ MessageList.tsx     # Virtualized message list
β”‚   β”‚   β”‚   β”œβ”€β”€ MessageRow.tsx      # Individual message row layout
β”‚   β”‚   β”‚   β”œβ”€β”€ MessageBubble.tsx   # Message bubble component
β”‚   β”‚   β”‚   β”œβ”€β”€ InputToolbar.tsx    # Input toolbar with send button
β”‚   β”‚   β”‚   β”œβ”€β”€ SendButton.tsx      # Animated send button
β”‚   β”‚   β”‚   β”œβ”€β”€ Avatar.tsx          # User avatar component
β”‚   β”‚   β”‚   β”œβ”€β”€ DaySeparator.tsx    # Day header separator
β”‚   β”‚   β”‚   β”œβ”€β”€ TypingIndicator.tsx # Animated typing dots
β”‚   β”‚   β”‚   β”œβ”€β”€ LoadEarlier.tsx     # Load more messages button
β”‚   β”‚   β”‚   └── SystemMessage.tsx   # System message display
β”‚   β”‚   β”œβ”€β”€ hooks/
β”‚   β”‚   β”‚   β”œβ”€β”€ useAnimatedMessage.ts
β”‚   β”‚   β”‚   └── useKeyboardHeight.ts
β”‚   β”‚   └── utils/
β”‚   β”‚       β”œβ”€β”€ dateUtils.ts        # Date formatting helpers
β”‚   β”‚       β”œβ”€β”€ messageUtils.ts     # Message creation helpers
β”‚   β”‚       β”œβ”€β”€ scaling.ts          # Responsive scaling utilities
β”‚   β”‚       └── index.ts
β”‚   β”œβ”€β”€ package.json
β”‚   └── README.md               # Library-specific documentation
β”‚
β”œβ”€β”€ assets/                     # App icons, splash screens
β”œβ”€β”€ android/                    # Android native project
└── ios/                        # iOS native project

πŸš€ Getting Started

Prerequisites

  • Node.js β‰₯ 18
  • npm or yarn
  • Expo CLI (npx expo)
  • Xcode (for iOS) / Android Studio (for Android)

Installation

  1. Clone the repository

    git clone <repository-url>
    cd dsChat
  2. Install dependencies

    npm install
    # or
    yarn install
  3. Install iOS pods (macOS only)

    cd ios && pod install && cd ..

Running the App

# Start Expo dev server
npm start

# Run on iOS
npm run ios

# Run on Android
npm run android

# Run on Web
npm run web

🎨 Customization

Custom Message Bubble

The app ships with a custom CustomMessageBubble component featuring:

  • Distinct sent/received bubble shapes with asymmetric border radii
  • Subtle gradient highlight overlay on sent bubbles
  • Platform-specific shadow effects (iOS shadow / Android elevation)
  • Status icon indicators (βœ“, βœ“βœ“, ⚠)
<Chat
  renderBubble={(props) => <CustomMessageBubble {...props} />}
  ...
/>

Custom Input Toolbar

A custom CustomInputToolbar component is included with:

  • Attachment (plus) button
  • Auto-expanding multiline input field
  • Animated send button with spring press feedback
  • Send button appears only when text is entered
<Chat
  renderInputToolbar={(props) => <CustomInputToolbar {...props} />}
  ...
/>

Theming

The library supports complete theming with built-in light and dark themes:

import { Chat, DARK_THEME } from 'react-native-ds-chat';

// Built-in dark theme
<Chat theme={DARK_THEME} ... />

// Custom theme overrides
<Chat
  theme={{
    colors: {
      primary: '#FF6B6B',
      sentBubble: '#FF6B6B',
      background: '#1A1A2E',
    },
  }}
  ...
/>

πŸ“¦ Library Usage

The react-native-ds-chat library is published on npm. Install it with:

npm install react-native-ds-chat

Quick Start

import { Chat, Message } from "react-native-ds-chat";

const ChatScreen = () => {
  const [messages, setMessages] = useState<Message[]>([]);
  const currentUser = { _id: "1", name: "You" };

  const onSend = useCallback((newMessages: Message[]) => {
    setMessages((prev) => [...newMessages, ...prev]);
  }, []);

  return (
    <Chat
      messages={messages}
      user={currentUser}
      onSend={onSend}
      placeholder="Type a message..."
      showReceiverAvatar
    />
  );
};

Available Components

All components are individually exported and can be used standalone:

import {
  MessageBubble,
  Avatar,
  InputToolbar,
  SendButton,
  TypingIndicator,
  DaySeparator,
} from "react-native-ds-chat";

Utility Functions

import {
  createMessage,
  formatTime,
  formatDayHeader,
  isSameDay,
  isToday,
  moderateScale,
} from "react-native-ds-chat";

πŸ“– For complete library documentation, see rn-DS-chat-UI/README.md


πŸ“œ Scripts

Script Description
npm start Start Expo dev server
npm run ios Run on iOS simulator
npm run android Run on Android emulator
npm run web Start web version

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published