Skip to content

A high-fidelity iMessage clone built with React Native, Expo SDK 54, and the New Architecture (Fabric). Features smooth animations, optimistic updates, dark/light theme support, and simulated NPC responses.

Notifications You must be signed in to change notification settings

temporarystudios/react-native-imessage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

React Native iMessage

A high-fidelity iMessage clone built with React Native, Expo SDK 54, and the New Architecture (Fabric). Features smooth animations, optimistic updates, dark/light theme support, and simulated NPC responses.

Version Expo SDK React Native License

๐Ÿ“ฑ Preview

iMessage Clone Preview

โœจ Features

  • ๐Ÿ’ฌ iMessage-style UI - Authentic Apple iMessage design and animations
  • ๐Ÿš€ High Performance - Built with React Native New Architecture (Fabric)
  • ๐ŸŽจ Smooth Animations - Spring-based entrance animations for messages
  • ๐ŸŒ“ Dark/Light Theme - Full support for system theme preferences
  • ๐Ÿ’ญ Typing Indicator - Animated three-dot typing indicator
  • ๐Ÿค– Simulated NPC Responses - Automatic replies after sending messages
  • ๐Ÿ“ฑ Optimistic Updates - Instant message feedback with TanStack Query
  • โ™พ๏ธ Infinite Scroll - Pagination for loading message history
  • ๐ŸŽฏ Type Safe - Full TypeScript support throughout

๐Ÿ—๏ธ Tech Stack

  • Framework: Expo SDK 54 with React Native 0.81
  • Architecture: React Native New Architecture (Fabric) enabled
  • State Management: TanStack Query v5 for server state
  • Routing: Expo Router v6
  • Language: TypeScript
  • Package Manager: pnpm

๐Ÿ“ฆ Installation

Prerequisites

  • Node.js 18 or higher
  • pnpm (or npm/yarn)
  • iOS Simulator (Xcode) or Android Emulator

Setup

# Clone the repository
git clone https://github.com/temporarystudios/react-native-imessage.git
cd react-native-imessage

# Install dependencies
pnpm install

# Start the development server
pnpm start

๐Ÿš€ Running the App

# Start Expo development server
pnpm start

# Run on iOS
pnpm ios

# Run on Android
pnpm android

# Run on Web
pnpm web

๐Ÿ“ Project Structure

rn-imessage/
โ”œโ”€โ”€ app/                          # App screens (Expo Router)
โ”‚   โ”œโ”€โ”€ _layout.tsx              # Root layout with QueryClientProvider
โ”‚   โ””โ”€โ”€ (tabs)/
โ”‚       โ””โ”€โ”€ index.tsx            # Main chat screen
โ”œโ”€โ”€ components/                   # Reusable components
โ”‚   โ””โ”€โ”€ typing-indicator.tsx     # Animated typing indicator
โ”œโ”€โ”€ lib/                         # Business logic
โ”‚   โ”œโ”€โ”€ api/
โ”‚   โ”‚   โ””โ”€โ”€ messages.ts          # Mock API functions
โ”‚   โ””โ”€โ”€ hooks/
โ”‚       โ””โ”€โ”€ useMessages.ts       # React Query hooks
โ”œโ”€โ”€ modules/                     # Native modules
โ”‚   โ””โ”€โ”€ expo-chat-message-list/  # Custom native message list
โ”œโ”€โ”€ assets/                      # Static assets
โ””โ”€โ”€ constants/                   # App constants

๐ŸŽฏ Key Components

ChatScreen (app/(tabs)/index.tsx)

The main chat interface featuring:

  • iMessage-style header with avatar
  • Message list with custom bubbles
  • Animated message entrance
  • Input bar with send button
  • Typing indicator integration
  • NPC auto-response simulation
  • Dark/light theme support

TypingIndicator (components/typing-indicator.tsx)

Reusable component showing animated typing status:

  • Three bouncing dots with staggered animation
  • Proper cleanup on unmount
  • Self-contained styling
  • Theme-aware colors

Message Hooks (lib/hooks/useMessages.ts)

Custom React Query hooks:

  • useMessages() - Infinite query for paginated message history
  • useSendMessage() - Mutation with optimistic updates

๐ŸŽจ Design Specifications

Message Bubbles

Light Mode:

  • User messages: Blue (#007AFF), right-aligned, white text
  • Other messages: Light gray (#E9E9EB), left-aligned, black text

Dark Mode:

  • User messages: Blue (#0A84FF), right-aligned, white text
  • Other messages: Dark gray (#3A3A3C), left-aligned, white text

Layout:

  • Border radius: 20pt for smooth rounded corners
  • Max width: 70% of screen width
  • Font: 17pt with -0.2 letter spacing

Color Palette

Light Mode

Background:          #F7F7F7
Header:              #FFFFFF
User Bubble:         #007AFF
Other Bubble:        #E9E9EB
Input Background:    #FFFFFF
Input Border:        #D1D1D6
Text (Primary):      #000000
Text (Secondary):    #8E8E93

Dark Mode

Background:          #000000
Header:              #1C1C1E
User Bubble:         #0A84FF
Other Bubble:        #3A3A3C
Input Background:    #1C1C1E
Input Border:        #38383A
Text (Primary):      #FFFFFF
Text (Secondary):    #8E8E93

Animations

  • Message entrance: Spring animation (tension: 180, friction: 12)
  • Send button: Scale animation (0.88 on press)
  • Typing dots: Vertical bounce (-8px, 400ms duration, 150ms delay between dots)

๐Ÿ”ง Configuration

New Architecture

The project uses React Native's New Architecture (Fabric):

// app.json
{
  "expo": {
    "newArchEnabled": true,
    "userInterfaceStyle": "automatic"
  }
}

React Compiler (Experimental)

React 19 compiler is enabled for automatic memoization:

{
  "experiments": {
    "reactCompiler": true
  }
}

๐ŸŒ“ Theme Support

The app automatically adapts to system theme preferences. Themes can be toggled in:

  • iOS: Settings โ†’ Display & Brightness
  • Android: Settings โ†’ Display โ†’ Dark theme

Colors dynamically update using useColorScheme() hook.

๐Ÿค– NPC Response System

After sending a message, the app simulates a response:

  1. Wait 1 second
  2. Show typing indicator for 2 seconds
  3. Display random NPC response from predefined phrases:
    • "That's interesting!"
    • "Tell me more"
    • "I see what you mean"
    • "Absolutely!"
    • "That makes sense"
    • "I was thinking the same thing"
    • "Good point!"
    • "Interesting perspective"

๐Ÿ“ Scripts

# Development
pnpm start              # Start Expo dev server
pnpm ios                # Run on iOS
pnpm android            # Run on Android
pnpm web                # Run on web

# Code Quality
pnpm lint               # Run ESLint
npx tsc --noEmit        # Type check

# Project
pnpm reset-project      # Reset to fresh project

๐Ÿงช Mock Data

The app includes mock conversation data (lib/api/messages.ts) with:

  • Initial 13-message conversation between "Jannis" and user
  • Pagination support (20 messages per page)
  • Simulated network delays (500-800ms)
  • Auto-generated older messages for testing

๐ŸŽฏ Performance Optimizations

  • โœ… Native component for message rendering
  • โœ… Optimistic updates for instant feedback
  • โœ… Proper animation cleanup to prevent memory leaks
  • โœ… Memoized components with React Compiler
  • โœ… Efficient query cache management
  • โœ… Self-sizing message bubbles
  • โœ… NPC responses moved outside render cycle

๐Ÿ”ฎ Future Enhancements

  • Real backend integration
  • Image/media attachments
  • Message timestamps
  • Read receipts
  • Group chat support
  • Push notifications
  • Voice messages
  • Message reactions
  • Search functionality
  • Message editing/deletion

๐Ÿ“„ License

MIT

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

๐Ÿ“ง Contact

For questions or feedback, please open an issue on GitHub.

๐Ÿ‘จโ€๐Ÿ’ป Author

temporarystudios


Built with โค๏ธ using Expo and React Native

About

A high-fidelity iMessage clone built with React Native, Expo SDK 54, and the New Architecture (Fabric). Features smooth animations, optimistic updates, dark/light theme support, and simulated NPC responses.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published