material-ui

Type 'ReactType' is not generic (material-ui@next)

心已入冬 提交于 2019-12-10 14:13:08
问题 i install material ui@next and i have this error in node modules. ERROR in [at-loader] ./node_modules/material-ui/Avatar/Avatar.d.ts:8:15 11:31:52 web.1 | TS2315: Type 'ReactType' is not generic. 11:31:52 web.1 | ERROR in [at-loader] ./node_modules/material-ui/Button/Button.d.ts:7:15 11:31:52 web.1 | TS2315: Type 'ReactType' is not generic. 11:31:52 web.1 | ERROR in [at-loader] ./node_modules/material-ui/ButtonBase/ButtonBase.d.ts:10:15 11:31:52 web.1 | webpack: Failed to compile. 回答1: Do an

Material-UI: the shadows array provided to createMuiTheme should support 25 elevations

丶灬走出姿态 提交于 2019-12-10 13:47:55
问题 I'm trying to get rid of shadows in the Material-UI theme. I found this answer here with fixed the problem. However I get the error message in the title of this question. const theme = createMuiTheme({ palette: { primary: { light: red[300], main: red[500], dark: red[700] }, secondary: { light: red.A200, main: red.A400, dark: red.A700 } }, shadows: ['none'] }); Error: browser.js:49 Warning: Material-UI: the shadows array provided to createMuiTheme should support 25 elevations. I found this

Flutter FilterChip Avatar Selected Style

时光总嘲笑我的痴心妄想 提交于 2019-12-10 13:19:22
问题 I'm using FilterChip with a CircleAvatar for avatar, but the selected state has a nasty rectangle that I can't seem to find any reference for. How do I remove it? Code: child: FilterChip( avatar: CircleAvatar( backgroundColor: category.color ), label: Text(category.name), selected: badCategoryIds.contains(category.id), onSelected: (bool value) { if (value) { badCategoryIds.add(category.id); } else { badCategoryIds.remove(category.id); } categoryChoiceCallback(badCategoryIds); }, ) Result: How

How do I avoid 'Function components cannot be given refs' when using react-router-dom?

一曲冷凌霜 提交于 2019-12-10 13:12:55
问题 I have the following (using Material UI).... import React from "react"; import { NavLink } from "react-router-dom"; import Tabs from "@material-ui/core/Tabs"; import Tab from "@material-ui/core/Tab"; function LinkTab(link){ return <Tab component={NavLink} to={link.link} label={link.label} value={link.link} key={link.link} />; } In the new versions this causes the following warning... Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use

How to use an SVG file in a SvgIcon in Material-UI

僤鯓⒐⒋嵵緔 提交于 2019-12-10 12:28:44
问题 I've got an SVG file and I want to make an SvgIcon component out of it, how should I do that? In the documentation, all the examples use either predefined Material Icons or a strange notation of <path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z" /> which I have no idea what it is! 回答1: <path /> is an SVG path, i.e. the internal bits of the SVG. the SvgIcon component really should be able to take a path, but it doesn't :( instead you can create a component like https://github.com/callemall/material

Material-UI v1: Using the custom colors for theme configuration

孤者浪人 提交于 2019-12-10 12:14:22
问题 This should be a pretty simple thing but I am pretty new to material-ui.I am using material-ui v1 and I am trying to change the primary color of the theme. This is how my theme object looks like without using the custom color: import { createMuiTheme } from 'material-ui-next/styles'; import blue from 'material-ui-next/colors/purple'; import green from 'material-ui-next/colors/green'; import red from 'material-ui-next/colors/red'; const theme = createMuiTheme({ palette: { primary: green,

How to mount styles inside shadow root using cssinjs/jss

♀尐吖头ヾ 提交于 2019-12-10 10:51:39
问题 I'm trying to use https://material-ui.com/ components inside shadow dom, and need a way to inject those styles inside shadow dom. by default material-ui , which uses jss under the hood injects styles in the head of the page. Is that even possible? Can anyone come with an example? 回答1: This is what my web component looks like, it is a web component that renders a react app that contains material-ui styles. import * as React from 'react'; import { render } from 'react-dom'; import {

class name convention in react material-ui framework

喜夏-厌秋 提交于 2019-12-10 10:49:35
问题 Is there a class name convention used in material ui library? I'm currently using material-ui-next. I notice class names like "MuiFormControl-root-124" all over the place with numbers appended to class name. For Paper element "MuiPaper-root-18 MuiPaper-shadow2-22 MuiPaper-rounded-19". I just can't see a pattern here. Is there a convention which I'm missing. It would be easier to understand this framework if it made sense like Bootstraps grid classes. All help much appreciated. Thank you. 回答1:

Can't override a style of a deeply nested component (Material-UI Jss Styling)

断了今生、忘了曾经 提交于 2019-12-10 09:23:14
问题 Material-UI's ExpansionPanelSummary component allows to render an icon inside it via the expandIcon prop, and to change its style by the expandIcon css class. As you can see in the implementation of the component, this class has nested class which adds transform: '&$expanded': { transform: 'translateY(-50%) rotate(180deg)', }, There is no access to this nested class via component's API, and my need is to override it. I have tried to do this with jss-nested plugin as described here and

How Can I Mask My Material-UI TextField?

巧了我就是萌 提交于 2019-12-10 02:56:31
问题 I have a TextField for phone numbers in a short form. And then i want to mask this form field like (0)xxx xxx xx xx. I'm trying to use react-input-mask plugin with Material-UI. But if i want to change input value, this is not updating the my main TextField. <TextField ref="phone" name="phone" type="text" value={this.state.phone} onChange={this.onChange} > <InputMask value={this.state.phone} onChange={this.onChange} mask="(0)999 999 99 99" maskChar=" " /> </TextField> Actually, I couldn't find