-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
React 16 migration #364
Comments
Some notes Dan sent me: Think "Instance" = DOM node (or any object). So |
I'm not going to pursue a custom renderer at this time. The only module still using import EventPluginHub from 'react-dom/lib/EventPluginHub';
import ResponderEventPlugin from 'react-dom/lib/ResponderEventPlugin';
import ResponderTouchHistoryStore from 'react-dom/lib/ResponderTouchHistoryStore'; @gaearon mentioned that the List of dependencies needed by those 2 Responder files: var EventPluginUtils = require('EventPluginUtils');
var EventPropagators = require('EventPropagators');
var ReactTreeTraversal = require('ReactTreeTraversal');
var ResponderSyntheticEvent = require('ResponderSyntheticEvent');
var accumulate = require('accumulate'); …none of them are available from the public export (they aren't used by Next steps: find out how the |
I don't think we need Responder event is base on Touch Event, so we can use touch event handle responder event.In View/Text render method, convert those event handler to touchEvent.let touchEventHandles = convert({
onStartShouldSetResponder,
onMoveShouldSetResponder,
onStartShouldSetResponderCapture,
onMoveShouldSetResponderCapture,
onResponderGrant,
onResponderReject,
onResponderStart,
onResponderMove,
onResponderEnd,
onResponderRelease,
onResponderTerminate,
onResponderTerminationRequest,
});
pass return (
<div
className={className}
{...touchEventHandler}
style={style}
>
{children}
</div>
); We can copy |
So I've been playing with rnw on react@16 for the last few days, and I've run into two main issues that I was able to overcome, so I thought I'd share (if anyone else is stuck):
|
I don't think Thanks, I didn't know about |
Really looking forward to seeing this evolve. React Native, as of
|
@necolas - So, instead of pulling those objects into ReactDOM's internals, I created a new react-dom submodule, "react-dom/unstable-native-dependencies". And here's an example rev that updates my local fork of react-native-web to use it Does this approach seem sound? I wanted to hear back from you before putting up a PR to react. |
That’s what we planned to do, pretty much down to the naming! |
Nice. I was thinking of doing something like that. Let's see if the React team are ok with it (edit: ^ looks like it :)) |
Oh lol this is you Peter 😄 I didn't realize and thought it's a coincidence |
Oh you work at Facebook too @fmoo! Excellent, thanks so much for moving this forward |
React team is spread a bit too thin right now so we're thankful to everyone who helps check items off the 16 release plan. 🎊 |
@necolas Here's a proposal to get You'd like me to open a PR for that? It's hard to add tests for that without mixing dependencies |
I think we can either copy over the equivalent changes React has made to |
I’d like to avoid exposing for now. Don’t mind the copy paste. |
The changes in the master branch of React should make this possible soon. Once a new alpha is published I'll try it out. |
We'll publish first beta in a few days. |
We did publish beta 1. facebook/react#10294 |
Sweet! Tried out @fmoo's changes to react-native-web along with Are you guys planning on creating a PR to merge @fmoo's changes into react-native-web or are there different plans? |
I'm doing that now. The beta only just came out. Patience please :) |
Although I've managed to get RNW to run on React 16, I'm not sure how to support both React 15 and React 16 at the same time. |
@necolas Maybe bump react-native-web to version match RN. So a plan would be to bump RNW immediately to 46, and below that version would be react 15? All the alpha versions have been a huge nightmare for trying to use react-native-web, so maybe as far as the react-native-web is concerned, they just wouldn't be supported versions? The range that depends on alpha versions of react is 0.43-0.46. I'm so glad it's over. This is what it had come down too in order to support both. https://github.com/ericwooley/react-nativeish/blob/upgrade-rn/package.json#L16 |
Yeah there's nothing I can do about RN releases depending on alpha/beta versions of React. And trying to stay entirely compatible with specific RN versions is going to be as impossible for RNW as it is for Preact with React. |
So maybe publish a version of react-native-web@next for the 16 alphas? |
Is it important to continue supporting React 15 going forwards? You could publish a specific branch for React 16 in the short term, and when React 16 is officially released and gaining adoption merge that in and drop React 15 support. React 15 users can continue using the last version that supports it, and just like users won't get new features in React 15, they just won't get any new fixes here. |
@jlongster There are still a lot of third party libs that use React 15 or below, and it will take some time for those to migrate over once the release process for 16 is completed. Few of those would try to get the jump on migrating to an alpha/beta version of React. When using those libs in conjunction with something that uses React 16, the packager just silently includes both the React platforms, which then leads into all sorts of creative and entertaining issues. It's not the biggest problem if you've experienced it a few times, and know to watch out for it, but a lot of people wouldn't which would lead to a support nightmare. I think it's important to take these issues into consideration. |
Hello @necolas! I am excited to hear you got Thanks! |
Any chance for a new branch? :) |
I have it running pretty well on top of React 16 except for it complaining about the hit-slop view not having a That Webpack alias looks like this in the config: 'react-dom/lib': path.resolve(__dirname, './shims/react-dom/lib'), shims/react-dom/lib/EventPluginHub.jsimport ReactDOM from 'react-dom';
const { EventPluginHub } = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
export default EventPluginHub; shims/react-dom/lib/ResponderEventPlugin.jsexport { ResponderEventPlugin as default } from 'react-dom/unstable-native-dependencies'; shims/react-dom/lib/ResponderTouchHistoryStore.jsexport { ResponderTouchHistoryStore as default } from 'react-dom/unstable-native-dependencies'; |
Awesome update, was waiting for this for a while.. thanks @necolas. |
Great work - thanks a lot! |
@gaearon posted an overview of the changes coming to React: facebook/react#8854
Things to figure out
React.createClass
is going away?ResponderEventPlugin
/Touchable
, sincereact-dom/lib/*
files are going away and so might the synthetic event system?The text was updated successfully, but these errors were encountered: