material-ui

Bootstrap vs Material UI for React?

不羁岁月 提交于 2019-11-30 08:40:45
I have been using both in my projects and sometimes I find the need to use a Material UI component within a bootstrap component and the UI displays as I would expect. I have been advised though not to use this approach. Is there any reason why since both are using the grid and can be flexed? o43 I tend to be verbose so I'll put the concise answer up top here: Conclusion: Whoever said it was bad to use both might just be expressing their opinion, in reality saying it's bad to use both really lacks context in what you're designing. @user3770494 made a very good point- but the point, while valid

Changing the URL in react-router v4 without using Redirect or Link [duplicate]

风格不统一 提交于 2019-11-30 05:43:27
This question already has an answer here: Programmatically Navigate using react-router 8 answers I'm using react-router v4 and material-ui in my React app. I was wondering how to change the URL once there is a click on a GridTile within GridList . My initial idea was to use a handler for onTouchTap . However, the only way I can see to redirect is by using the components Redirect or Link . How could I change the URL without rendering those two components? I've tried this.context.router.push('/foo') but it doesn't seem to work. Try this, this.props.router.push('/foo') warning works for versions

Pass state to recursively nested component in React/Redux

大憨熊 提交于 2019-11-30 04:03:41
I have a component that has children of the same type as the component itself. I can render the children as well but the children can't seem to access their slice of state. I'm using React with Redux export class Material extends React.Component { constructor(props) { super(props) this.renderChild = this.renderChild.bind(this) this.getNestedItems = this.getNestedItems.bind(this) } static propTypes = { parentId: PropTypes.number, id: PropTypes.number.isRequired, name: PropTypes.string.isRequired, subtext: PropTypes.string.isRequired, childIds: PropTypes.arrayOf(PropTypes.number.isRequired),

How to change Material UI input underline colour?

百般思念 提交于 2019-11-30 03:28:07
问题 I have a Material UI Select component that is on a dark background, so for just this one component I'd like to change it so that the text and line colours are all white. The rest of the Select instances should remain unchanged. While I can get the text and icon to change colour, I can't seem to figure out how to use the classes prop to set the underline colour. My attempts also seem to make the open icon wrap to the next line too. Here's an example demonstrating the problem: I've set my style

Hide Appbar on Scroll Flutter?

試著忘記壹切 提交于 2019-11-30 02:30:22
Consider this image. As you can see it has an appbar and the appbar has Tabbed buttons. Am trying to animate the appbar so that it hides on scrollup and leaves only the Tab Buttons showing and on scrollup the appbar apears. Please help me out. Sorry for bad english and not American neither am I English If I understood you correctly, following code should make the app bar hide on scroll while TabBar remains visible: new Scaffold( body: new NestedScrollView( controller: _scrollViewController, headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { return <Widget>[ new SliverAppBar

How to setup Material-UI for React with Typescript?

时光总嘲笑我的痴心妄想 提交于 2019-11-30 00:04:49
I've run in some problems add Material UI to my React project, which is programmed with Typescript. According to the tutorial, I start with adding the react-tab-event-plugin first. import injectTapEventPlugin from 'react-tap-event-plugin'; // Needed for onTouchTap // Can go away when react 1.0 release // Check this repo: // https://github.com/zilverline/react-tap-event-plugin injectTapEventPlugin(); Doing this, I get an error about the missing default export. ERROR in ./src/index.tsx (4,8): error TS1192: Module ''react-tap-event-plugin'' has no default export. Adding Material UI import

How to overwrite classes and styles in material-ui (React)

妖精的绣舞 提交于 2019-11-29 19:53:46
问题 I'm using version 1.2.1 of material-ui and I'm trying to overwrite the AppBar component to be transparent. The documentation outlines how to overwrite styles here. My code: import React, { Component } from 'react'; import AppBar from '@material-ui/core/AppBar'; import Toolbar from '@material-ui/core/Toolbar'; import logo from '../Assets/logo.svg'; class NavigationBar extends Component { render() { const styles = { root: { backgroundColor: 'transparent', boxShadow: 'none', }, }; return (

Styling the placeholder in a TextField

冷暖自知 提交于 2019-11-29 17:51:44
问题 The TextField API doesn't mention anything about how one could style the pseudo placeholder element of the input element. Basically, I would like to change the default styling of the placeholder text, and the normal bag of tricks doesn't work, as I cannot access the element. Is there a way I can get to it? And if so, what is the JSS/React/DOM equivalent way of writing ::-webkit-input-placeholder ? 回答1: Case 1 Put the desired placeholder text in the label property of the TextField component,

Material UI remove the yellow background on TextField autofill

一世执手 提交于 2019-11-29 16:38:53
I'm having a really hard time to remove the yellow background on autofill from the Material UI TextField component. In older versions I did it this way: const inputStyle = { WebkitBoxShadow: '0 0 0 1000px white inset' }; <TextField ... inputStyle={inputStyle} /> But in the recent version the inputStyle prop was removed and added InputProps instead. I've tried to remove it this way, but the yellow background color still appears: import React from "react"; import PropTypes from "prop-types"; import { withStyles } from "@material-ui/core/styles"; import TextField from "@material-ui/core/TextField

How to pass context down to the Enzyme mount method to test component which includes Material UI component?

好久不见. 提交于 2019-11-29 16:00:46
问题 I am trying to use mount from Enzyme to test my component in which a several Material UI component are nested. I get this error when running the test: TypeError: Cannot read property 'prepareStyles' of undefined After some digging, I did found that a theme needs to be passed down in a context. I am doing that in the test but still get this error. My test: import expect from 'expect'; import React, {PropTypes} from 'react'; import {mount} from 'enzyme'; import SearchBar from './SearchBar';