0

I am trying to make use of React-Native-Web, but the master branch version of ListView gives the error: TypeError: undefined is not a constructor (evaluating 'new _reactNative.ListView.DataSource')

One of the pull requests on the project adds the ListView functionality I need.

How do I add this PR to my own project?

What I have tried:

  1. created my own fork and manually added the files then tried to use npm to load it directly as per this SO question, it did not work, key core components were missing. The way one normally installs React-Native-Web is npm install --save react@0.14 react-dom@0.14 react-native-web and I tried npm install https:https://github.com/mcampsall/react-native-web

  2. adding the files directly to my /dist folder. This did not work because I needed the babel translated versions of the files. I tried to use the babel REPL to translate them, but it is missing some plugins and gets hung up on certain parts of the code.

Thanks in advance.

EDIT: I just tried npm install --save react@0.14 react-dom@0.14 https://github.com/mcampsall/react-native-web as per Molda's suggestion and got:

├── babel@6.5.2  extraneous
├── babel-plugin-transform-decorators@6.8.0 
├── babel-plugin-transform-decorators-legacy@1.3.4 
├── babel-preset-react@6.5.0 
├── UNMET PEER DEPENDENCY react@0.14.8
├── UNMET PEER DEPENDENCY react-dom@0.14.8
└─┬ react-native-web@0.0.25  (git+https://github.com/mcampsall/react-native-web.git#b448fb94cb29d08057eb72e4c13d09ad808f719a)
  ├─┬ fbjs@0.8.3 
  │ └── object-assign@4.1.0 
  └── react-textarea-autosize@4.0.3 

npm WARN react-native-web@0.0.25 requires a peer of react@^15.1.0 but none was installed.
npm WARN react-native-web@0.0.25 requires a peer of react-dom@^15.1.0 but none was installed.

EDIT 2: tried npm install --save react@15.1.0 react-dom@15.1.0 https://github.com/mcampsall/react-native-web and when i do this i get an error npm WARN react-native@0.23.1 requires a peer of react@^0.14.5 but none was installed. which is a different version of react-native-web(0.23.1) than the original error (which was 0.25)...?

I then tried installing react@14.5 and it showed the original error again npm WARN react-native-web@0.0.25 requires a peer of react@^15.1.0 but none was installed.

Community
  • 1
  • 1
Michael Campsall
  • 4,325
  • 11
  • 37
  • 52
  • Have you tried this `npm install --save react@0.14 react-dom@0.14 https:https://github.com/mcampsall/react-native-web` ? – Molda Jun 23 '16 at 17:31
  • Thanks for the suggestion, i got the following error: ├── UNMET PEER DEPENDENCY react@0.14.8 ├── UNMET PEER DEPENDENCY react-dom@0.14.8 ... npm WARN react-native-web@0.0.25 requires a peer of react@^15.1.0 but none was installed. npm WARN react-native-web@0.0.25 requires a peer of react-dom@^15.1.0 but none was installed.` – Michael Campsall Jun 23 '16 at 17:36
  • Then try the versions it wants. `npm install --save react@15.1.0 react-dom@15.1.0 https:https://github.com/mcampsall/react-native-web` – Molda Jun 23 '16 at 17:39
  • tried that too see edit 2 above – Michael Campsall Jun 23 '16 at 17:49
  • I just tried this `npm install --save react@15.1.0 react-dom@15.1.0 git+https://git@github.com/mcampsall/react-native-web` and it installs without any error. Make sure you delete all the packages before you install again or try to install into new empty folder – Molda Jun 23 '16 at 17:58
  • looks like that worked thanks, add it as an answer and i will accept – Michael Campsall Jun 23 '16 at 19:29

1 Answers1

3

I just tried this

npm install --save react@15.1.0 react-dom@15.1.0 git+https://git@github.com/mcampsall/react-native-web 

and it installs without any error.

Make sure you delete all the packages before you install again or try to install into new empty folder

Molda
  • 5,619
  • 2
  • 23
  • 39