Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React 18 support #132

Open
adboio opened this issue Mar 7, 2023 · 6 comments
Open

React 18 support #132

adboio opened this issue Mar 7, 2023 · 6 comments

Comments

@adboio
Copy link

adboio commented Mar 7, 2023

It looks like this module only supports React 16, but we're on v18 now. Can we expect React 18 support soon?

@KayakinKoder
Copy link

Filestack seems to be going out of business. We switched to UploadCare

@Wamy-Dev
Copy link

Really? Going out of business?

@phlare
Copy link

phlare commented May 23, 2023 via email

@KayakinKoder
Copy link

KayakinKoder commented Sep 7, 2023

No commits to main since Sept. 2021. We switched to Uploadcare. It's kind of amazing that a company named _File_stack doesn't update their primary file uploader for years on end

@Californian
Copy link

This is unmaintained, switching to Uppy (they have a much more sane react implementation than uploadcare).

@ivantokar
Copy link

ivantokar commented Sep 25, 2023

As for me the best way do not use the FileStack as React component. I have used the common JS library JavaScript SDK in my React app

JavaScript File Picker Doc

I created a simple hook for my needs and it works well

import * as filestack from 'filestack-js'
import './picker.css'

function useFileUploader(options: filestack.PickerOptions) {
    const initialOptions = {
        fromSources: ['local_file_system'],
        maxSize: 3024000,
        maxFiles: 1,
        minFiles: 1,
        uploadInBackground: true,
        onClose: () => picker.close(),
        onCancel: () => picker.close(),
    }

    const client = filestack.init(FILE_STACK_API_KEY)
    const picker = client.picker({ ...initialOptions, ...options })
    
    /* ... */
    
    return {
        picker
        /* ... */
    }
}

Use useFileUploader in another component

const UploadFile: React.FC = () => {
    const { picker } = useFileUploader({
        accept: ['image/*'],
        transformations: {
            crop: true,
            rotate: true,
        },
        onUploadDone: (result) => onUploadDone(result),
    })

    /**
     * Handle a success uploading result
     *
     * @param result
     */
    const onUploadDone = async (result) => {
        picker.close()
        /* ... */
    }
    
    return (<button onClick={() => picker.open()}>Add</button>)
}

Uninstall and forget about this repository 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants