By writing a small adapter to choose the import path (styled-components
vs styled-components/native
), we should be able to import web UI components into a React Native context. This is accomplished by:
- Writing the adapter
- Configuring each project (web vs native) to import the right path for
styled-components
The web project can easily set up a package alias in the next.config.js
. The working setup I have is this:
const path = require("path");
module.exports = {
webpack: config => {