A React Native chat application built with Expo, Firebase (Firestore + Storage), and Gifted Chat. Users can enter their name, choose a background color, chat in real time, send images, and share their location.
-
Start Screen:
- Text input for user name with validation
- Color picker with 4 background color options
- Elegant UI with styled components and shadows
- Form validation (name required before proceeding)
- Keyboard handling to prevent UI coverage
-
Chat Screen:
- Full chat UI with Gifted Chat
- Real-time messaging backed by Firestore
- Image sharing to Firebase Storage (download URLs saved in Firestore)
- Share current location; renders a map bubble with a marker
- Custom action button that opens an Action Sheet with four actions
- Accessibility labels and roles on interactive elements
- Keyboard handling and user avatars
-
Navigation:
- Stack navigation between Start and Chat screens
- Passes user data (name and color) between screens
- Custom navigation header styling
- React Native: Mobile app framework
- Expo: Development platform and toolchain
- React Navigation: Navigation library for screen transitions
- Gifted Chat: Complete chat UI and functionality library
- React Hooks: useState, useEffect, and useCallback for state management
- KeyboardAvoidingView: Cross-platform keyboard handling
- Firebase: Firestore for chat messages; Cloud Storage for media uploads
- Expo Image Picker for gallery/camera; Expo Location for GPS; react-native-maps for map bubbles
- Node.js LTS (18.x or 20.x) and npm
- Git
- Expo tooling (used via npx)
- For Android build/emulator:
- Android Studio with a "Google APIs" emulator image (API 33+ recommended)
- Android SDK Platform Tools (added to PATH by Android Studio)
- For iOS (macOS only): Xcode with iOS Simulator
On Windows, install Android Studio and create a Pixel emulator. No separate Java install is needed—Android Studio bundles it.
-
Clone this repository:
git clone [repository-url] cd chat-demo -
Install dependencies:
npm install
-
Install required packages:
npx expo install react-native-screens react-native-safe-area-context npm install react-native-gifted-chat --save
-
Install media, location, and maps packages (Expo managed):
# Match versions to your Expo SDK automatically npx expo install expo-image-picker expo-location react-native-maps
- In Firebase Console, create a project (or use your existing one) and add a Web app to get the config.
- Copy your Web config into
firebase.js(replace the placeholder values if needed). - Enable Cloud Firestore and Cloud Storage in the Console.
- Verify your Storage bucket. In most projects the default is
<projectId>.appspot.com. If uploads fail and your bucket differs fromfirebaseConfig.storageBucket, update it accordingly.
This app initializes Firestore and connects Cloud Storage using getStorage(app, \gs://${firebaseConfig.storageBucket}`). Instances are exported from firebase.js` and passed to screens via props.
For quick local testing you can temporarily allow authenticated users to read/write:
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write: if request.auth != null;
}
}
}
Remember to tighten these rules for production.
- Open
firebase.jsand replace thefirebaseConfigobject with your project’s Web app config from Firebase Console (Project settings → General → Your apps → Web app). - Ensure the
storageBucketmatches your project’s bucket. The app binds Storage to that exact bucket viagetStorage(app, \gs://${firebaseConfig.storageBucket}`)`.
-
Start the Expo development server:
npx expo start
-
Choose how to run the app:
- Expo Go (fastest):
- Android: Press
ato open in Expo Go on the emulator - iOS: Press
ito open in iOS Simulator with Expo Go
- Android: Press
- Native build (standalone dev client):
- Android:
npm run android(runsexpo run:android, uses Android Studio) - iOS (macOS):
npm run ios
- Android:
- Expo Go (fastest):
-
Smoke test features:
- Select or take a photo → image bubble appears
- Share location → map bubble appears with a marker
chat-demo/
├── App.js # Main app component with navigation setup
├── components/
│ ├── Start.js # Start screen component
│ ├── Chat.js # Chat screen: Firestore sync, map bubble, actions
│ └── CustomActions.js # Action sheet: pick image, take photo, share location, cancel
├── assets/ # App assets (icons, images)
├── package.json # Dependencies and scripts
└── README.md # Project documentation
- Start Screen: User enters their name and selects a background color
- Navigation: User taps "Start Chatting" to navigate to chat screen
- Chat Screen: Displays personalized welcome with chosen background color
- Black (#090C08) - Default
- Dark Purple (#474056)
- Blue Gray (#8A95A5)
- Light Green (#B9C6AE)
The app implements the following:
- Action sheet with four actions: select an image, take a photo, send location, cancel (
components/CustomActions.js). - Storage implementation for media in Google Firebase Storage (
firebase.jsinit +uploadBytes/uploadString+ REST fallback). - Image URLs saved in Google Firestore (messages written by
components/Chat.js -> onSend, withimagefield from Storage download URL). - Location information collected from device, stored in Firestore, and rendered on a map bubble (
locationfield +renderCustomViewwithreact-native-maps). - Accessibility props applied on the CustomActions TouchableOpacity (
accessibilityRole,accessibilityLabel,accessibilityHint). - Properly formatted, commented code (see file headers and inline comments in
Chat.jsandCustomActions.js). - Project setup manual (this README).
- Screen recording showcasing app features (see instructions below to record and add the link/file).
If anything is missing for your review flow, file an issue or ping us—happy to adjust.
You can attach a short screen recording and link it here:
- Android Emulator: three-dots (Extended controls) > Record and Playback > Start recording. Reproduce features, then Stop recording. This produces a
.webmfile. - Physical Android device: enable screen recording from Quick Settings; or use
adb shell screenrecord. - iOS Simulator: File > New Screen Recording; or QuickTime Player with your device attached.
Place the recording under assets/demo/ and link it here:
[Demo video](./assets/demo/chat-demo.webm)
Alternatively, upload to a share (Drive/Dropbox/YouTube Unlisted) and paste the URL.
If “Current location is unavailable” appears on the emulator:
-
Ensure Location services are ON in the emulator (Settings > Location > Use location ON).
-
Inject a mock location:
- Android: Extended controls (⋮) > Location > choose a preset (e.g., San Francisco) or enter coordinates > Set Location.
- iOS: Simulator menu Features > Location > select a preset.
-
Grant app permissions for “Location” (While in use + Precise).
-
Use a “Google APIs” AVD image for Android.
-
Cold boot the emulator after changing settings.
-
✅
Chat messaging functionality(Implemented with Gifted Chat) -
User authentication and login system
-
Message persistence with database storage
-
Group chat and multiple chat rooms
-
Image and file sharing capabilities
-
Push notifications for new messages
-
Online status indicators
-
Message read receipts
-
Custom emoji reactions
- Uses functional components with React Hooks
- Implements proper accessibility labels
- Includes form validation and user feedback
- Responsive design with Flexbox layout
- Clean, modular code structure with comments
- Custom action sheet with accessibility labels
- Robust uploads to Firebase Storage with fallbacks and clear error messages
- Location services checks, accuracy fallbacks, and last-known-position support
The app has been tested with:
- Form validation (empty name handling)
- Navigation between screens with parameter passing
- Chat message sending and receiving
- System message display on chat entry
- Keyboard behavior on both screens
- UI responsiveness across different screen sizes
- Cross-platform compatibility (iOS/Android behavior)
- Accessibility features and labels
For reviewers: the “Feature checklist” above maps directly to the submission rubric. The only manual artifact to add is the screen recording—see “Recording a demo”.
Note: This implementation includes both Exercise 5.3 (navigation setup) and Exercise 5.4 (chat functionality with Gifted Chat).