r/reactnative • • Jan 03 '20

An app I built using react native

207 Upvotes

64 comments sorted by

16

u/_rustafarian Jan 03 '20

Hi there. I just wanted to showcase an app I was working on recently. It uses Typescript and Apollo Client on the front-end and GraphQL (Hasura) and firebase on the back-end. Please feel free to ask any questions.

3

u/MikeyN0 Jan 03 '20

What's the interaction between GraphQL and Firebase?

8

u/_rustafarian Jan 03 '20

I use firebase for authencation, so whenever a new user is created, a cloud function is triggered to store that user in my GraphQL backend. I also use cloud functions for sending SMS messages and making payments.

2

u/[deleted] Jan 03 '20

Is nodejs with mongoDB as viable as firebase? Do I have to pay to use firebase?

1

u/_rustafarian Jan 03 '20

I like firebase better because I don't have to setup my own backend, maintain it or scale it. Firebase just handles all of that for me and it's very easy to get started with. As for pricing, It has a generous free plan and also there's a pay on the go plan, so you'd only pay for the resources you're using.

1

u/Jeffylew77 Jan 03 '20

u/_rustafarian What are the benefits to using Apollo Client?

1

u/_rustafarian Jan 03 '20

If you have a graphical backend, you have to use a GraphQL client on the front end and Apollo Client is most popular one. I like it because it is featreful and works really with the react. Here is somethings I like about it:

  • supports react hooks

  • provides the different UI states when fetching data (loading, error, data)

  • caches things internally

1

u/Jeffylew77 Jan 07 '20

u/_rustafarian did you use Firebase cloud firestore as your database? That’s what I’m using and I’m looking to utilize in memory cache. I’m also redux, react redux, redux saga, and redux saga Firebase for global state/async calls if that changes anything.

2

u/_rustafarian Jan 07 '20

No I'm not using firestore. The parts of firebase I'm using are hosting, cloud functions, authentication, analytics and crashlytics. I'm using Postgres for my database in combination with Hasura. https://github.com/hasura/graphql-engine.

1

u/Jeffylew77 Jan 07 '20

Any reason you chose Postgres + hasura instead of cloud firestore? The app I’m building will eventually be used at scale, so I still trying to figure out the best path to go. Eventually I want to move over to AWS, but Firebase is easier to setup

1

u/_rustafarian Jan 08 '20

Well I wanted a GraphQL backend and Hasura is just a joy to work with and it's very performent as well. It can handle hunderds of requests per second on a relatively cheap machine. I still use cloud functions but for other things like sending sms messages and making payments.

4

u/angarali06 Jan 03 '20

18 dollars for a coffee?? Wow..

2

u/_rustafarian Jan 03 '20

Well it is magical after all :D it's actually not real data

3

u/tschoffelen Jan 04 '20

Love that loading animation!

Is that my react-native-map-link library I see there for the directions? 😊

2

u/_rustafarian Jan 04 '20

It is! Thank you for open sourcing it! My app wouldn't have been possible without people like you.

2

u/[deleted] Jan 03 '20

What did you use for navigation?

2

u/a_cam_on_the_dash Jan 03 '20

really nice. did you use a UI library for those material cards? they look so good

2

u/barakcodes Jan 03 '20

Sick app!!smooth interactions

1

u/_rustafarian Jan 03 '20

Thank you :)

2

u/equal_odds Jan 03 '20

How long did this take you from start to finish? (Not including the months/years of experience that led to this point lol)

3

u/_rustafarian Jan 03 '20

I think all in all maybe around 200-250 hours. This includes desinging, implementing, testing and deploying on both iOS & Android

1

u/hohooio82 Jan 03 '20

do you recommend any course or youtube channel?

1

u/_rustafarian Jan 03 '20

I haven't taken any courses so I can't really recommend any, sorry.

2

u/hohooio82 Jan 03 '20

how did you learn?

6

u/_rustafarian Jan 03 '20

A lot of reading and looking at other people's code. Also building apps on my own. This is not my first app :). I've been working with react for a few years now.

1

u/Jeffylew77 Jan 03 '20

Unsure programmer has good courses on YouTube for react native. Also Stephen girders class in udemy for react native

1

u/ThatSpookySJW Jan 03 '20

Are these stored in your db or are they using google's places api?

3

u/_rustafarian Jan 03 '20 edited Jan 03 '20

They are saved in my Postgres database and I'm using PostGIS to do geolcation calculations. I do however store the google place_id so I can link to them in Google maps.

1

u/ShamelessC Jan 03 '20

Are the images stored locally? The lazy loading is very well done, of course, but the images do take awhile to show up. I assume they're behind an API call? Is there any way to cache all the images in the user's zip code (for instance)?

2

u/_rustafarian Jan 03 '20

The images are loaded from the server. And I'm using https://github.com/DylanVann/react-native-fast-image which caches them internally. To get around the images loading slower, I could probably use smaller images. I'm currently using (600x400) I think. Also my connection isn't that great tbh

3

u/ShamelessC Jan 03 '20

It's good to test on a slow connection anyway because your users will often be on slow cellular connections.

Great work though. Lower resolution images would be a great addition for a new version.

1

u/goughjo Mar 28 '22

How do businesses get onto this platform? Can they manage their menu through the app? Can they sign up through the app?

Well done btw. Looks really good.

1

u/mikewill12inc Jan 03 '20

How hard is transition from react to react native?

4

u/_rustafarian Jan 03 '20

My background is in web development and honestly the transation to react native was not that bad. I did struggle at the beginning with learning how to use xcode and Android studio individually and getting familiar with the build systems (Gradle & Cocoapods) but I guess if you use Expo it can alleviate some of those pains.

1

u/chazzeromus Jan 03 '20

I knew a developer that was kinda rasta and talked about rust a lot, could that be you? lol (florida?)

1

u/_rustafarian Jan 03 '20

Oh lol no. Have no clue who you're talking about.

1

u/chazzeromus Jan 03 '20

just looked at your username and reminded me of him, if rusafarian comes from rustlang and rustafarian lol

1

u/SnowiNinja Jan 03 '20

How did u do the coffee loading indicator screen?

4

u/_rustafarian Jan 03 '20

I used Lottie animations https://github.com/react-native-community/lottie-react-native. And over hear you can find a whole library of animations, including loading indicators https://lottiefiles.com/

1

u/pimplyteen Jan 03 '20

Would you be interested in integrating this with CLOVER API?

Could be awesome...

1

u/_rustafarian Jan 03 '20

Not really sure what Clover is. Would you care to elaborate?

1

u/pimplyteen Jan 03 '20

https://docs.clover.com/clover-platform/reference

Its a big POS system with an open API...Would be amazing for the app.

1

u/_rustafarian Jan 03 '20

Looks very interesting. Are you affiliated with them in any way?

1

u/pimplyteen Jan 03 '20

I have clients that use their POS...so ur app is interesting because would be a smooth transition to a full functioning mobile app for end users.

1

u/numice Jan 03 '20

Do you use expo?

1

u/_rustafarian Jan 03 '20

This project doesn't use Expo. It's a standalone react native project.

1

u/kcilc1 Jan 03 '20

Any thoughts on react native navigation vs react navigation?

3

u/_rustafarian Jan 03 '20

When I started this project I actually started with react navigation v5 but I wasn't happy with the performance at all. Especially on Android. I have a 4 year old phone and I just wasn't satisfied with how it performed on it. So I switched to react native navigation and it felt a lot smoother

0

u/tsouhaieb Jan 03 '20

Is it open source ?

1

u/_rustafarian Jan 03 '20

Unfortunately not. It's all built from open source libraries tho

0

u/MrGurns Jan 03 '20

I hope you used the decorator pattern.

1

u/_rustafarian Jan 03 '20

Not sure what you're talking about really

1

u/MrGurns Jan 03 '20

1

u/_rustafarian Jan 03 '20

Thanks for the links. It's funny that these things have names. So basically the decorater pattern is a way to extend objects without modifying the original. Well if you excersise immutability and functional programming you get that behavior automatically, and luckily that's what I'm doing.

0

u/[deleted] Jan 03 '20

[deleted]

8

u/_rustafarian Jan 03 '20

1

u/arashcuzi Jan 05 '20

One more q, what UI component framework did you use? Or did you hand code them all? I’m struggling with not finding one that has all I need, been using a combination of native-base and react-native-paper for components, coupled with a bit of inline styles here and there...might try styled-components at some point, but I don’t have the time to mess with that, I need my proto out pronto

1

u/_rustafarian Jan 05 '20

I mostly use react-native-paper with some customization. They provide a pretty good set of low level compenents that I use build out my UI.

1

u/arashcuzi Jan 05 '20

Jeez, sorry for all the q, how hard was integrating the google maps api? I’m looking to do something similar where you might type in the name of a place and have the google map sdk suggest the address, that way I don’t have to make people manually type in addresses for their events...

2

u/_rustafarian Jan 05 '20

No problem happy to help. The sort of functionality you're looking for is provided by this library https://github.com/tolu360/react-native-google-places the down side to it tho is you don't have any control over how the UI looks. If you want something more custom, you have to build your own UI and call the google place api directly yourself.

1

u/[deleted] Jan 07 '20

[removed] — view removed comment

2

u/_rustafarian Jan 07 '20

Apollo client removed most of the need for local state management. I didn't have a lot of global state, but I just used react context for that.