Skip to content

Bump react-native-monorepo-config in examples to fix Windows paths #667

@harveylx

Description

@harveylx

Before submitting a new issue

  • I tested using the latest version of the library.
  • I tested using a supported version of React Native.
  • I checked for existing issues that might answer my question.

Bug Summary

The two example apps pin react-native-monorepo-config at ^0.1.9. On Windows, that version mishandles backslash paths when configuring Metro's extraNodeModules/blockList, so Metro ends up resolving multiple copies of React (the workspace root copy and the example app copy). The app then crashes on launch with the classic "Invalid hook call" error.

Files:

  • example/bare/package.json
  • example/expo/package.json

Symptom on Android (bare example):

Invalid hook call. Hooks can only be called inside of the body of a function component...
  3. You might have more than one copy of React in the same app

  at useWindowDimensions (useWindowDimensions.js:21)
  at ReanimatedTrueSheetProvider (ReanimatedTrueSheetProvider.tsx:46)
  at App

TypeError: Cannot read property 'useState' of null

It's fixed upstream in 0.3.0 (latest is 0.3.3). Bumping to ^0.3.3 makes the duplicate-React resolution go away and the bare example runs fine on Windows.

-    "react-native-monorepo-config": "^0.1.9"
+    "react-native-monorepo-config": "^0.3.3"

To repro: clone on Windows, yarn install, run the bare example on Android. App launches and immediately throws the hook error above.

Can open a PR if you want.

Affected Platforms

  • iOS
  • Android
  • Web
  • Other

Library Version

latest

Environment Info

System:
  OS: Windows 11 10.0.22621
  CPU: "(12) x64 AMD Ryzen 5 5600X 6-Core Processor             "
  Memory: 4.22 GB / 31.92 GB
Binaries:
  Node:
    version: 22.20.0
    path: D:\Program Files\nodejs\node.EXE
  Yarn:
    version: 4.11.0
    path: D:\Program Files\nodejs\yarn.CMD
  npm:
    version: 10.9.3
    path: D:\Program Files\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK: Not Found
  Windows SDK: Not Found
IDEs:
  Android Studio: Not Found
  Visual Studio:
    - 17.10.34916.146 (Visual Studio Community 2022)
Languages:
  Java:
    version: 17.0.17
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli":
    installed: 20.1.3
    wanted: 20.1.3
  react:
    installed: 19.2.0
    wanted: 19.2.0
  react-native:
    installed: 0.83.4
  react-native-windows: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Steps to Reproduce

  1. Open the example app on Windows
  2. See the useState error on initial load

Repro

https://github.com/lodev09/react-native-true-sheet

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds reproNeed to replicate this issue

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions