Daily Discomfort is an app that allows users to swipe on different prompts that are designed to get them out of their comfort zones. After the user swipes right on a prompt their mission is to go out into the real word to complete the challenge. Once completed, or failed, the user comes back to the app to journal about their experiences trying to complete the prompt. It can be found on the Apple AppStore & Google Play Store.
The whole reason that I created this app is because I recognize I am terrified to get out of my own comfort zone. I wanted something that would force me each and every day to try something new and to experience things that I might have not had the chance to otherwise. After realizing that there didn't seem to be anything on the market that met my requirements I did what any nerd would do, I opened my laptop and started planning.
The overall architecture for this project is extremely simple. My react native application is talking to a NodeJS api through two different REST endpoints. One is to retrieve a certain amount of approved prompt from the database, and the other to submit a prompt for consideration. I won't be going in to too much detail about the backend I may create another article for that purpose.
Bare Workflow - This workflows requires you to use Android Studio & xCode. You will have to build and deploy your app by yourself. However you get Full Control of your entire project.
Expo
Expo is a framework and a platform for universal React applications. It is a set of tools and services built around React Native and native platforms that help you develop, build, deploy, and quickly iterate on iOS, Android, and web apps from the same JavaScript/TypeScript codebase. - Expo
Expo allows you to very quickly get started with react native. You won't ever have to open up Xcode or Android Studio. Expo will also take care of building, and signing the App Bundles & IPA files that you submit to Google Play and the Apple AppStore. However, there is the trade off is not being able to use native modules or native code in your app. The cool thing with expo is that if you realize you need to write some native code or use some native module that there is not an expo package for, you can simply eject
from expo. Ejecting will allow you to then write or use any native code that you might need.
I ended up deciding to use Expo because I wanted to try and build this as fast as possible.
I also used Typescript instead of Javascript for this project. I haven't worked with Typescript before and I thought it was the perfect time to get started with it. Now that the project is launched, I can say that I am a huge fan. I don't know if I will be able to go back to normal Javascript now.
react-navigation
redux
redux-persist
react-native-deck-swiper
expo-notification
daily-discomfort/
โโ actions/ // all redux actions that are dispatched
โโ assets/ // all images
โโ components/ // all components
โ โโ common/
โ โโ homescreen/
โ โโ submitscreen/
โ โโ historyscreen/
โโ constants/
โ โโ colors.ts // typescript object that contains all color hex codes
โ โโ types.ts // redux types
โโ navigation/
โ โโ bottomtabbarnavigator.tsx // bottom tab bar for navigation
โโ networking/
โ โโ apiRepository.ts // methods to interact with server
โโ notifications/
โ โโ notificationManager.ts // Handles local notification logic
โโ reducers/ // basic redux reducer
โโ screens/
โ โโ history.tsx
โ โโ home.tsx
โ โโ submit.tsx
โโ store/ // Basic redux store
โโ utils/ // static helper functions
โโ App.tsx // main entry point
โโ app.json // expo configuration file
โโ package.json
โโ config.ts // config values
โโ types.ts // typescript types
react-native-deck-swiper
to implement this rather quickly.POST
requests with the data for the new prompt. However, these prompts won't be automatically added into the prompts that the user is currently seeing. I have to go into the DB and approve this newly submitted prompts. This helps to ensure that only quality prompts are being shown to the user. export const scheduleNotification = async (title: string, body: string) => {
Notifications.scheduleNotificationAsync({
content: {
title: title,
body: body
},
trigger: {
seconds: NOTIFICATION_REMINDER_SECONDS,
repeats: false
}
})
};
The thing that I love about Expo the most is how it handles the whole build process for you. You don't have to worry about signing your app as well, Expo takes care of that for you. It only takes two commands to build for both Android and iOS:
expo build:android
expo build:ios
After running these commands the Expo build servers take care of the rest of the work for you and will give you a link where you can download the App Bundle or the IPA file. Once you have these you are able to put them up on both the Google Play store and the Apple App store ๐