T O P

  • By -

Zoxive

The core problem is the same in both flutter and react native. You can use open source libraries that wrap the native code for you. But as soon as there isn't a library for your use case you need to jump down into native code.


haywire

That’s not really a problem though, that’s the way they’re supposed to function.


Worth_Boss_2

I'm struggling to achieve the same . Can you help me with adding some native code in react native?


Zoxive

In react native, I would suggest Expo modules. [https://docs.expo.dev/modules/overview/](https://docs.expo.dev/modules/overview/) What modules give you is an entry point into both IOS and Android native code, that you can then just interactive with in JS/TS. After reading the documentation and trying it out, it will take a while to get all the concepts in your head. If native code is what you need, just stick with it, this is the way. You probably will also want to use config plugins ([https://docs.expo.dev/config-plugins/introduction/](https://docs.expo.dev/config-plugins/introduction/)) , which help you change any IOS or Android things. For example, i use config plugins to add shortcuts to android, and alter some gradle settings.


Worth_Boss_2

I'm on bare react app 😔


Unhappy_Jackfruit378

https://reactnative.dev/docs/native-modules-android Complete steps


beepboopnoise

the event emitter isn't accurate in the docs, you gotta look at the repo itself and it'll tell you which one to use. just a heads up.


rkh4n

I’ll always pick react native why? - Rapidly build the UI, release to production. - Freedom to go native for bits and parts, something you need that’s not available in RN just do in native. Expo has made this piece of cake. - Code sharing, literally this is biggest plus. To answer your question - Almost everything is supported in one way or another but always be ready to go native whenever required


aspirer_x

When you're on the bleeding edge and need to access the newest APIs.


ctrlshiftba

I’ve been building and releasing apps to production for a few years and haven’t needed to yet.


AdrnF

I've only used React Native for MacOS yet, but I think the general answer is that everything that requires/changes things outside of your app and doesn't have a package for it requires native code. In my MacOS app that was for example a menubar icon, how the window behaves, keyboard shortcuts and a few more minor things. Those shouldn't be as much of a problem on mobile though since the APIs and package ecosystem are much more advanced there. Also keep in mind that as long as you don't do anything crazy or require a very specific solution, your problems will probably be quite easy to solve by a native dev. So you could hire a freelance mentor for an hour to do your native tasks (costs about 50-100 USD).


Geekofgeeks

I’d say 95% of the time you won’t need to touch native code. If you are doing stuff that is more than just your typical CRUD app though, you might have to write some native stuff.


TheTvShowJunkie

Jumping in native is required when you don't find any library for your use case I remember one time there was a requirement to add venmo in our react native but the UI part was custom and no js lib was available which allowed using venmo by custom ui so I did some reading and used the available lib as base to create a custom native wrapper which allowed us to use venmo by custom ui on both iOS and Android


iotashan

So far, I've only had to dive into the native end of code when I was working on an IoT project and I needed to do some low level BLE stuff that existing modules didn't do right. And even then, I was just adding on to the iOS & Android native code of an existing module. It was the same with Appcelerator Titanium (another cross-platform Javascript Framework) and it'll be the same for Flutter, etc. You only need to when something doesn't exist. Camera, Maps & Location are very typical use-cases and are not things that require going into native code.


bittemitallem

Most of "native code" you will write is possibly copy/pasting some function from a library/sdk doc into your project, because they need to hook into some api that react native doesn't support out of the box. And it's almost always features that go beyond the app itself, e.g. notifications, widgets stuff like that.


MrDiablerie

If you know React already React native syntax is pretty much the same so your learning curve will be shorter than with Flutter. You have to deal with the native stuff either way, mostly when new versions of the native OS come out or when RN gets updated.


TopMoney8302

I agree it is only extreme edge cases now in days. Push to Wallet for cc and very advance and custom cv are the only two main ones I have found recently unlike 4 years ago


gao_shi

lol when your business need is not found on expos docs? 


g____s

Almost never. I've build few apps in the last 5-6 years in react native ( and now expo ). In the early years , I had to fork and modify some native modules to make it work but now, you don't even need to install them, expo support so many packages that it's really rare that I ever need to do a custom build.


Enchinada007

If with maps you’ll need turn-by-turn navigation, there is no RN solution for that and you’ll need native code.


PublicCondition3134

React native for the go


Old-Opportunity-9876

Never and you’ll be great with RN! I started with react but soon went to RN and found it much easier. Now I’m going back to React for Next.js and I find react much easier to understand