DEV Community

loading...

React Native VS React Native Expo?

Patrick Wendo
Learnt Calculus for the Memes.
・3 min read

In the beginning, there was a class assignment

So the semester is back in swing and as a CS student, that means a bunch of projects, coffee and video games to 'relax'. (lol). One of these projects was for my user interface class was to build a simple android app that audibly recognizes the users voice when they say 'red' or 'blue' and then changes the screen to that color while saying "Here is a red screen" or "Here is a blue screen" respectively.

Seems pretty straight forward, yea? Well yes, it is. Now since we had a free year last year cause of that virus I heard was going around, (still is, stay safe guys, vaccines work, get vaccinated), I learned how to use React Native and Expo to build android apps. This was mostly stirred by the fact that my laptop with 4GB of RAM would not even attempt to run android studio. Basically a potato with regards to running android studio.

So now I have the technology to build this app in. I obviously go for React-Native Expo, because it's easier to build there and test it on the expo go mobile app. This is also a plus cause it was a group project and we could all see the changes on our separate devices. Now on to the interesting part, how to build the app.

For voice recognition, I figured, lets just use IBM Watson's Speech To Text functionality. How this would work would be to record audio from the user, send that audio to the IBM Watson recognize API, then get a response with the transcript. Seems easy enough. Except that it wasn't. It took a lot of working through multiple bugs to finally get a 200 response from IBM and that response had an empty transcript. I have no idea what the issue was.

I was stuck for a while. Reason being, most of the speech recognition libraries available for react native would not run on react native expo. To run them, this meant I would have to eject the expo app. And I did not want to do this, because again, Potato PC

Seeing as I couldn't run android studio, I looked around online to see if there was a way to build the app using the terminal instead, and well, the gods were kind to me. Once I realised this, I knew it wouldn't take long to build the app on react-native as the libraries were proven to work there. Sure enough, the entire project took only 4 hours to finish with react-native as opposed to me trying to debug why Watson was leaving me on read for 2 weeks straight. (Also shout out to Dan for giving me the idea to just use the Android SpeechRecognizer. Simple, and effective hack)

So, React Native, or React Native Expo??

Well, here's a good delimiter, if the core functionality of your project runs on both, I suggest you use expo. It works amazing and you can collaborate online here. With the Expo Go app, the development process is made so much easier. However, if the core functionality of your project is hindered by a library not being available on Expo and you can't find a workaround, just use good ol' React Native. It won't kill you.

Anyway, if anyone is interested in the code for the app, you can find it here. Nothing Fancy. Till next time.

Discussion (0)