material-ui

showing html in the browser but not the textbox

那年仲夏 提交于 2019-12-25 03:15:11
问题 update1 : updated image for better understanding I am trying to implement chip filters similar to googleflights. Right now when you select sports it will show sports1 it will replace sports by sports1. However, I wanted to insert a textbox, when I enter somevalue in the textbox and hit Enter the primary fee schedule value should change to the entered value. Can you tell me how to fix it? chip related code is in chip-selector and tab-demo since if I enter textbox tag. I am just getting string

Invalid hook call. Hooks can only be called inside of the body of a function component

瘦欲@ 提交于 2019-12-25 03:12:37
问题 I am new to React and Now I would like to show some record in the table and now I got this error. Help me, please. Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons: 1. You might have mismatching versions of React and the renderer (such as React DOM) 2. You might be breaking the Rules of Hooks 3. You might have more than one copy of React in the same app See for tips about how to debug and fix this

How to set Material UI (withStyle) style on an external file in React?

∥☆過路亽.° 提交于 2019-12-25 02:16:06
问题 I'm trying to put all my styles in an external file to be cleaner but i can't find the solution to do it. For exemple, i've got something like this: const styles = theme => ({ appBar: { zIndex: theme.zIndex.drawer + 1, position: 'absolute', marginLeft: drawerWidth, width: '100%', }, }); with this at the end of my App component: App.propTypes = { classes: PropTypes.object.isRequired, theme: PropTypes.object.isRequired, }; export default withStyles(styles, { withTheme: true })(App); But if i'm

ReactJS with MaterialUI dialog: Testing using Jest Enzyme shallow text return empty

大憨熊 提交于 2019-12-25 01:45:34
问题 I have this React component having Material UI Dialog Using Full screen dialog from here https://material-ui.com/demos/dialogs/ import React from 'react'; import PropTypes from 'prop-types'; import Button from '@material-ui/core/Button'; import Dialog from '@material-ui/core/Dialog'; import DialogActions from '@material-ui/core/DialogActions'; import DialogContent from '@material-ui/core/DialogContent'; import DialogContentText from '@material-ui/core/DialogContentText'; import DialogTitle

Passing in className to React Component

為{幸葍}努か 提交于 2019-12-25 01:34:48
问题 I am trying to pass a classname to the material-ui Button component but can't seem to get it to work. Below are my attempts. Attempt 1 : attributes.map((attribute, index) => { const classString = 'classes.button' + index; console.log(classString) return ( <Button className={classString} onClick={this.handleClick.bind(this, attribute)}> {attribute} </Button> )} )} Attempt 2 : attributes.map((attribute, index) => { const classString = 'classes.button' + index; console.log(classString) return (

MaterialUI - Changing the color Textfield on focus

穿精又带淫゛_ 提交于 2019-12-25 00:18:57
问题 I'm trying to change the color of the label text in Textfield but I can't seem to figure it out. Here is what I'm trying: <TextField value={value} key={name} label={label} id={id} name={name} InputLabelProps={{ shrink: true, FormLabelClasses: { 'root': { '&:focused': { color: 'white' } }, focused: 'true' } }} /> Can someone give me a pointer on what I'm doing wrong here? I've also tried using the MuiThemeProvider but can't seem to figure that one out either: const theme = createMuiTheme({

Nesting buttons in Material UI: how to disable ripple effect of container button while clicking on a child button?

╄→尐↘猪︶ㄣ 提交于 2019-12-24 23:42:39
问题 I am trying to nest one button into another ( IconButton inside ListItem with button prop). The problem is that the ListItem ripple animation gets triggered even if I click on the IconButton . I want it to trigger only if I click directly on ListItem element I've tried absolute positioning of IconButton , which didn't help See the example 回答1: You can either do it like this: function App() { const mouseDown = e => { e.stopPropagation (); } return ( <ListItem button> Some text <IconButton

How to I change font color in DialogTitle and DialogContent in Material UI in react.js

陌路散爱 提交于 2019-12-24 19:52:58
问题 How to I change font/text color in DialogTitle and DialogContent in Material UI in react.js Changing background color for Dialog works but trying to change font color for Dialog and DialogContent doesn't work.. <Dialog open={this.state.open} aria-labelledby="alert-dialog-title" aria-describedby="alert-dialog-description" PaperProps={{ style: { backgroundColor: "#fff", }, }} > <DialogTitle id="alert-dialog-title"> "Use Google's location service?" </DialogTitle> <DialogContent>

Material UI theme global Dense setting

青春壹個敷衍的年華 提交于 2019-12-24 16:54:27
问题 Is there a way to set global Dense setting preferably somewhere inside theme config? I'm building applications exclusively for desktop users and would like more information to be on the screen. Gmail already has this option And many individual components have property to make them more compact. 回答1: You can set default values for any Material-UI component props. See the documentation here: https://material-ui.com/customization/globals/#default-props. For instance to default all Material-UI

Failed prop type: Invalid prop `onClick` of type `object` supplied to `ButtonBase`, expected `function`

天涯浪子 提交于 2019-12-24 15:41:59
问题 <Fab raised="true" size="small" color="primary" variant="extended" onClick={props.Store.fetchFromServer} and this.fetchFromServer = async () => { await console.log('test') } works fine. But when changed to following <Fab raised="true" size="small" color="primary" variant="extended" onClick={props.Store.fetchFromServer('test')} and this.fetchFromServer = async (val) => { await console.log(val) } throw following error, what I am missing? Failed prop type: Invalid prop `onClick` of type `object`