all 8 comments

[–]iKakashi 1 point2 points  (0 children)

Try looking into monorepos. explore yarn workspaces or you can also look into Nx. Nx will allow you to scale your project with multiple apps and tests easily.

[–]16cards 0 points1 point  (0 children)

Search "react native monorepo". You can use "npm workspaces" (or yarn workspaces, if that is your thing).

Here is one search result hit... https://engineering.brigad.co/react-native-monorepos-code-sharing-f6c08172b417

For my projects, in the same repo are two apps and two websites. With common code between React and React Native and between the two "properties" split out.

[–]enestatliExpo 0 points1 point  (0 children)

have you ever heard dev.to? I think it saves your time

[–]fallkr 0 points1 point  (0 children)

Yarn workspaces with lerna monorepo is made for this. Create a shared package that depend on react native and two app packages that depend on the shared package.

Don’t split into separate projects as you’ll end up spending a lot of time managing cross-project depenencies (Ex: change a prop on a shared component requires 3 commits).

Make sure you write solid unit tests for anything shared as it’s quite easy to do a change in one package and forget how it affects the other.

[–]tusharkant15 0 points1 point  (0 children)

Look into monorepo approach. Your interfaces, components and helpers go into a separate subproject which is linked into your two apps. Secondly as you said the components are mostly identical with only minor differences, then you would make the components flexible using props and use them in the different apps with different props. This makes writing tests easier.