TVke / react-native-tailwindcss

A react-native style system based on TailwindCSS
https://tvke.github.io/react-native-tailwindcss/
MIT License
565 stars 34 forks source link

Direct dependency of `react-native` causing build conflicts #9

Closed davidgovea closed 4 years ago

davidgovea commented 4 years ago

Hi @TVke --

I've been having some difficulty with version 1.1.7, on various RN projects. commit 98ecbb740f06df6dfb1513448765c423d182ef7c introduced a direct dependency on react-native >= 0.61.5.

With older RN (I tested 0.59.10), I get a metro bundler conflict, complaining about 2 versions of RN and displaying the node_modules/react-native-tailwindcss/node_modules/react-native nested dependency directory.

Also, with RN 0.61.5, I'm seeing another issue when running hook tests using the testing-library:

  ● Test suite failed to run

    Invariant Violation: __fbBatchedBridgeConfig is not set, cannot invoke native modules

      at invariant (node_modules/invariant/invariant.js:40:15)
      at Object.invariant (node_modules/react-native-tailwindcss/node_modules/react-native/Libraries/BatchedBridge/NativeModules.js:166:3)
      at Object.require (node_modules/react-native-tailwindcss/node_modules/react-native/Libraries/TurboModule/TurboModuleRegistry.js:13:23)

It looks like react-native is only used in the tests, so we can probably put it back in peerDependencies, but then also add it to devDependencies for the test code. Could be missing something though.

I'll add a PR here in a minute.

Thanks!

davidgovea commented 4 years ago

Added PR. react is only used in the tests (so devDep only), while react-native is used in sourcecode (so devDep+peerDep).

TVke commented 4 years ago

Hi @davidgovea Thank you for the help I forgot to check older versions indeed.