material-ui

Deprecated typography warning when using custom theme in Material-UI

时光总嘲笑我的痴心妄想 提交于 2019-12-08 01:26:08
问题 In the following code code, I am using a custom theme in Material-UI: import React from "react"; import ReactDOM from "react-dom"; import { MuiThemeProvider, createMuiTheme } from "@material-ui/core/styles"; import Button from "@material-ui/core/Button"; import { purple, green } from "@material-ui/core/colors"; const theme = createMuiTheme({ palette: { primary: purple, secondary: green } }); function App() { return ( <MuiThemeProvider theme={theme}> <Button color="primary">Button1</Button>

How to override material-ui MenuItem selected background color?

試著忘記壹切 提交于 2019-12-07 14:54:34
问题 Currently I am struggling with setting the background color of a MenuItem component which is selected to a different color. (without having to using !important to force it) The component code: <MenuItem classes={{ root: this.props.classes.root, selected: this.props.classes.selected }} value={10}> Alfabetical </MenuItem> This is the css: const homePageStyle = (theme) => ({ root: { width: "300px" }, selected: { backgroundColor: "turquoise !important", color: "white", fontWeight: 600 } }); What

How to override styles for material-ui TextField component without using the MUIThemeProvider?

*爱你&永不变心* 提交于 2019-12-07 12:18:23
问题 How would I hide / remove the underline in a TextField component without using the following code: const theme = createMuiTheme({ overrides: { MuiInput: { underline: { '&:hover:not($disabled):before': { backgroundColor: 'rgba(0, 188, 212, 0.7)', }, }, }, }, }); I would like to do it with props and according to the docs: https://material-ui.com/api/input/ I should be able to change the underline prop, but it does not work. 回答1: This is how you do it: <TextField id="name" label="Name" value=

Material-UI Style Override?

允我心安 提交于 2019-12-07 06:38:27
问题 I'm updating my app from Material-UI v1 to v2. I'm trying to use a style override to set the color of a selected <BottomNavigationAction> element. const styles = { bottomNavStyle: { position: 'fixed', left: '0px', bottom: '0px', height: '50px', width: '100%', zIndex: '100' }, '&$selected': { color: "#00bcd4" //<==trying to add this color to selected items }, }; class bottom_nav extends Component { state = { selectedIndex: -1, }; handleChange = (event, value) => { this.setState({value}); };

Redux form: REGISTER_FIELD / UNREGISTER_FIELD get called after change or focus events

让人想犯罪 __ 提交于 2019-12-07 06:13:38
问题 I’m using Redux Form to render and handle form events in my React app. The following things are used: Initial values Field arrays Immutable.js Material UI Also, the field arrays are build using the initial values. export default connect( state => { return { buttonVisible, confirm, initialValues: Immutable.Map({ configuration_items: configuration_items, }) } } )(AssetConfiguration) The problem is that all the fields in the form get deregistered and registered on every change or focus event.

Action creators not showing in “this.props” with redux-form 6.0.0-rc.3

喜欢而已 提交于 2019-12-07 05:13:28
问题 When I used redux-form 5.3.1 I was able to access my action creators. But as I needed Material-UI, I updated it to 6.0.0-rc.3. Changes from 5.3.1 to 6.0.0: Removed fields from render(): const { handleSubmit, fields: { email, password, passwordConfirm }} = this.props; Removed errors validation from under inputs: {email.touched && email.error && <div className="error">{email.error}</div>} Removed fields array from export default: export default reduxForm({ form: 'signup', fields: ['email',

Material UI Drawer won't move under Appbar

为君一笑 提交于 2019-12-07 04:58:49
问题 I have an Appbar and a drawer right beneath it. Under both components I have 3 divs with bootstrap and in each div I have a group of buttons. The problem is that the Drawer covers the Appbar and I just can't seem to move it. Here's my code: <div className="App"> <AppBar position="static"> <Toolbar> <IconButton color="inherit" aria-label="Menu"> <MenuIcon /> </IconButton> <Typography variant="title" color="inherit" aria-label="Menu"> title </Typography> </Toolbar> </AppBar> <Drawer variant=

Is it possible to get the name of a nested, inner React Component by calling a function from one of its props?

半城伤御伤魂 提交于 2019-12-07 02:02:28
I have this component: class DashboardPage extends Component { constructor(props) { super(props); this.state = { loading: true, shownPage: ActiveDeals, error: false, errorDetails: null, activeIcon: "Home" }; } componentDidMount() { // } setShownPage = (name, iconName) => () => { this.setState({ shownPage: name, activeIcon: iconName }); }; getIconColor = () => { // could I call this from the Home component and check its name? Or know the caller? return "primary"; }; render() { const { classes } = this.props; const menuItems = ( <List> <ListItem className={classNames(classes.listItem)} button

How to use Material-UI in asp.net mvc project

浪子不回头ぞ 提交于 2019-12-07 01:43:46
问题 Is there a way of using Material-UI without having to go through installing all of the dependencies using NodeJS. I would love to use this in an ASP.NET Project but dont know where to begin as per installing dependencies and all of that. 回答1: it's very easy.. Follow the below steps. Commit all the existing changes to your source control or backup existing code. delete or comment twitter bootstrap bundles in bundle config. using NPN .. install material design lite package. add all the .css and

How to use react-jss with MaterialUI 4?

只愿长相守 提交于 2019-12-06 15:48:57
I've used react-jss with material-ui for a while now. The material-ui 3.x -> 4.x migration guide says that MUI 4 isn't compatible with React JSS 9.x: https://material-ui.com/guides/migration-v3/ Furthermore, it looks like the react-jss project has been archived: https://github.com/cssinjs/react-jss ...but JSS is up to at least version 10: https://cssinjs.org/?v=v10.0.0-alpha.16 So I'm completely confused on how to use React-JSS with MUI 4. Is the import something other than "react-jss": "8.6.1", in package.json ? Should I switch to Emotion or Styled Components? So confused. You can use: "react