Skip to content
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

Prepare RNW for DOM specific ResponderEventPlugin #908

Closed
wants to merge 3 commits into from

Conversation

philipp-spiess
Copy link
Contributor

This PR prepares RNW for #12629. To keep changes at a minimum, the added dependencies were upstreamed to react-dom.

State of this PR

This PR is currently blocked by #12629 and will need a new release of react-dom after #12629 is merged to function properly. I've verified that everything still works by linking against a local build of react and react-dom and running the examples via yarn website.

philipp-spiess added a commit to philipp-spiess/react-native-web that referenced this pull request Apr 21, 2018
One thing I found out while working on necolas#908 this is that the 2048 game
demo does not work on browsers since it listens for touch events only.
This can be solved by listening to both mouse and touch events.
@necolas
Copy link
Owner

necolas commented May 7, 2018

While working on this, did you notice that upgrading to React(DOM) 16.3 breaks the storybook? After I upgrade the project to use React 16.3 instead of 16.2, none of the touchables work and I see these warnings in the console:

Warning: Unknown event handler property `onResponderGrant`. It will be ignored.

@philipp-spiess
Copy link
Contributor Author

philipp-spiess commented May 8, 2018

I'm super confused now. I was just testing my branch again (which is based on a commit that was created after the 16.3.2 commit) by placing the build artifacts into node_modules and it was working fine.

I then updated to 16.3.2 stable (via yarn) and saw the issue you described. Strangely I can't get my version to run anymore now. 🤔

@necolas
Copy link
Owner

necolas commented May 8, 2018

OK it looks like maybe something unexpected changed in React or React DOM between 16.2 and 16.3

@philipp-spiess
Copy link
Contributor Author

Ok I think I had different versions for the website package. Now I wonder why it worked in the first place 🤔🤔I guess I need a bit more time to figure that out...

@philipp-spiess
Copy link
Contributor Author

Just brainstorming here but can it be that after the upgrade, the website (= storybook) runs on a different react-dom than the one we inject the responderplugin in?

@necolas
Copy link
Owner

necolas commented May 8, 2018

Possibly. I think the benchmark's "Run" button was also broken after the upgrade though

philipp-spiess added a commit to philipp-spiess/react-native-web that referenced this pull request May 11, 2018
I've made my attempt at upgrading RNW to React 16.3.2 and it seems like
everything is still working including the website and the benchmarks.

I'm pretty sure that some obscure dependency graph caused Yarn to not
de-dupe React in my first try as part of necolas#908. To fix this, I forced an
update of all transitive dependencies as well so I suggest you also
look over the updated `yarn.lock` in more detail since there where quite
a few packages with minor updates.

`yarn check` still complains about an unmet dependency:

```
β react-native-web git:(react-16.3.2) ✗ yarn check
yarn check v1.3.2
warning "chokidar#fsevents#node-pre-gyp@^0.9.0" could be deduped from "0.9.1" to "[email protected]"
error "benchmarks#reactxp#[email protected]" doesn't satisfy found match of "[email protected]"
error "benchmarks#reactxp#[email protected]" doesn't satisfy found match of "[email protected]"
warning "styled-jsx#stylis-rule-sheet#[email protected]" could be deduped from "3.5.0" to "[email protected]"
info Found 2 warnings.
error Found 2 errors.
info Visit https://yarnpkg.com/en/docs/cli/check for documentation about this command.
```

I tried upgrading `reactxp` as well but that broke the benchmark script.
I think this error can be ignored for now as the current version of
`reactxp` still works fine with React 16.3.2.

I've collected a couple of benchmarks before upgrading all dependencies
and compared those after upgrading. I can't spot differences that are
out of standard deviation but I'm pasting them here anyhow so you can
verify.

## Before

![](https://dzwonsemrish7.cloudfront.net/items/3h1L0y0Y260a3I2b0O0L/Screen%20Shot%202018-05-11%20at%2019.59.51.png?v=3e5af7e4)

## After

![](https://dzwonsemrish7.cloudfront.net/items/061m1t2a0A1g2J3K3i1a/Screen%20Shot%202018-05-11%20at%2020.00.30.png?v=f7da1314)
# Conflicts:
#	packages/react-native-web/src/modules/ResponderEventPlugin/index.js
@vladp
Copy link

vladp commented May 25, 2018

I am running into this issue now too. What was strange is that in my package.json I had react dependencies set to "^16.3.2" and it was working, working, working. Untill, yesterday when I needed to refresh my node_modules.
I was chasing a change for a few hours, that I, thought I made, that broke this side of my app, but then stumbled onto this bug report.
I checked the node_modules/react/package.json. And sure enough, 16.4 crawled into my "^16.3.2"...
I am thinking when published 16.4 there was some convention was broken for semver, so that 16.4 was made available even for "^16.3.2".

facebook/react#12898

@philipp-spiess , may be that's why you did not observe a problem, and then after you reinstalled your node_modules - it showed up.

I cannot go back to 16.2 (and I cannot go forward to RNW 7.2+ (as my vector icons do not work in 7.2), so will stay at RN "16.3.2" RNW 0.6.1 for the time being.

P.S. Another strange thing I noticed with this accidental React 16.4 pull -- is that the checkboxes are no longer styled by RNW, instead they look like the 'browser's default checkbox. So not only the touch events are not working there.

@necolas
Copy link
Owner

necolas commented May 25, 2018

I’m sorry this broke things for you. React doesn't follow semver when making changes to unofficial APIs, like the ones exposed for React Native for Web.

@vladp
Copy link

vladp commented May 25, 2018

@necolas , thank you. Understood.

@necolas
Copy link
Owner

necolas commented May 25, 2018

I was working on 0.8.0 when React 16.4 came out, but will pause that to make a patch release for React 16.4 and 0.7.x today.

@necolas necolas closed this in 50442c4 May 25, 2018
@necolas
Copy link
Owner

necolas commented May 25, 2018

Thanks a lot for the help here. This fix is in 0.7.3

necolas referenced this pull request in kawasima/show-me-the-slide Jun 19, 2018
muratakbal pushed a commit to mdcollab/react-native-web that referenced this pull request Sep 27, 2018
React 16.4 includes the necessary ResponderEventPlugin dependencies and
makes some changes to the event internals that causes a breaking change.
This patch fixes rendering with [email protected] while preserving
backward-compatibility with earlier versions of react-dom.

Close necolas#908
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants