0
votes

Could anyone please direct me to a working code that uses the React Dropzone npm package that could be used for SharePoint Framework which is using React?

Thank you.

1

1 Answers

0
votes

I have a working example for 1.8.2

import Dropzone from 'react-dropzone';
import * as React from 'react';
public render(): React.ReactElement<IAccountReaderProps> {
        return <div>
            <Dropzone onDrop={this.onDrop}>
                {({ getRootProps, getInputProps, isDragActive, isDragAccept, isDragReject, acceptedFiles, rejectedFiles }) => {


                    return (
                        <div> 
                             <div {...getRootProps()} className={styles.dragAndDropWrapper}>

                            <input {...getInputProps()} />
                            <div>
                                <h1>Drag and drop file here</h1>
                            </div>
                            {isDragReject && <div>Unsupported file type...</div>}
                        </div>
                        </div>

                    );
                }}
            </Dropzone>
        </div>;
    }


 private onDrop = (acceptedFiles, rejectedFiles) => {



    }