As I was exploring React Native using Expo for a week, I decided to create a simple project to implement what I learned.
So, here's my mini app: Noto! 🎉
Noto is a mobile app built with Expo (React Native) and Firebase. It's a small project where users can:
- Create notes.
- Read notes.
- Update notes.
- Delete notes.
- Expo
- Firebase
- React Native
- React
Here's what you can do with Noto:
- Add a note with a title and description.
- Update existing notes.
- View all added notes.
- Delete specific notes.
First, I decided to create a unique ID for each user (since I haven't added authentication yet).
Each user has a notes collection to store multiple notes (as documents).
The backend structure looks like this:
users collection / user-id / notes collection / note-id
- I started by building the UI using
StyleSheet. - Integrated Firebase.
- Generated a user ID and saved it in Async Storage so the user's notes can be displayed easily.
- Used React's Context API to store the user ID and access it anywhere in the app.
- Implemented the note-adding functionality using Firebase's
addDocmethod. - Displayed the added notes using the
getDocsmethod. This step taught me something new about setting up the notes array. - Added note deletion functionality using the
deleteDocmethod. - For updating notes:
- Initially, I fetched the note from Firebase, but this caused delays and a poor user experience.
- To improve the UX, I passed the note data via the
paramsobject from the "All Notes" page, which made editing smoother. - Updated the note in Firebase using the
setDocmethod.
- Using Custom Fonts: Encountered an issue but solved it with some help from Google.
- Displaying Recent Notes:
- Initially, the last added note was not appearing at the top.
- Learned to add a
timestampfield and fetch data in descending order to show recent notes first.
- Environment Variables:
- Struggled to load
.envvariables in the web environment. - After researching for a few days, I found a solution (which I'll share in an article soon). This was my biggest learning moment so far!
- Struggled to load
-
First, create a Firebase project and add the Firebase configuration file to your app. Then, create a .env file and replace the environment variables with the ones provided by Firebase after creating the project.
-
Install all dependencies:
npm install
-
Start the project:
npx expo start
-
View the app using the Expo Go app.
I'm running the app in development mode because I faced some issues building it.
notes-app.mp4
Thank you for checking out Noto! 😊
Happy Coding 🤍 - Rumaisa Naveed