-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Fix: pointerEvents propagation
#2802
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
Closed
staszekscp
wants to merge
7
commits into
necolas:master
from
staszekscp:fix/inline-pointer-events-style-propagation
Closed
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5860c95
Update index.js
riteshshukla04 d4847b1
Merge branch 'master' of https://github.com/staszekscp/react-native-web
staszekscp ae0977f
Fix pointerEvents passed by inline styles
staszekscp 1a126da
Fix tests for pointerEvents
staszekscp bb7c6d1
Remove code to fix pointerEvents inline styling
staszekscp f1a03a4
Remove code to fix pointerEvents inline styling
staszekscp ad846ff
Merge branch 'fix/inline-pointer-events-style-propagation' of https:/…
staszekscp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My concern here is that this has a good chance of regressing performance because we're flattening the styles before resolving them. That's probably why the special handling of the pointerEvent prop wasn't ported.
It's been a while since I've looked at the e2e benchmarks but that would be the way to confirm this. Might be a good idea to separate the fix for the pointerEvents behavior from the attempt to support inline styles pointerEvent. The latter is an edge case that can easily be avoided by changes to product code anyway
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I get the concern. I can remove the code to fix the inline style issue in this PR, but I still think it should be done, especially because nobody is aware of the difference in the
pointerEventsbehaviour. Even the React Native docs say that a plain JS object is fine for styling, and suggest usingStyleSheet.createonly for more complex scenarios. That's why I think that the issue should be solved in thereact-native-weblibrary.In that case could you run the e2e tests to confirm that the solution causes performance regressions? I'm not sure what's the complexity of the
flattenmethod, but there is always a chance to improve the code. I noticed that theprops.styleis passed asstyle[2]for theViewcomponent. If it's the same for all other components, we could look for thepointerEventsvalue only there. If it's an object we get O(1), but, even if in the client app thestyleprop gets passed by an array of style objects we can iterate in O(n) complexity to find thepointerEventsthere.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A plain js object for styling is not fast enough for web. Doesn't matter what RN says
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I meant is that if the docs say that it's fine to use plain JS objects people will follow this instruction anyways. That's why I think it is should be covered. Maybe there should be at least a warning in the console to provide some feedback to the library users that something might not work as expected.
I've removed the code from the PR so it includes only the fix for the incorrect
pointerEventspropagation