Martin Konicek
1 min readFeb 4, 2018

--

Thanks for writing this, very useful article!

Regarding the OkHttp dependency: I’m integrating React Native into an existing Android app now, and I’m thinking I could replace React Native’s networking module with our module that uses our existing OkHttp networking stack. That way all network calls from JS will simply go through the same exact stack as Retrofit network calls (using the same auth token), and there’s no issue of multiple OkHttp versions.

To do this, I won’t be using the MainReactPackage as is, but will pick bits of it as needed, replacing parts. Instagram did the same (blog post). I feel like the MainReactPackage is great for standalone React Native-only apps but in hybrid apps it makes sense to make React Native more integrated with the existing app infrastructure. Another example is the MainReactPackage depends on Fresco to support the <Image> component, but your app might be using Glide — it’s best for JS code to use Glide and share image cache with the rest of your app, and then you don’t need to depend on Fresco.

That’s my plan so far, going to experiment with it soon.

Have you looked into doing this? It’s quite a bit of work but the benefits seem compelling.

--

--