在npm之后安装Material UI构建错误,同时在React Native中导入组件

时间:2018-10-29 12:35:42

标签: javascript reactjs react-native material-ui

在基本的Native Native中,通过EXPO安装了

之类的所有基本依赖项后,创建了一个空白项目
npm install --save react-navigation (for navigation),
npm install @material-ui/core (for material-ui),
npm install react react-dom (for react and react DOM),
npm install (for its dependencies)

在安装完以上项目之后,我复制了与MATERIAL-UI文档中相同的整个按钮组件。

,然后在执行构建命令的“ expo start”命令时,错误显示如下。the error message

请提供帮助!

import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from '@material-ui/core/styles';
import Button from '@material-ui/core/Button';

const styles = theme => ({
  button: {
    margin: theme.spacing.unit,
  },
  input: {
    display: 'none',
  },
});

function TextButtons(props) {
  const { classes } = props;
  return (
    <div>
      <Button className={classes.button}>Default</Button>
      <Button color="primary" className={classes.button}>
        Primary
      </Button>
      <Button color="secondary" className={classes.button}>
        Secondary
      </Button>
      <Button disabled className={classes.button}>
        Disabled
      </Button>
      <Button href="#text-buttons" className={classes.button}>
        Link
      </Button>
      <input
        accept="image/*"
        className={classes.input}
        id="flat-button-file"
        multiple
        type="file"
      />
      <label htmlFor="flat-button-file">
        <Button component="span" className={classes.button}>
          Upload
        </Button>
      </label>
    </div>
  );
}

TextButtons.propTypes = {
  classes: PropTypes.object.isRequired,
};

export default withStyles(styles)(TextButtons);

0 个答案:

没有答案