The Chat App allows users to enter a chat room, exchange messages with other users, share locations and images, and read messages offline. It is also compatible with a screen reader for users with visual impairments.
- User-friendly interface: Users can enter their name, choose a theme color, and easily access the chat room.
- Real-time messaging: Users can exchange text messages in real-time.
- Image sharing: If users grant the necessary permissions, they can share images from their device's media library or capture photos using the device camera.
- Location sharing: Users can share their current location with others.
- Offline messaging: Even when offline, users can still read and access previous conversations.
- Screen reader compatibility: The app is designed to be accessible and compatible with screen readers for users with visual impairments.
The app is built with the following technologies:
- Node.js 18.16.0
- Expo 48.0.15
- React Native 0.71.8
- Firebase ^9.13.0
- TypeScript ^4.9.4
It utilizes the following Firebase services:
- Firebase Authentication for anonymous sign-in
- Firestore Database for storing messages
- Firebase Storage for storing images
The chat interface and functionality are created using Gifted Chat, a popular and highly customizable React Native library for chat applications.
- Open the Firebase Console (https://console.firebase.google.com/) and create a new project. Choose a name and proceed. You can uncheck Google Analytics if desired.
- In the Project Overview, click on the "Add app" button (
</>) to add a web app. - Register your app name.
- In the "Add Firebase SDK" step, copy the firebase config object from the code box. Create a new file named
firebase.config.tsand paste the config object after the "export" keyword. Your file should look like this:
export const firebaseConfig = {
apiKey: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
authDomain: 'chat-app-XXXXX.firebaseapp.com',
projectId: 'chat-app-XXXXXXXXX',
storageBucket: 'chat-app-XXXXXX.appspot.com',
messagingSenderId: '000000000000000',
appId: 'XXXXXXXXXXXXXXX',
};- Save the file, you will need it later.
- In the Firebase Project Overview, go to the "Build" menu on the left side and choose "Authentication". Click on "Get started" and enable the "Anonymous" sign-in provider. Enable and Save.
- From the "Build" menu, choose "Firestore Database". Click on "Create Database", select your preferred location and click Enable.
- In the Cloud Firestore "Rules" tab, set the following rule:
allow read, write: if true;and publish the changes. - From the "Build" menu, choose "Storage". Click on "Get started", then Next and Done.
- In the Storage "Rules" tab, set the following rule:
allow read, write: if true;and hit Publish
- Install Android Studio on your local machine.
- From the Welcome screen, click on "More Actions" and select "SDK Manager".
- On the "SDK Platforms" tab, check "Show Package Details" in the bottom right corner.
- Choose an Android Platform Package (Android 12L recommended*) and select "Android SDK Platform", "Sources for Android", "Google APIs System Image", and "Google Play System Image" (choose according to your system).
- In the "SDK Tools" tab, select "Android SDK Build-Tools", "Android Emulator", and "Android SDK Platform Tools".
- For Mac users: Copy the Android SDK location from the same window and add the following lines to your
.zprofileor.zshrcfile:
export ANDROID_SDK=/YOUR/ANDROID/SDK/LOCATION
export PATH=$ANDROID_SDK/platform-tools:$PATH- After installing the relevant packages, go back to the Welcome screen, click on "More Actions", and select "Virtual Device Manager".
- Click on "Create Device" and select a newer device with the Play Store icon. Choose Next.
- Select a platform. "Sv2" is recommended*.
- In the "Verify Configuration" window, click on "Show Advanced Settings".
- In the "Memory and Storage" section, change both "Internal Storage" and "SD card" to 4096. Click "Finish".
- In the Device Manager, start your newly created emulator.
* Emulator based on SDK Platform 13 (Tiramisu) may be subject to this issue
- Clone the repository of the Chat App to your local machine.
- Add your
firebase.config.tsfile to the project's root folder. - In the Terminal, navigate to the project's root folder and run the command
npm install. - Run the command
npm start. The Metro Bundler will open. - Choose option
afor the Android Emulator. The Expo Go app will be installed on the virtual device, and the Chat App will open.
