简体   繁体   English

如何在我的React-Native-Web构建中正确包含对github的拉取请求?

[英]How do I properly include a pull request on github into my build of React-Native-Web?

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') 我正在尝试使用React-Native-Web ,但是ListView的主分支版本给出了错误: 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. 在项目上的拉取请求之一添加了我需要的ListView功能。

How do I add this PR to my own project? 如何将此PR添加到我自己的项目中?

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. 创建了我自己的fork并手动添加了文件,然后按照此SO问题尝试使用npm直接加载它,它不起作用,缺少关键的核心组件。 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 通常安装React-Native-Web的方式是npm install --save react@0.14 react-dom@0.14 react-native-web ,我尝试了npm install https:https://github.com/mcampsall/react-native-web

  2. adding the files directly to my /dist folder. 将文件直接添加到我的/ dist文件夹中。 This did not work because I needed the babel translated versions of the files. 这没有用,因为我需要文件的babel翻译版本。 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. 我尝试使用babel REPL来翻译它们,但是它缺少一些插件,并且挂在代码的某些部分。

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: 编辑:我只是npm install --save react@0.14 react-dom@0.14 https://github.com/mcampsall/react-native-web的建议尝试了npm install --save react@0.14 react-dom@0.14 https://github.com/mcampsall/react-native-web并得到:

├── 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. 编辑2:尝试npm install --save react@15.1.0 react-dom@15.1.0 https://github.com/mcampsall/react-native-web并且当我这样做时我得到一个错误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)...? 这是不同于原始错误(0.25)的版本的react-native-web (0.23.1)...?

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. 然后我尝试安装react@14.5,它再次显示原始错误npm WARN react-native-web@0.0.25 requires a peer of react@^15.1.0 but none was installed.

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 确保在再次安装之前删除所有软件包,或尝试安装到新的空文件夹中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 react-native-web 中使用情感? - How can I use emotion with react-native-web? react-native-web 如何配置 webpack - react-native-web how to configure webpack React-Native-Web 的视频支持 - Video suport for React-Native-Web 样式组件:使用 react-native 和 react-native-web 悬停 - styled components :hover with react-native and react-native-web 'ActionSheetIOS' 不是从'react-native-web/dist/index' 导出的 - 'ActionSheetIOS' is not exported from 'react-native-web/dist/index' 有条件地将电子导入 react-native-web 应用程序 - Importing electron conditionally into react-native-web app 不使用react-native-web为ReactJS创建“ TouchableOpacity” - create “TouchableOpacity” for ReactJS without using react-native-web 在 react-native-web monorepo 架构中尝试导入错误 - Attempted import errors in react-native-web monorepo architecture 如何在Bitbucket中的拉取请求中解决缩进/对齐问题? - How do I fix indentation/alignment in my pull request in Bitbucket? 尝试导入错误:当编译react-native到react-native-web时,不会从'./apiFetcher'导出'ApiGet' - Attempted import error: 'ApiGet' is not exported from './apiFetcher' when compile react-native to react-native-web
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM