chandu0101 / scalajs-react-components

Reusable scalajs-react components
http://chandu0101.github.io/sjrc/
Apache License 2.0
163 stars 65 forks source link

Document that ReactTapEventPlugin(js.undefined) is needed in JSApp body #86

Open beikern opened 7 years ago

beikern commented 7 years ago

If ReactTapEventPlugin(js.undefined) is not provided in the JsApp body the browser's console throws the following warning:

warning.js:36 Warning: Unknown prop `onTouchTap` on <button> tag. Remove this prop from the element. For details, see https://fb.me/react-unknown-prop
    in button (created by EnhancedButton)
    in EnhancedButton (created by FlatButton)
    in FlatButton (created by NavToolBar)
    in div (created by ToolbarGroup)
    in ToolbarGroup (created by NavToolBar)
    in div (created by Toolbar)
    in Toolbar (created by NavToolBar)
    in NavToolBar (created by Router)
    in MuiThemeProvider (created by Router)
    in div (created by Router)
    in nav (created by Router)
    in div (created by Router)
    in Router

Just putting it in the JsApp solves the warning, just like this:

object MyApp extends JSApp {
  //TODO: dev-server complains that we load several times?
  ReactTapEventPlugin(js.undefined)

  @JSExport
  override def main(): Unit = {
    val baseTheme = Mui.Styles.LightRawTheme
    val theme: MuiTheme =
      Mui.Styles.getMuiTheme(baseTheme)

    AppCSS.load()
    val router = MuiMuiThemeProvider(muiTheme = theme)(AppRouter.router())
    router.renderIntoDOM(dom.document.getElementById("content"))

    ()
  }
}
beikern commented 7 years ago

If the plugin is not present some Mui functionality does not work, like rendering MuiIconMenu with menuItems childrens when the icon is clicked. Even if the browser says it's a warning MUI will malfunction if the plugin is not in scope.