Имя файла не отображается, после выбора файла - PullRequest
1 голос
/ 22 мая 2019

У меня есть поле типа входного файла в следующем компоненте.Я сделал несколько настроек, чтобы изменить стиль по умолчанию.Теперь, если я загружаю файл, он должен показать имя загружаемого файла вместо выбора файла.Теперь он показывает только файл выбора даже после того, как я загрузил файл.

import React, { Component } from 'react';
import CsvParse from '@vtex/react-csv-parse';
import Button from '@material-ui/core/Button';
import Typography from '@material-ui/core/Typography';

class fileUpload extends Component {

  render() {
    return (
      <div>
        <Typography className="biz-steps-head" gutterBottom>
          <span style={{color:"#000"}}> Upload Email List </span>
        </Typography>
        <Typography varient="p" className="ed-con-upload" gutterBottom>
            List emails in Column A of the spreadsheet. The first row will not be counted.
        </Typography>
        <div className="input-upload">
           <CsvParse
            keys={this.props.keys}
            onDataUploaded={this.props.handleData}
            onError={this.props.handleError}
            render={onChange => <input type="file" className="displayNone" id="contained-button-file" onChange={onChange} />}
        />
        <label htmlFor="contained-button-file">
           <span className="spanText">Choose File</span>
        </label>

        <Button variant="contained" className="upload-button" onClick={this.handleUpload}>
          Submit
        </Button>
           </div>
      </div>
    )
  }
}

export default fileUpload;
...