r/reactnative • u/draftax5 • Feb 03 '20
After almost a year of learning React Native, here is my first full project, Ledger - a workout logging and analytics app
9
3
u/gketuma Feb 03 '20
Great work. Can you post more about your implementation?
2
u/draftax5 Feb 03 '20
Thanks u/gketuma! I edited my comment above with more info but I will post it here too:
Backend:
- Node /Express REST API with JWT for auth
- Used Joi to help with validation
DB:
- MongoDB
- I usually work with SQL databases and wanted to try out NoSQL. I figured the
structure of a workout app with workout logs would make sense to use a No SQL
structure. It worked pretty well especially using mongooses ODM.Everything for the backend is dockerized and hosted on AWS
Using travis for CI which builds my images on successful merges to master and pushes to my registry. I am fairly new to devops so I have a lot to learn here.
Frontend:
- I wanted to focus on custom Components that I could reuse so nearly everything is
built from scratch. I wanted a smooth feel so I tried to focus heavily on animations.- In my opinion of on the big benefits React Native has is their animations API so I
heavily utilized that.- Another focus was on charts and analytics, I custom built many of the charts using a
fork of react-native-svg.Any questions just ask!
3
u/foocux Feb 03 '20
I loved the UI. If you don't mind, I'd like to know more about how you created the charts. Also, are you using expo or just react-native-cli?
4
u/draftax5 Feb 03 '20
Hey! Thanks a lot! Yea definitely, for the charts I started with this library react-native-svg-charts which is actually pretty awesome in itself, it is built on top of react-native-svg.
But the problem is only basic bar and line charts are supported (plus a few others), and I wanted something that looked a little cooler, so I forked the bar chart and added the ability to use gradients, and then added the ability for bars to start at different points on the y axis as well, so that way I could base it on the time a workout was started.
Do change those things I changed a decent amount of the source code but I was able to keep a lot of it as well.
As for knowing what to change and how to do it, I spent some time reading through the react-native-svg docs which is closely based on web svg, and once I started to understand that it became a little easier. The charts were definitely the trickiest part though, and there are still minor quirks with things like the number of ticks on the x axis that I need to improve.
1
1
2
2
Feb 03 '20
I’ve been looking for an app exactly like this one! My only wish is that it would store my data client side instead of having to connect to a backend
2
u/draftax5 Feb 03 '20
u/slash_20chars I went back and forth for so long on which way I should go with the data storage part!
I ended up deciding to store it in a backend DB because I figured if I want to continue building out the analytics / chart options I could do all of the data transformation on the server and then only send back what I need for that specific chart instead of for example having to map through an entire year of workout logs just to grab a specific exercise's data on the client which might have less powerful CPU.
Also I am not sure of anything client side that can handle No SQL structure with that much potential data? I am sure something exists though!
2
2
u/scrook Feb 03 '20
Great looking app! What did you use to make the GIF in this post?
2
u/draftax5 Feb 03 '20
Thank you!
I recorded the video with the iOS simulator using the command line to get the masks, and then ran it through iMovie to crop it correctly. I'm pretty new with anything to do with video editing so it was pretty basic.
2
u/Hazy_Fantayzee Feb 03 '20
Heh... one of the first apps I want to properly build is a workout app for the exact same reasons as your self (all the ones I have tried so far are all slightly lacking in at least one - often more! - departments).
App looks great mate! Did you do ALL the UI/animations yourself? Very impressive - I'm currently trying to learn the Animated API at the moment and its all a little over my head at the moment. Care to share your learning path for that side of things?
EDIT: I'd also like to add to the voices asking for an Android version....
1
u/draftax5 Feb 04 '20
Thank you!! Yeah I did all of the UI and animations myself, one of my main goals was to make a smooth feeling app so I focused heavily on the UI and animations, super glad you like them!
The animations API can be a little hard to grasp initially but once you get it, it will start to make sense and it is so powerful!
Honestly I just used trial and error and kept going back to the docs and re reading when I ran into a wall. Also something that really helped was looking at the source code of other libraries that use animations such as react-navigation.
One source I can recommend though that is a bit easier to understand than the animation API docs is https://animationbook.codedaily.io/introduction/
1
u/Hazy_Fantayzee Feb 04 '20
Thanks for replying, I guess nothing really beats trial and error! In regards to looking at source code of other libraries, I've given that a go but so many of them are in Typescript and as a TS virgin a lot of them are hard to follow. I'll def make more of an effort to poke around in them though as I progress.
Good luck with your future RN endeavors, looks like your a natural judging by your first effort!
2
u/J-Wh1zzy Feb 03 '20
This looks awesome! I love the gradient and how it flows through the graphs. Nice work. This looks really clean.
What library did you use for the graphs?
2
u/draftax5 Feb 04 '20
Thanks a lot! I forked react-native-svg-charts and customized it to allow the gradients!
2
u/A3mercury Feb 04 '20
Killer job! I’ve been getting back into working out this year and I feel the same way about apps out there now. Definitely just downloaded and I’m gonna give this a shot.
2
u/draftax5 Feb 04 '20
Thanks! If you try it out definitely let me know if you find any bugs or have any suggestions!
2
2
u/jmar31 Feb 04 '20
This is beautiful! A fantastic first app. Congratulations. Let me know if you’re looking to do your second ;)
1
2
Feb 04 '20
As a frontend developer currently working for a software company, this has motivated me massively to start learning React Native. We use React + Typescript day to day so hopefully it’s not too dissimilar and when (if) we move to native, I’ll have the jump start. Great work pal!
2
2
u/marius4896 Feb 04 '20 edited Feb 04 '20
Well done! really like the app. One question on that control to set the weight ( the dialer where you scroll horizontally) . i like how it stops only on predefined values. what did you use there?
1
u/draftax5 Feb 04 '20
I forked a similar slider Component I found, but really it is just a ScrollView Component that takes advantage of the snapToInterval prop :)
1
u/marius4896 Feb 04 '20
Can you please share with me the component you forked from?
2
u/draftax5 Feb 04 '20
Here you go: https://github.com/nicinabox/react-native-line-gauge
If you use the library directly try to give the author credit if you can! :)
1
2
2
u/heresmyfrickeface Feb 04 '20
Has anyone asked you how you made the demonstration video/gif yet? Amazing work x
1
u/draftax5 Feb 04 '20
Hey thanks! I recorded the video with an iOS simulator using the command line to get the masks, and then I ran it through iMovie to get the background. I am super new to video editing so it was super basic haha
2
u/swese44 Apr 24 '20
Authentication is broken today :(
It's too bad this relies on server data instead of storing locally and doing a background sync. I can't even view my workout right now. Im guessing the app is probably not usable for people who work out where they don't have cell service or wifi.
2
u/draftax5 Apr 24 '20 edited Apr 24 '20
Server went down, fixed and working now.
I may work on moving towards local storage and background sync in the future but there are benefits to storing data on a server such as easier updates since I have access to the data, adding new features that require changing how things are stored, etc.
But there are downsides like you just experienced. So I am working towards something that will get the best of both worlds.
However, this app is free for everyone and I don't make any money off of it, actually I lose money by hosting it, dev account, etc. So major updates are not the highest thing on my priority list at the moment, I have been pretty busy so just maintaining has been enough haha. Hopefully you are enjoying the app otherwise!
1
1
2
4
1
u/OMDB-PiLoT Feb 03 '20
React Native ... no Android version? :(
8
u/draftax5 Feb 03 '20
Not currently. I mainly built it for myself and I have an iPhone, plus some of the animations and blurs are iOS only so I would have to implement those on android.However if anyone was interested in using it I could release it on android as well. Its FREE! lol
2
u/Lord_Cheese Feb 03 '20
I would love an Android version, and would be happy to provide feedback. I've been looking for literally this app for a long time.
1
u/draftax5 Feb 04 '20
Thanks! I would love the feedback! I am working on releasing the android version now!
4
u/patelrr_21 Feb 03 '20
Can you release on Android. Interested to look forward animations and performance specific for android. Actually I am thinking of building an app on react native :p
2
1
u/tjsix Feb 03 '20
Just a heads up, on my iPhone 8, if I tap 'Other Sign Up Options' on the main login screen, the 'Sign Up' button on the email/pw screen overlaps the 'Social Sign In Options' button. Also on the Sign in with Email page, the Forgot Password? link overlaps the social sign in button as well
2
1
u/dtome00 Feb 03 '20
Looks pretty cool, I downloaded it and will let you know what I think. If you don’t mind me asking, how did you learn React Native? I’m a sophomore comp sci student proficient in Java Python SQL and C, and I really want to learn RN.
2
u/draftax5 Feb 03 '20
u/dtome00 Awesome! Any feedback (bugs or errors you find) will be greatly appreciated cause I am sure there are tons!
I jumped over to React Native after learning React, which I kind of self taught myself but I have more of a functional programming background vs yours sounds like more of a traditional object oriented background.
Both the React & React Native docs are great so I would start there, just keep in mind that the programming style might be a little weird for you at first since the React mindset is more functional IMO (even moving away from classes).
1
1
u/ejDiDon Feb 03 '20
How did you build the bottom bar ..any suggestion or direction been trying to find how to build he same
1
u/draftax5 Feb 03 '20
Hey! Yea I am using React navigation for all of the navigation, so I just subbed out the navigation bar with my own custom one, they provide a prop to give your own navigation bar.
As for building the bar itself, it depends how you are going to hook it into your navigation but since I wanted mine to work with react-navigation I forked their bottom tab bar Component and then changed the functionality and styling to suit my needs (to allow the middle button to open a modal with more buttons, etc). And the rest is just animations.
That way I could see what props were required, what was used, etc and I knew what I needed to change.
I hope that helps!
1
1
u/peterrattew Feb 03 '20
Looks amazing, great UI and UX. Have you ever used Fitocracy? Similar functionality.
1
1
Feb 04 '20
The app design looks great, love having the option to sign in with Apple. So far the only suggestion I have is when you sign up have like a setup screen where the user is promoted to enter their name, age, weight and goals opposed to the user having to search for it and add it to blank fields.
1
u/draftax5 Feb 04 '20
Thank you for the feedback! That makes a lot of sense and I definitely want to add some sort of setup / onboarding screen!
1
1
u/jasdeep13 Feb 04 '20
That’s a sweet and yummy app man! Kudos for putting this up live.
Whats your github if you don’t mind sharing?
1
u/draftax5 Feb 04 '20
Hey man, I will PM it to you!
1
u/versay_Y Feb 04 '20
Hey man, I will PM it to you!
Hey, can you PM me aswell with a github link? I'm curious how you organize your project and probably will learn a few things from it. Thanks!
1
u/style-112 Feb 04 '20
Hi /u/draftax5 I am doing a React Native course on Udemy and would really like to look closer into your app and learn from it. it contains anything that and app should have. Would you mind sharing it with me as well. Thx so much!
1
u/Nealoke9120 Feb 04 '20
Can I ask how you handle logging in with Facebook on your back-end? :)
2
u/draftax5 Feb 04 '20
Yeah for sure, basically I just use oAuth to get a facebook key for the user and then send that to my backend, from there I forward the key along with my apps secret key to facebook to retrieve the profile image, email, and name, create the account in my DB and then log the user in!
1
u/Nealoke9120 Feb 12 '20
Thanks! And how do you handle it for email logins? Did you create a JWT that is valid forever or such a thing? :)
1
u/draftax5 Feb 13 '20
I use JWT for everything, but they have a very short expiration, like 15 minutes. This is a best practice, the benefit of JWT's is greatly diminished if they are valid long term.
I then auto renew the JWT if it is expired. If this fails then the user will have to log back in manually.
1
Feb 04 '20
Greate work body!!! Which navigation library did you use?
1
u/draftax5 Feb 04 '20
Hey thanks!! I used react-navigation and then I forked their bottom tab bar and customized it!
1
Feb 10 '20
Amazing work mate. I am just getting started with React native and I am curious of some of the stuff you used. How did you make the modal at the beginning that says BARBELL CURL are there any libraries for that? Also, which library did you use for navigation?
1
u/draftax5 Feb 13 '20
Hey, thanks! That "sheet" you are refering to is custom made, but it is just an absolutely positioned View with Animated Pan Handlers attached! I used React-Navigation but a lot of the UI for it was custom built.
1
u/amir129 Apr 10 '20
How did you built the timer? is there any library
1
u/draftax5 Apr 10 '20
Its custom built
1
u/amir129 Apr 10 '20
CD an you share some hints. I have a requirement to build similar to this.
Thanks
1
u/draftax5 Apr 10 '20
What kind of suggestions?
1
u/amir129 Apr 10 '20
Like how can I implement it. How did you use slide effect. Any component similar to that?
1
u/draftax5 Apr 10 '20
No Components really that will do that off the shelf, it's all custom built using Views and the Animated API. I would start by reading the docs for the Animated API, or you could try using the Reanimated library which can be easier to do certain things.
If you have specific questions I can try answering them but I can't really explain exactly how I built the entire thing, too much goes into it
2
2
2
2
2
2
2
u/AnteDelorean Feb 05 '20
The application looks very nice and no doubt very functional. But as an android user cannot check it by myself, so I would be very excited to have it for android! Really good job!
1
u/darkpiv Feb 03 '20
Very nice one, mate. Just wondering how do you implement the animation on plus(button) and some top button animation :D
1
u/sebastienlorber Feb 03 '20
looks great :)
Note: there's also another Ledger app that's actually opensource RN app, related to a bitcoin wallet https://github.com/LedgerHQ/ledger-live-mobile
1
u/AroXAlpha Feb 03 '20 edited Feb 03 '20
Hey, short bug finding. I entered my height in feet and changed to metric then. First, I think the calculation does not work correctly. I entered 6ft 2inch and the App then changed it to 174cm. Google says it’s 188cm. Second bug: I can’t change the height in the edit screen. Tried a restart of the app.
It also seems to not start any workout I create. Ohoh
Account created with Apple login
1
u/eazylaykzy Feb 03 '20
This is absolutely beautiful, just want to know, did you make use of expo for your development? And is there an Android version too, as I’ve checked the iOS version out, and it really looks great.
1
u/nyeupekubeba Feb 03 '20
Great work man! I wanted to make similar app in react native for more than a year, but I didn't have free time. All other apps are unusuable, I don't know who pays for that shit, The only one I could use was Strongly, I'm gonna try Ledger definitely!
One question, how did you made weight log horizontal scroller, some open source component, or custom made, love it.
And one suggestion, profile editor can't be canceled, and I hated clicking 91 times to enter my height. Maybe to implement some auto increase when holding +- buttons.
But overall, really great work, UI, animations, everything!
1
u/darrylyoung Feb 03 '20
Did you use Expo or just with the standard React Native CLI? I’m working on an Expo app now. I tried adding Sign In with Apple but it was a real pain to test.
The app looks great, by the way. Gonna have a play with it. Congratulations on the launch. I hope to be able to launch mine in the next couple of months, too.
1
1
1
u/harish2887 Feb 03 '20
Great UI really like it... Can you suggest some course I can follow to learn react native
1
u/ziggy723 Feb 03 '20
Can you expand more details about all of your dependencies like navigation, gestures, modals ect.? Did you use redux? Hooks?
1
u/casiotron Feb 03 '20
Great idea and interface! How much of the app using local storage vs remote? How do you handle storing data while keeping a seamless UI?
1
1
1
1
u/Nikosssgr Feb 04 '20
Very nice, and a lot of, work. You could also check `react-native-reanimated`, if you want to animate properties other than translation and opacity that run on UI thread entirely.
1
u/phytophilia Mar 03 '20
This looks great! Can you recommend any resources or guides for learning and practice!
1
0
Feb 03 '20
[deleted]
3
u/draftax5 Feb 03 '20
u/modestmeans Thank you so much for that feedback. It really means a lot that you took the time to look around. All of your suggestions make a lot of sense and I will definitely work on them.
This is my first full app so I am sure I missed quite a bit that I will have to go back and fix!
0
Feb 04 '20
[deleted]
2
u/draftax5 Feb 04 '20
Honestly the React docs are great, I am not huge into courses so I can't offer any that are worthwhile unfortunately :/
2
Feb 04 '20
[removed] — view removed comment
2
u/draftax5 Feb 04 '20
Hey, thanks!
It is a custom component that I built, I hook it into redux and redux-saga which is what triggers them.
They are called snackbars, at least that is what googles material design calls them :)
39
u/draftax5 Feb 03 '20 edited Feb 03 '20
I built this out of my own frustration with the weight lifting / workout apps currently out there. I don't necessarily want to choose from someone else's pre built workouts. I want an app where I can simply create my own workouts without having to choose from pre made workouts, where I can see and follow my progress with analytics, and where the app keeps track of my overall metrics such as weight, rest time, etc.
I couldn't find anything the really fit what I wanted well enough, so I built my own, partly to solve my problem, and also to gain more experience building a full scale application.
I built a landing page for it as well since I needed to host the API anyway:
Ledger
EDIT:
If you are interested in the stack:
Backend:
- Node /Express REST API with JWT for auth
- Used Joi to help with validation
DB:
- MongoDB
- I usually work with SQL databases and wanted to try out NoSQL. I figured the structure of a workout app with workout logs would make sense to use a NoSQL structure. It worked pretty well especially using the mongoose ODM.
Everything for the backend is dockerized and hosted on AWS
Using travis for CI which builds my images on successful tests pushes to my registry. I am fairly new to devops so I have a lot to learn here.
Frontend:
- I wanted to focus on custom Components so nearly everything is built from scratch. I wanted a smooth feel so I tried to focus heavily on animations.
- In my opinion one of the big benefits React Native has is their animations API so I heavily utilized that.
- Another focus was on charts and analytics, I custom built many of the charts using forked react-native-svg-charts Components.
Any questions just ask!