Skip to content

Fix React Native version mismatch

Add a Snapped To Version Group which allows some of the packages in your monorepo to “follow” other packages in terms of which versions they should use.

In this example we want our Mobile App package to be the single source of truth for what the versions of react and react-native should be. Every other package will be required to use the same version it does.

Here is the Version Group configuration to do it:

  • An optional label can be added to document the rule.
  • The dependencies array defines the names of the dependencies we want to target.
  • The snapTo array lists the name properties of the locally developed package.json files which should be searched for a version of react or react-native.
.syncpackrc
{
"versionGroups": [
{
"label": "Always use the versions of react brought in by the Mobile App",
"dependencies": ["react", "react-native"],
"snapTo": ["mobile-app"]
}
]
}