Discord Switching to React Native for Android App
discord.com
discord.com
My company recently switched both our Android and iOS apps over from native to RN. The RN promoters promised all sorts of benefits about sharing code between platforms and how the performance would be as good as native, and how the UI would look like native, and none of that actually materialized:
- In the end, RN code is only something like 20% of our Android app. They weren't able to just "write once" and run on both.
- Instead of having 2 teams, an iOS and Android, now we have 3 teams, iOS native, Android native, and RN. And the RN team is split between iOS and Android. All sorts of additional complexity now.
- We still need a fully staffed Android specific team for everything that couldn't be done in RN.
- The performance difference vs. a native app is blatantly obvious.
- Now we just have organizational problems as the app has multiple teams/languages involved, different parts of the app are owned by different teams and manager chains, rather than just one team of people that own making a good app. RN teams can dynamically push code changes to production apps and we no longer have deterministic, reproducible builds.
- Now we have morale issues from the discontent from the team members that want nothing to do with RN.
- The UI, even though it's supposed to use native controls, just does not look and feel like native apps, there's so many little things that are strange/different.
- Our codebase is now dependent on a 3rd party platform and on a language that completely differs from how Google says that Android apps should be built. Why wouldn't we just build Android apps the way the Android team says we should? Is there going to be long term support for RN/JS?
This is exactly where we were going with our RN skunkworks project before it was axed and rewritten fully in native. however in our case we had about 100 native screens on both platforms written in swift/java that upper management did not want to spend time rewriting to RN, so it kind of forced our hand back to native to stay sane.
> The RN promoters promised all sorts of benefits about sharing code between platforms and how the performance would be as good as native, and how the UI would look like native, and none of that actually materialized
We've pretty much seen all of this materialize. Our native apps perform great, look great, feel native. There's a tiny bit of platform-specific code around the edges, mostly for integrations with third party libraries. But 90+% of our code is shared, idiomatic React code, and mostly only the team lead ever has to dig beneath that. The whole team for both apps together is around 10 people, and most of them never have to step outside of JS. They also have an easy time making changes in our React web app (and the web team has an easy time making changes in RN) because the skillsets largely overlap.
> RN teams can dynamically push code changes to production apps and we no longer have deterministic, reproducible builds
Ok- but nothing about RN forces you to use the dynamic code push feature. In fact, we just decided as an org that we wanted to reduce our usage of it. This sounds like an organizational issue.
I have to ask, what kind of app were y'all building? I could see this varying widely based on that. Ours is a fairly straightforward finance app
Incrementally adding react native to an existing app is orders of magnitude harder than using react native from the start
I say this as a react native developer with some native android experience. React native is awesome, but most of the success stories are apps 100% react native or mostly react native with a few sprinkles of native code for some custom functionality
Also 3rd party libraries that are not maintained by Expo is usually better to be avoided, if you need some niche functionality just drop to native. And yes it does mean you now have 3 problems, but at least, summed together, those three problems are smaller than the previous 2 big ones
A simpler explanation is that "you have to go 100% in on React Native" self-selects for anecdotes from tiny companies tackling trivial problems, and allows one to say "No true scotsman" when a bigger company has a bad experience.
React Native is absolutely a business win, but a developer loss.
PM/Manager can advertise shared code base, and even sometimes hire less, or at least argue that they should be able to hire less, but really it ends up being a nightmare for the teams that have to use RN for all the reasons you've listed.
I work for a company that builds a very advanced mobile application (not your basic CRUD) and unfortunately the previous frontend manager decided on RN. The result is a 50% RN 50% native codebase which is a nightmare to traverse, and impossible to hire for. We need effectively 3 teams, RN / JS / TS, Java, and Swift.
The complexity added is absurd. The tooling, typescript, building, all of it. Going completely native drops all of that and allows developers to focus entirely on their craft - building rather than context switching all day long between JS / TS and Java / Swift.
Hands down the worst part is the performance. There is a very obvious performance hit in nearly all UI interactions.
If you're building out your mobile team and building a complex app, I highly recommend you do not use RN.
I think this is your problem right here. By nature, most higher-level abstractions will work better for mainstream/expected use-cases. If you're really pushing the envelope, I can see why an abstracted framework wouldn't work for you. For my company (which does have a straightforward CRUD app), it's worked out great. Very little native code on either platform
> - In the end, RN code is only something like 20% of our Android app. They weren't able to just "write once" and run on both.
That has nothing to do with RN, that's on your company
> - Instead of having 2 teams, an iOS and Android, now we have 3 teams, iOS native, Android native, and RN. And the RN team is split between iOS and Android. All sorts of additional complexity now.
Again, your company/ mgmt. We shared code between iOS and Android and had zero native module maintenance.
> - We still need a fully staffed Android specific team for everything that couldn't be done in RN.
which was what exactly?
> - The performance difference vs. a native app is blatantly obvious.
The majority of apps within the app store could've been written in RN and you wouldn't know/ notice. Discords iOS App is written in RN and I bet a huge amount of commenters here wouldn't have know without reading the article.
interface 'wl_output' has no event 4https://discord.com/blog/why-discord-is-sticking-with-react-...
react-native is NOT a total replacement for native code, you still need native devs. It is more like instead of 5 ios and 5 android devs you need 4 JS, 1 android and 1 ios devs (but the ios and android persons also need to know JS)
One thing that isn't super clear in the article: Is their iOS app already on React Native?
Edit: Seems like it https://discord.com/blog/how-discord-achieves-native-ios-per...
[0]: https://browser.geekbench.com/ios_devices/iphone-11 [1]: https://browser.geekbench.com/android_devices/samsung-sm-s90...
- There were very little opportunities for sharing functionality between web and mobile. The standard react architecture is code-behind, and you can't share components between react and react native.
- Time-consuming to update to new versions, especially on the IOS side of things. A constant avalanche of errors from the very convoluted cocoapods build system, with stack traces in multiple different languages popping up (From memory: bash, objective C, swift, ruby). Involved a deep dives into github issues.
- In the end we were at least able to share some validation stuff between the web and mobile app, which was better than nothing.
Full disclaimer - I was a busy tech lead, wasn't very hands on with it, and in my teams the mobile app was a secondary concern.
Very curious if other people have a different experience.
I will say, I don't think sharing code between web and mobile was ever supposed to be a key advantage. As you say, there may be some small opportunities for that, but the real benefits are a) sharing code between the two mobile platforms, and b) sharing skillsets between web and mobile
but a lot of things are, not clunky per se, but unsolved for web. Main example is JS-based tooltips, react-native-web doesn't give you one and it doesn't make sense to do it in mobile. So you end up needing a lot of if platform === 'web' do this, way more than just supporting ios+android
updating to new versions is a huge pain, I usually default to making a new project from scratch and re-introducing our custom native code. Having iOS build knowledge helps a lot
Because safari sucks and that makes webview suck too. It's like asking why people don't use ie6 for web apps.
I wonder why Rockstar or Bethesda don't just use electron for their games.
Leaving the sarcasm aside, I'm tired of people arguing Electron has no performance/memory/whatever cost. It's worse at everything compared to native programs except developer experience.
I understand valuing your developers' time more than your users' (which is a bit backwards but whatever), but don't argue that Electron is not a tower of abstractions that has no cost at runtime. That's just not true.
This fake paradise of "one app to rule them all" is absolute madness to me now.
Unfortunately, by far the closest thing we have to this is Google Chrome.
The first question that popped into my head when I saw this headline was: Is React Native still a hot mess?
Expo [0] is what really makes things painless now. There's no more struggling with native binary dependency hell. And the entire App store submission process is completely managed; building, signing, uploading, and pushing a new version from your machine to Apple is just a single CLI command.
https://dev.to/mauro_codes/expo-101-building-mobile-apps-in-...
I was relying on the Android app for notifications... but if it's now becoming as bad as the Windows and the Web apps, that's going to be an issue. I can't uninstall it from everywhere, not a messaging app.
That said, seems like Android users really dislike this update as the app seems slower, buggier and less polished than it used to be.
The bigger wins come from shared tooling/skillset/headspace. Our UI devs can fairly easily jump back and forth between the two codebases
Though our web app does a lot of things the mobile app doesn't, and also benefits from things like Next.js, so I'd be a little worried about the cost/value tradeoff there for us specifically
If the app gets any laggier or slower I will probably have to abandon it...
Moving from native to react native will almost certainly be slower (unless something in their native app is just very broken).