Live data from Hacker News

How Discord achieves native iOS performance with React Native

blog.discordapp.com

71–80 of 115 posts

Re: How Discord achieves native iOS performance with React Native

#71

React Native is excellent for web teams that are creating a new mobile app. If your team has more experience with React than native iOS/Android, then it's a no-brainer. However, in my experience you get diminishing returns once your app has passed v1 and your customers expect more after the new-ness wears off. You find yourself spending more and more engineering effort to make your RN app to feel as good as existing…

I use react native svg with low level d3.js utils to produce data visualizations with a utility class that holds all the animation values across components and screens which is sort of a hack but very clean for animating several pseudo svg components.

For me it isn't about look and feel so much as being able to quickly manage massive amounts of data for interaction and data viz. I use the ramda lenses, sagas, redux, and selector stack to manage state of the data. It is clean and quick to develop. Everything is memoized with selectors only changing if the reference to the object it is using on the state tree changes.

Nobody can work data the way I can with React. It makes sense.

Re: How Discord achieves native iOS performance with React Native

#72

Earlier quoted context omitted.

A spinner running in the background consuming CPU is two bugs... The non-obvious one is why is the framework consuming any CPU time at all on something not visible? When an element tries to animate, and the whole element is covered/offscreen, the framework should simply pause the animation. When the element becomes visible again, it's simple to calculate how long the element has been invisible, and fast-forward the a…

I’ve seen this happen especially with Lottie. And what basically happens here is the actual drawing isn’t actually handled by react-native since the library is itself a native view to either platform. Therefore, react-native has no idea it’s wasting any resources because it’s not technically “in charge” of what exactly the native view itself is doing . It certain scenarios where it might be “covered up”, such as all…

> How should you know this if you aren’t a native app builder?

My impression has been that to use RN well you need to mostly think like and have the knowledge of someone who is a native app developer. You just get some benefit of sharing UI across platforms, but still need to do many things you would for native.

I haven't used RN, just saw my friend who uses give a talk on it. So I certainly may not understand exactly how much native code you can or can't write while also using RN.

Re: How Discord achieves native iOS performance with React Native

#73
post #68

Earlier quoted context omitted.

If you’re going to remain within Apple platforms, try SwiftUi: https://developer.apple.com/tutorials/swiftui/ There may be a chance of it being adapted for other platforms in the future.

i highly doubt apple will port that to android, so unless they open source the technology...

It uses standard (or about to be standard) Swift language features, mainly the ability to write DSLs.

Maybe other developers who really really love Swift and SwiftUI might port it to their preferred platforms. :)

Re: How Discord achieves native iOS performance with React Native

#76

Earlier quoted context omitted.

The Swift for Android and iOS makes sense but how do you "easily" share same business logic between those other different platforms?

Swift will also work on Windows, and of course on MacOS (and Linux). If you prefer, you could use Kotlin in a similar role via kotlin-native.

But Swift won't work on Android. And Kotlin Native is severely compromised.

The lingua franca options are effectively Xamarin, Flutter, and React Native. Xamarin's dev experience sucks and Flutter's perf isn't much different from React Native with a way less mature ecosystem.

There are people who should write platform-native mobile apps. For everybody else, React Native is fine. And, for my money, TypeScript is the most right programming language easily available on major platforms today, so that makes this one pretty self-evident to me.

Re: How Discord achieves native iOS performance with React Native

#77
post #76

Earlier quoted context omitted.

Swift will also work on Windows, and of course on MacOS (and Linux). If you prefer, you could use Kotlin in a similar role via kotlin-native.

But Swift won't work on Android. And Kotlin Native is severely compromised. The lingua franca options are effectively Xamarin, Flutter, and React Native. Xamarin's dev experience sucks and Flutter's perf isn't much different from React Native with a way less mature ecosystem. There are people who should write platform-native mobile apps. For everybody else, React Native is fine . And, for my money, TypeScript is the…

Doesn’t QT belong on your list? Or am I missing something?

Re: How Discord achieves native iOS performance with React Native

#78
post #3

I recently tried to start a react native / typescript project, but the ecosystem confused me a lot. The various different tool recommended to create a project, some project templates not even compiling, the tons of different utilities required to process source files.. All that and not a single reliable source of documentation, made me feel it would be a real nightmare to maintain on the long run.

Is that really true? ‘react-native init AppName’ and your ready to go? What is wrong with react natives official documentation? I think what many mess up(me included) is to look at the wrong version of the documentation. I guess that could be a little bit more obvious. edir: oh, typescript! Yeah, that is a little bit more troublesome; https://facebook.github.io/react-native/blog/2018/05/07/usin...

> edir: oh, typescript! Yeah, that is a little bit more troublesome;

So appending '--typescript' is troublesome and not obvious? Like this?

react-native init AppName --typescript

That's it. I never knew in 2019 that adding an extra flag would be 'troublesome'. The description of your installation of a React Native and TypeScript project in 2018+ is greatly exaggerated.

Re: How Discord achieves native iOS performance with React Native

#79
post #78

Earlier quoted context omitted.

Is that really true? ‘react-native init AppName’ and your ready to go? What is wrong with react natives official documentation? I think what many mess up(me included) is to look at the wrong version of the documentation. I guess that could be a little bit more obvious. edir: oh, typescript! Yeah, that is a little bit more troublesome; https://facebook.github.io/react-native/blog/2018/05/07/usin...

> edir: oh, typescript! Yeah, that is a little bit more troublesome; So appending '--typescript' is troublesome and not obvious? Like this? react-native init AppName --typescript That's it. I never knew in 2019 that adding an extra flag would be 'troublesome'. The description of your installation of a React Native and TypeScript project in 2018+ is greatly exaggerated.

I followed this https://facebook.github.io/react-native/docs/typescript

Nothing worked.

Re: How Discord achieves native iOS performance with React Native

#80
post #59
post #27

Earlier quoted context omitted.

For that I am using the compiler which allows C#, Go, Swift code to mixed. It’s really great. So with some work you could use existing C# code even in your mobile apps. I am liking it so far :)

Which compiler is this?

I think this is a reference to RemObjects Elements
Post reply on HN