Doubková separates reuse into components, styling, and business logic. Web components describe page semantics, such as headings and paragraphs, while native components focus on interactions, such as flat lists and date pickers. Because the two sets of components do not map well, Hive rebuilt its UI for native.
Going Native: Reusing Code
Speaker
Anna Doubková of Hive explains how her team adapted a web application for native mobile platforms and what code they could reuse.
Some components can be shared when they do not render platform-specific UI, such as a conditional feature that decides whether to show its children. Hive also wrapped SVG assets in React components and passed the platform-specific versions in as props. This approach works across web and React Native, with some mapping code to maintain.
Hive used styled-components to share CSS-style definitions between web and React Native. Some layout behavior differs: React Native uses flex layout by default, with a column direction. Shared variables, font sizes, and other styles helped keep the platforms visually consistent.
Hardware integrations and some SDKs, including analytics, still required native code. Much of the application logic remained JavaScript, so Hive reused its Redux store, actions, sagas, reducers, connectors, and translations. Doubková says the team wrote very little native code, with minor changes for push notifications and Bluetooth.
Most of the work moving from web to native was building components and styles. The team moved many existing business logic files into a shared folder instead of rewriting them. Doubková summarizes that components were not broadly reusable, styles were partly reusable, and shared business logic provided the greatest development speed.
Takeaways
- Plan to rebuild UI when web and native components express different platform needs.
- Share logic-only components when their rendered children are supplied by the platform.
- Wrap reusable SVG assets so each platform can provide its own rendering component.
- Use shared styles for consistency, while accounting for React Native layout differences.
- Keep stores, actions, reducers, translations, and other JavaScript logic in shared code where possible.
Mentioned in this talk
Search inside this talk
What was claimed 8
- usesHive uses React Native
“we decided to take our React code into the native world.”
YouTube Unverified1 source· Talk
- uses
“we decided to take our React code into the native world.”
YouTube Unverified1 source· Talk
- uses
“Practically all our assets are SVGs.”
YouTube Unverified1 source· Talk
- usesHive uses styled-components
“We're using styled-components because they make it really easy.”
YouTube Unverified1 source· Talk
- featureHive: Reuses JavaScript business logic, including store, Redux model, translations, actions, sagas, reducers, and connectors, across web and native applications.
“all our user actions, sagas, reducers, and connectors ... don't have to be done again.”
YouTube Unverified1 source· Talk
- usesHive uses React Intl
“the whole React Intl that sits behind them”
YouTube Unverified1 source· Talk
- uses
“we just happen to use Redux.”
YouTube Unverified1 source· Talk
- metricHive: The speaker estimates she wrote two or three lines of native code.
“I think I maybe wrote two or three lines”
YouTube Unverified1 source· Talk





