4 ms·
The common thread I see is that mixing native and react-native is hard. Doing so while working across organizations that may or may not use react-native is doub
by eysquared 8y ago
The common thread I see is that mixing native and react-native is hard. Doing so while working across organizations that may or may not use react-native is doubly so. Sometimes this boils down to the technology, knowledge, and the engineering systems needed to support both but I've also found native developers tend to strongly dislike react-native and lobby against whenever they can.
For me, I'm using it to successfully build mobile apps for a large tech company with very limited mobile developer resources. We've been able to ship Android and iOS apps in a couple months using 100% react-native. I attribute a lot of this to knowing the limitations of the platform and designing a cross-platform experience from the start rather than trying to get the "best of native" out of abstracted JavaScript.
I'll always argue that native is the way to go for the best user experience but react-native is a great tool to have in the mobile space.
- danabramov 8y ago>The common thread I see is that mixing native and react-native is hard. We've experienced some of the difficulties in this area at Facebook as well. If you're curious, making native <-> JS integration more seamless is a big motivation for the ongoing architectural revamp that we've recently posted about: http://facebook.github.io/react-native/blog/2018/06/14/state-of-react-native-2018.html http://facebook.github.io/react-native/blog/2018/06/14/state... It's a shame we weren't fast enough to help Airbnb in these areas, but the native interop will get better when the revamp is finished.
- eysquared 8y agoI'm excited about the proposed changes and think they are a step in the right direction, but I also worry that they will add more fuel to the fire that react-native as a platform is a constant moving target. You obviously have much more insight into what the re-architecture will entail than I do but I've heard a lot of worry around that post with regards to backwards compatibility of third party libraries and in-house native components.
- philipwhiuk 8y agoCouldn't agree more - AirBnB were already saying upgrading is a pain and this sounds like it'll be substantial. I hope RN is going to stop relying on beta code for releases too.
- danabramov 8y agoTo provide some extra context on this: at FB, we can't ship any RN update (or really, any RN commit) without updating our own apps for it. No product teams at FB are going to agree to rewrite their code just because an infrastructure team came up with a new way to do something. The reason updates are easier at FB mostly has to do with atomicity of commits. Because FB uses RN from master (and in practice all code lives in the same monorepo), codemods can be applied to products together with the corresponding infrastructure changes. Since the upgrades have a commit granularity instead of the monthly stable releases we cut in open source, there are no big delays between a regression being introduced and fixed for FB products. This discrepancy is unfortunate, but I don’t really see a way around it for an actively developed library--which might be your point. Undoubtedly RN is in active development, and being a moving target, it's easier for FB teams to “follow” it. Still, large backwards-incompatible changes are just as infeasible for us as for everybody else without either an automated codemod or an opt-in strategy.
- guelo 8y agoWow thanks, that explains a lot. So Facebook basically treats RN as an internal library, a single commit can change the framework API and the implementation at the same time so the constant API churn is not a problem.
- danabramov 8y agoI'm talking about mostly mechanical changes (think find-and-replace or slightly more involved). Those are easier to do because they can be done on both RN and products at once. This doesn't work for any larger changes because nobody is able to rewrite a ton of files by hand just to change some API. So this is why we can't make big changes to the API without a gradual adoption strategy, even internally.
- tspike 8y agoAny plans to fix all of the build warnings RN produces for native devs?
- ascorbic 8y agoI did find it ironic while reading it that most of their pain was related to mixing React Native with a large, existing native app, yet that's exactly how you're using it at Facebook. I'm interested to watch how you get on in fixing this. In my use we've hardly met any of those problems. I work for an agency, and the apps we've used it for are small or medium sized. All are new apps without legacy native components, and none of them mix RN with native outside of plugins. We also use 100% TypeScript now, which fixes a lot of their error-checking issues. Perhaps most importantly, I'm one of the few developers with significant native experience, so we're not encountering the cultural problems that they describe in the posts, of developers resistant to using the tech.
- tomduncalf 8y agoInterested to see what developments occur in this area, it’s a part of React Native I’m very familiar with as the product we are building has a native (C++) audio engine with a React Native GUI. Would be more than happy to discuss what we are doing, our experiences so far, and how we are planning to improve the integration on our end if it might be relevant to what the RN team are looking at. That said, the experience we’ve had has largely been positive and I don’t think we could have achieved what we have so far given team size and time constraints without React Native. I suspect it gets more painful if you try to combine native and RN GUI elements - our UI is purely RN so there is a fairly clear separation of concerns.
- kgin 8y agoThat was my take away as well, which makes sense. I think trying to seamlessly merge functionality across any two paradigms is going to be tougher than sticking with just one or the other. But for any company with an existing app, mixing in is the most likely first baby step into react native.
- filleduchaos 8y agoIt's not just a baby step. For lots of people who are doing more involved work than a thin, straightforward frontend for a server, there are things that are just worse or practically impossible to implement with React Native/JS alone, meaning you'll have to keep falling back on native code. A 100% RN app is simply not feasible for a lot of teams.
- mephitix 8y agoI invested a lot into a full React webapp - it would be great to share some of that code with mobile apps. I have an iOS background but was intending to make a RN app so that I could share the bulk of the React webapp code and get Android support as well. I have separation of container components and presentational SFCs so I’m thinking I could easily re-implement UI layers in RN if I wanted to without sacrificing the shared code. Do you think this is a reasonable approach? Or should I ditch RN completely and build native...? It would be nice if there was a way I could pull that shared JS logic (which really doesn’t have much dependencies) into mostly-native apps without having to adopt RN... maybe I could just repurpose the JS bridge and be aware of its limitations (a sync/serialized/batched..)
- eysquared 8y agoI do just that between a web front end I own and a RN app. We write as much pure JS as we can so we can re-use the logic. For sharing presentation, I'm hopeful for solutions like react-native-web.
- ascorbic 8y agoJust use RN. It works great for sharing non-UI code.
- bigmanwalter 8y agoLook into Cordova. It can wrap your static frontend in a multiplatform app that runs inside a chromeless web browser. Super easy to set up and use. Adobe even offers an online build service, PhoneGap Build, which can build Corodva applications for iOS without needing a Mac! I have successfully used this approach to develop applications for both Android and iOS.
- mephitix 8y agoThanks. I think I might try this out first since there isn't much overhead. What's the performance like for you? Any advice you have on mitigating possible perf issues?
- 8y ago