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

[Core] Implements warning for 'react-tap-event-plugin' if not registered #3064

Closed
wants to merge 1 commit into from

Conversation

newoga
Copy link
Contributor

@newoga newoga commented Jan 27, 2016

Closes #2553.

This check should help a lot of new material-ui developers catch the infamous "forgot to call injectTapEventPlugin()" issue.

Probably related to a number of issues.

check-tap-event-plugin

@alitaheri
Copy link
Member

Wow! Great job 👍 👍 👍 👍 I didn; know it was possible 😅 😅

@newoga
Copy link
Contributor Author

newoga commented Jan 27, 2016

@oliviertassinari @alitaheri @mbrookes This is probably low risk, but take a look at it. Also let me know if there's a better place to run the warning other than getMuiTheme(). I tested it on the docs site and pretty much as long as you call injectTapEventPlugin() before you render, you should be good.

Okay, bed time. 😪

@newoga
Copy link
Contributor Author

newoga commented Jan 27, 2016

I didn; know it was possible

Neither did I! But I read the tap-event-plugin's source, then React's source, then soon enough it was done 😄

@oliviertassinari
Copy link
Member

@newoga Thanks for starting this 😄!
I was also wondering how to do this. I have opened an issue here: zilverline/react-tap-event-plugin#57.

@@ -12,6 +13,8 @@ import zIndex from './zIndex';
* theme will be deeply merged with the second argument.
*/
export default function getMuiTheme(baseTheme, muiTheme) {
if (process.env.NODE_ENV !== 'production') checkTapEventPlugin();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested this on my project. Unfortunately, getMuiTheme is called before injectTapEventPlugin.
That won't always work.
What about moving the check to the function that applies the style? We will be sure that the check is made during the rendering.

@oliviertassinari oliviertassinari added PR: needs revision The pull request can't be merged. More details is available on the code review or fails in the CI and removed PR: Needs Review labels Jan 27, 2016
@alitaheri
Copy link
Member

@newoga There is also one tiny edge case. When 2 instances of react are loaded and one of them reside in the node_modules/material-ui/node_modules this warning will be displayed regardless. Might not be a bad idea to also add: ...or you have multiple instances of React loaded.

@alitaheri alitaheri closed this Jan 27, 2016
@alitaheri alitaheri reopened this Jan 27, 2016
@alitaheri
Copy link
Member

stupid Close and comment button :|

The 'react-tap-event-plugin' has not been registered!

Material-UI requires that you load 'react-tap-event-plugin' and call 'injectTapEventPlugin()' for
components receive touch events and work properly.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"to receive". Edit: also it isn't just touch events, right?

@alitaheri
Copy link
Member

@newoga We should investigate #3068 before merging this, sorry 😅 😅

@mbrookes
Copy link
Member

Yeah, sorry @newoga - I felt bad posting that suggestion right after you've made this PR! 😰

@newoga
Copy link
Contributor Author

newoga commented Jan 27, 2016

@newoga We should investigate #3068 before merging this, sorry 😅 😅
Yeah, sorry @newoga - I felt bad posting that suggestion right after you've made this PR! 😰

Never feel bad about proposing an better solution (at least to me)! 😆 We're all here for what's best, I really mean that 🚀.

If anything, feel bad for my table! (╯°□°)╯︵ ┻━┻

I'll put my thoughts on #3068 there!

@mbrookes
Copy link
Member

If anything, feel bad for my table! (╯°□°)╯︵ ┻━┻

LOL 😆

@alitaheri
Copy link
Member

If anything, feel bad for my table! (╯°□°)╯︵ ┻━┻

Almost gave me a heart attack 😆 😆 😆

@newoga
Copy link
Contributor Author

newoga commented Jan 28, 2016

@mbrookes @oliviertassinari @alitaheri

I'll leave this branch open but close this PR while we consider #3079 (and #3068)

@newoga newoga closed this Jan 28, 2016
@alitaheri
Copy link
Member

Thank you. I was gonna rush here to stop you from deleting the branch :D :D :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: needs revision The pull request can't be merged. More details is available on the code review or fails in the CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants