deanmcpherson / react-native-sortable-listview

Drag drop capable wrapper of ListView for React Native
MIT License
917 stars 235 forks source link

Compatibility with React Native 0.42 #65

Closed Jarred-Sumner closed 7 years ago

Jarred-Sumner commented 7 years ago

After upgrading this package to 0.2.0 and updating to the latest version of React Native, this project when imported fails to build.

I was able to fix it locally by deleting the folder in node-modules/react-native within the react-native-sortable-listview folder. It appears that a specific React Native version is hard-coded in the package.json, so that if you have a different version, it tries to load two different versions of React Native - which can cause conflicts like these.

This is the output of react-native start after upgrading: (but before my local fix)

➜  alarmclockv2 git:(master) ✗ react-native start
Scanning 647 folders for symlinks in /Users/jarred/Code/alarmclockv2/node_modules (14ms)
 ┌────────────────────────────────────────────────────────────────────────────┐
 │  Running packager on port 8081.                                            │
 │                                                                            │
 │  Keep this packager running while developing on any JS projects. Feel      │
 │  free to close this tab and run your own packager instance if you          │
 │  prefer.                                                                   │
 │                                                                            │
 │  https://github.com/facebook/react-native                                  │
 │                                                                            │
 └────────────────────────────────────────────────────────────────────────────┘
Looking for JS files in
   /Users/jarred/Code/alarmclockv2

Loading dependency graph...
React packager ready.

Failed to build DependencyGraph: @providesModule naming collision:
  Duplicate module name: jsc-heap-capture
  Paths: /Users/jarred/Code/alarmclockv2/node_modules/react-native-sortable-listview/node_modules/react-native/local-cli/server/middleware/heapCapture/package.json collides with /Users/jarred/Code/alarmclockv2/node_modules/react-native/local-cli/server/middleware/heapCapture/package.json

This error is caused by a @providesModule declaration with the same name across two different files.
Error: @providesModule naming collision:
  Duplicate module name: jsc-heap-capture
  Paths: /Users/jarred/Code/alarmclockv2/node_modules/react-native-sortable-listview/node_modules/react-native/local-cli/server/middleware/heapCapture/package.json collides with /Users/jarred/Code/alarmclockv2/node_modules/react-native/local-cli/server/middleware/heapCapture/package.json

This error is caused by a @providesModule declaration with the same name across two different files.
    at HasteMap._updateHasteMap (/Users/jarred/Code/alarmclockv2/node_modules/react-native/packager/src/node-haste/DependencyGraph/HasteMap.js:158:13)
    at p.getName.then.name (/Users/jarred/Code/alarmclockv2/node_modules/react-native/packager/src/node-haste/DependencyGraph/HasteMap.js:133:31)
chetstone commented 7 years ago

The dependencies on react and react-native were added when jest tests were added. They should be devDependencies. I didn't realize that version had not been pushed to npm. In fact, the npm package has not been upgraded for over six months. Yikes!

Fixed by PR #66