【问题标题】:Material-UI-next Theme not being applied to circular progressMaterial-UI-next 主题未应用于循环进度
【发布时间】:2018-02-24 05:00:51
【问题描述】:

我已根据文档更新了我的主题,但循环进度继续使用默认的原色,而不是主题中指定的原色。最终我希望能够通过最终用户调整主题,使用 mobx 计算值来调整主题,但目前我什至无法让它与静态主题一起使用。

import {MuiThemeProvider} from "material-ui/styles"
import Loading from "../common/components/Loading";
import {createMuiTheme} from "material-ui";


const testingTheme = createMuiTheme({
    primary: {
        main: '#67e2ff',
        light: '#a0ffff',
        dark: '#1eb0cc',
        contrastText: '#3b3f42'
    },

    secondary: {
        main: '#590ce8',
        light: '#9549ff',
        dark: '#0000b4',
        contrastText: '#fefefe'
    }});

/**
 * The AppContainer handles all of the logical functionality that has to happen at the root level.
 * A prime example is the MuiThemeProvider, that must be the parent of all other rendered components.
 * To change the muiTheme we use the AppContainer to render the MuiThemeProvider
 */
@inject("uiStore") @observer
export default class AppContainer extends Component {
    componentDidMount() {
        console.log(this.props.uiStore);
    }
    render() {
        return (
            <MuiThemeProvider theme={testingTheme}>
                {this.props.uiStore.initialized ? <App/> : <Loading size={10}/>}
            </MuiThemeProvider>
        )
    }
}

【问题讨论】:

    标签: reactjs material-ui


    【解决方案1】:

    我对主题的定义是错误的,我缺少根调色板属性。

    const testingTheme = createMuiTheme({
        palette: {
            primary: {
                main: '#67e2ff',
                light: '#a0ffff',
                dark: '#1eb0cc',
                contrastText: '#3b3f42'
            },
    
            secondary: {
                main: '#590ce8',
                light: '#9549ff',
                dark: '#0000b4',
                contrastText: '#fefefe'
            }
        }
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-10-14
      • 2018-04-21
      • 2019-11-18
      • 2018-08-30
      • 2020-08-19
      • 1970-01-01
      • 2018-10-06
      相关资源
      最近更新 更多