<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Avinash kumar</title>
    <description>The latest articles on DEV Community by Avinash kumar (@akavinashsingh).</description>
    <link>https://dev.to/akavinashsingh</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4135037%2Fe086566f-9d98-4b0a-8bf0-bb7888f4cf98.png</url>
      <title>DEV Community: Avinash kumar</title>
      <link>https://dev.to/akavinashsingh</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/akavinashsingh"/>
    <language>en</language>
    <item>
      <title>Splitting one React Native app into two: the bugs that have no error message</title>
      <dc:creator>Avinash kumar</dc:creator>
      <pubDate>Mon, 21 Sep 2026 05:52:35 +0000</pubDate>
      <link>https://dev.to/akavinashsingh/splitting-one-react-native-app-into-two-the-bugs-that-have-no-error-message-d18</link>
      <guid>https://dev.to/akavinashsingh/splitting-one-react-native-app-into-two-the-bugs-that-have-no-error-message-d18</guid>
      <description>&lt;p&gt;We split a single React Native app that carried two user roles (customer and service provider) into two separate apps sharing a package. Both are live on Google Play and the App Store. RN 0.84, React 19, npm, bare workflow, no Expo.&lt;/p&gt;

&lt;p&gt;Every monorepo guide I found stops at &lt;code&gt;watchFolders&lt;/code&gt;. That gets you a bundle that builds. It does not get you an app that works.&lt;/p&gt;

&lt;h2&gt;
  
  
  The bug that cost the most time
&lt;/h2&gt;

&lt;p&gt;Sign-in on a shared auth screen returned 200. A token was written to storage. The app sat on the login screen.&lt;/p&gt;

&lt;p&gt;Nothing threw. Nothing logged. The network tab was clean.&lt;/p&gt;

&lt;p&gt;The cause was two copies of zustand. Metro resolves a bare import from the importing file's own location, so &lt;code&gt;shared/src/store/authStore.ts&lt;/code&gt; walked up to &lt;code&gt;repo-root/node_modules/zustand&lt;/code&gt;, while the app code walked up to &lt;code&gt;app-customer/node_modules/zustand&lt;/code&gt;. Two module instances, two stores. The shared auth screen wrote to one. The app shell read the other.&lt;/p&gt;

&lt;p&gt;Both resolutions succeeded. That is exactly why there is no error to search for.&lt;/p&gt;

&lt;h2&gt;
  
  
  The same mechanism, four more ways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Two copies of React.&lt;/strong&gt; This one at least crashes, with &lt;code&gt;Cannot read property 'current' of null&lt;/code&gt; thrown from a shared component that is obviously correct.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Two copies of axios.&lt;/strong&gt; Interceptors are instance state, so auth headers silently stop being attached on requests made from shared code.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Native modules registering twice.&lt;/strong&gt; AsyncStorage, geolocation, vector icons. Symptoms vary and none of them name the cause.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A green &lt;code&gt;tsc&lt;/code&gt; that proves nothing.&lt;/strong&gt; Two copies of a module have identical types. The type checker's job is to agree that they match, and it will do that job perfectly while the app is broken.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The fix
&lt;/h2&gt;

&lt;p&gt;A &lt;code&gt;resolveRequest&lt;/code&gt; in each app's &lt;code&gt;metro.config.js&lt;/code&gt;, pinning every dependency the shared package imports to that app's own copy. The list is short and finite, and you should derive it with grep rather than from memory.&lt;/p&gt;

&lt;h2&gt;
  
  
  The full writeup
&lt;/h2&gt;

&lt;p&gt;I put the whole thing in a repo, including the npm side (the shared package declares zero dependencies, and why declaring &lt;code&gt;peerDependencies&lt;/code&gt; instead gives you a permanent &lt;code&gt;ERESOLVE&lt;/code&gt;) and the Android side (a workspace install intermittently left a partial copy of &lt;code&gt;@react-native/gradle-plugin&lt;/code&gt; in the app's own &lt;code&gt;node_modules&lt;/code&gt;, shadowing the complete one, and the build died at settings evaluation in about a second).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/akavinashsingh/react-native-two-app-split" rel="noopener noreferrer"&gt;https://github.com/akavinashsingh/react-native-two-app-split&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;MIT, nothing to install. If any of it is wrong for your setup I would rather hear it than not.&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>javascript</category>
      <category>monorepo</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
