taofed / react-web

A framework for building web apps with React Native compatible API.
Other
3.36k stars 448 forks source link

Support react 16(react-native 0.43) , findNodeHandle, FlatList and SectionList #248

Open flyskywhy opened 7 years ago

flyskywhy commented 7 years ago

react 16: (Chinese version comment of commit 8c543ba) react-native 0.43 对应的 react 的版本是 16.0.0-alpha.6 ,由于 react@16.0.0-alpha.6 中的 ReactBaseClasses.js 中的 setState 调用 enqueueSetState() 的参数与 react-dom@15.4.2 中 的 ReactUpdateQueue.js 中的 enqueueSetState() 定义配合不上,因此需要升级 react-dom 以使 Web 版的 Navigator 的页面 route 跳转再次能用,这实际上就是让 setState(partialState, callback) 中的 callback 再次能用。而之所以只升级成 react-dom@16.0.0-alpha.2 而非 react-dom@16.0.0-alpha.6 是因为 ReactAnimated 所用的第三方组件 animated 现在还不支持 React v16 Support 而使得从 react-dom@16.0.0-alpha.3 到 react-dom@16.0.0-alpha.6 都会导致崩溃,所以现在先暂时锁定在唯一能用的 react-dom@16.0.0-alpha.2

另:@yuanyan 后续是否考虑进行类似 https://github.com/necolas/react-native-web/commit/941c6284455bb80674ebe15d155547bfbba1bc2b 这样的去除一些对 react-dom 依赖的操作?就像 necolas 在 React v16 Support 中建议 https://github.com/animatedjs/animated/blob/master/src/targets/react-dom.js 中的 var CSSPropertyOperations = require('react-dom/lib/CSSPropertyOperations'); 语句去除对 react-dom 的依赖那样

https://github.com/react-community/react-navigation: work with react-navigation recommended by react-native@0.44.0(it remove navigator) when use import { StackNavigator } from 'react-navigation/src/react-navigation.js' not import { StackNavigator } from 'react-navigation'; // it will use react-navigation.web.js instead

and replace PlatformHelpers with PlatformHelpers.native in react-navigation/src/createNavigationContainer.js

findNodeHandle: FlatList need it

FlatList and SectionList: ported from react-native@0.43.3

cpunion commented 7 years ago

@flyskywhy 看起来这个库放弃维护了,有动力接手继续吗?

flyskywhy commented 7 years ago

@cpunion ,谢谢信任 :smile: ,您的 PR 已合并

flyskywhy commented 7 years ago

@fov42550564 ,issue 暂时还是先集中在这边吧,我也会时不时过来看看的

fov42550564 commented 7 years ago

@flyskywhy FlatList不能下拉刷新,设置refreshing={true}后,activityindicator也不能显示出来,onRefresh={()=>{console.log("========");}}函数也不执行,你测试的时候遇到这个问题了吗,另外,老版本的ListView设置refreshControl也不能下来刷新,是不是需要采用第三发的List?

cpunion commented 7 years ago

咱们 fork 一个共同维护吧,以这边的情况看,不但基本修复合并不了,以后发展也没指望了。

fov42550564 commented 7 years ago

叫 @flyskywhy fork 吧

flyskywhy commented 7 years ago

@fov42550564 不能下拉刷新这个问题我也发现了,花了点时间但没解决,后来考虑到还要禁止微信/支付宝上自带的下拉提示(“网页由 xx.com 提供”),所以最后没有去解决下拉刷新问题,而是在 APP 中有列表的地方 Platform.OS === 'web' 时就放置一个刷新按钮来 workaround 的。

要不请 @cpunion @fov42550564 两位共同在我的 fork https://github.com/flyskywhy/react-web 中维护?我会尽量及时查看 diff 、实际测试然后合并 PR 的,谢谢 :smile:

cpunion commented 7 years ago

@flyskywhy 我之前把 react-16 相关的提给你了,其它的提在这边 https://github.com/taobaofed/react-web/pull/259 #261。以后都提到你那边吧,我还有几个小 fix 的没提。😄

fov42550564 commented 7 years ago

https://github.com/flyskywhy/react-web中好像不能提交Issue

cpunion commented 7 years ago

默认 fork 会关闭 issues,设置打开即可。

flyskywhy commented 7 years ago

@fov42550564 ,https://github.com/flyskywhy/react-web 中的 Issue 现在开启了

cpunion commented 7 years ago

https://github.com/fmoo/react-native-web/commit/8a0da1f6aeecf2b772a20a5f154c206a006df234 这里有react-16 的 injectResponderEventPlugin 实现,可以借过来