creativetimofficial / material-kit-react

Material Kit React free and open source by Creative Tim
https://www.creative-tim.com/product/material-kit-react?ref=mkr-readme
1.19k stars 2.05k forks source link

BUG - Dist bundle is not rendering Regular Button (Exception thrown) #40

Closed jainmanoj closed 5 years ago

jainmanoj commented 6 years ago

Prerequisites

Please answer the following questions for yourself before submitting an issue.

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. step 1 - Create the package using build-package scripts Mount the package with npm link (globally) - material-kit-react module Create the Sample Page using and reference all the material-kit-react components All componets are rendered except Button. Here is the sample LoginCardPanelPage

` import React from "react"; // @material-ui/core components import withStyles from "@material-ui/core/styles/withStyles"; import InputAdornment from "@material-ui/core/InputAdornment"; import Icon from "@material-ui/core/Icon"; // @material-ui/icons import Email from "@material-ui/icons/Email"; import People from "@material-ui/icons/People"; // core components // import Header from "components/Header/Header.jsx"; // import HeaderLinks from "components/Header/HeaderLinks.jsx"; // import Footer from "components/Footer/Footer.jsx"; import GridContainer from "material-kit-react/dist/components/Grid/GridContainer"; // import GridContainer from "material-ui-kit/dist/components/Grid/GridContainer" ///home/ct-developer/NODEPRJ/mui-sample-react-app/node_modules/material-kit-react/dist/components/Card/Card.js import GridItem from "material-kit-react/dist/components/Grid/GridItem"; import Button from "material-kit-react/dist/components/CustomButtons/Button"; import Card from "material-kit-react/dist/components/Card/Card"; import CardBody from "material-kit-react/dist/components/Card/CardBody"; import CardHeader from "material-kit-react/dist/components/Card/CardHeader"; import CardFooter from "material-kit-react/dist/components/Card/CardFooter"; import CustomInput from "material-kit-react/dist/components/CustomInput/CustomInput";

import loginPageStyle from "material-kit-react/dist/assets/jss/material-kit-react/views/loginPage.js"; // /home/ct-developer/NODEPRJ/mui-sample-react-app/node_modules/material-kit-react/dist/assets/jss/material-kit-react/views/loginPage.js

// import image from "assets/img/bg7.jpg";

class LoginCardPanelPage extends React.Component { constructor(props) { super(props); // we use this to make the card to appear after the page has been rendered this.state = { cardAnimaton: "cardHidden" }; } componentDidMount() { // we add a hidden class to the card and after 700 ms we delete it and the transition appears setTimeout( function() { this.setState({ cardAnimaton: "" }); }.bind(this), 700 ); } render() { const { classes, ...rest } = this.props; return (

Login

Or Be Classical

) }} /> ) }} /> lock_outline ) }} />
);

} }

export default withStyles(loginPageStyle)(LoginCardPanelPage); `

  1. step 2 THe page is not rendering with Button component - ifyou remove that component it renders. This is the exception in debug console -

Download the React DevTools for a better development experience: https://fb.me/react-devtools react-dom.development.js:17411 Download the React DevTools for a better development experience: https://fb.me/react-devtools index.js:2178 Warning: Failed prop type: Invalid prop component of type object supplied to Route, expected function. in Route (at src/index.js:19)

invariant.js:42 Uncaught Error: Unable to find node on an unmounted component. at invariant (invariant.js:42) at findCurrentFiberUsingSlowPath (react-dom.development.js:3779) at findCurrentHostFiber (react-dom.development.js:3887) at findHostInstance (react-dom.development.js:16825) at Object.findDOMNode (react-dom.development.js:17311) at ButtonBase.componentDidMount (ButtonBase.js:222) at commitLifeCycles (react-dom.development.js:14524) at commitAllLifeCycles (react-dom.development.js:15738) at HTMLUnknownElement.callCallback (react-dom.development.js:145) at Object.invokeGuardedCallbackDev (react-dom.development.js:195) at invokeGuardedCallback (react-dom.development.js:248) at commitRoot (react-dom.development.js:15908) at completeRoot (react-dom.development.js:17296) at performWorkOnRoot (react-dom.development.js:17224) at performWork (react-dom.development.js:17128) at performSyncWork (react-dom.development.js:17100) at requestWork (react-dom.development.js:16988) at scheduleWork (react-dom.development.js:16782) at scheduleRootUpdate (react-dom.development.js:17470) at updateContainerAtExpirationTime (react-dom.development.js:17497) at updateContainer (react-dom.development.js:17524) at ReactRoot../node_modules/react-dom/cjs/react-dom.development.js.ReactRoot.render (react-dom.development.js:17786) at react-dom.development.js:17926 at unbatchedUpdates (react-dom.development.js:17351) at legacyRenderSubtreeIntoContainer (react-dom.development.js:17922) at Object.render (react-dom.development.js:17981) at Object../src/index.js (index.js:15) at webpack_require (bootstrap b3c89797df7aeab37343:678) at fn (bootstrap b3c89797df7aeab37343:88) at Object.0 (LoginCardPanelPage.jsx:127) at webpack_require (bootstrap b3c89797df7aeab37343:678) at ../material-kit-react/dist/assets/jss/material-kit-react.js.Object.defineProperty.value (bootstrap b3c89797df7aeab37343:724) at bootstrap b3c89797df7aeab37343:724

index.js:2178 The above error occurred in the component: in ButtonBase in WithStyles(ButtonBase) in Button in WithStyles(Button) in RegularButton in WithStyles(RegularButton) (at LoginCardPanelPage.jsx:113) in div in CardFooter in WithStyles(CardFooter) (at LoginCardPanelPage.jsx:112) in form (at LoginCardPanelPage.jsx:55) in div in Card in WithStyles(Card) (at LoginCardPanelPage.jsx:54) in div in Grid in WithStyles(Grid) in GridItem in WithStyles(GridItem) (at LoginCardPanelPage.jsx:53) in div in Grid in WithStyles(Grid) in GridContainer in WithStyles(GridContainer) (at LoginCardPanelPage.jsx:52) in div (at LoginCardPanelPage.jsx:51) in div (at LoginCardPanelPage.jsx:49) in LoginCardPanelPage (created by WithStyles(LoginCardPanelPage)) in WithStyles(LoginCardPanelPage) (created by Route) in Route (at src/index.js:19) in Switch (at src/index.js:17) in Router (at src/index.js:16)

einazare commented 6 years ago

Hello there @jainmanoj again,

Can you please explain to me why did you use the build-package script and after that made changes in it? Something does not add up on your description. You first build the package and after that you make changes? Can you please make some more explicit steps, if you can't, just make me a video to understand what changes did you make? Also, I think it would be better for you to use our npmjs package, than to use the build-package script - I believe on our next update we are going to remove that from our package.json.

Best, Manu

jainmanoj commented 6 years ago

Thanks for looking into issue.

I am trying to use react-kit as a package. So first step I create react-kit dist package and install it as local package using "npm link" as my project dependency.

2nd step - I create a Login page and replace all react-kit dependencies with package path.

The new login page come up without any of button component. If I put react-kit button component as dependency it throw exception.

Thanks Manoj

On Sun, Sep 16, 2018, 2:09 PM Nazare Emanuel-Ioan notifications@github.com wrote:

Hello there @jainmanoj https://github.com/jainmanoj again,

Can you please explain to me why did you use the build-package script and after that made changes in it? Something does not add up on your description. You first build the package and after that you make changes? Can you please make some more explicit steps, if you can't, just make me a video to understand what changes did you make? Also, I think it would be better for you to use our npmjs package https://www.npmjs.com/package/material-kit-react, than to use the build-package script - I believe on our next update we are going to remove that from our package.json.

Best, Manu

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/creativetimofficial/material-kit-react/issues/40#issuecomment-421724627, or mute the thread https://github.com/notifications/unsubscribe-auth/AFEokGUeJbxrmbWhpacMjfdPuRpkDKNuks5ubg5MgaJpZM4WpNfQ .

einazare commented 6 years ago

Hello again @jainmanoj ,

The thing that I do not get it / I don't understand, is where did you create the Login Page?

Best, Manu

romannep commented 5 years ago

@jainmanoj This error can be caused by react verisons conflict. Kit comes with fixed react version in package.json, so when it differ from react version in your main package it can throw such error.