filestack / filestack-react

Official React component for Filestack - API and content management system that makes it easy to add powerful file uploading and transformation capabilities to any web or mobile application.
https://www.filestack.com
MIT License
164 stars 40 forks source link

Add onClose prop to properly handle the picker being closed #114

Closed highri5e closed 2 years ago

highri5e commented 3 years ago

Since we're now handling the showing of the PickerOverlay ourselves, it would be good to have an onClose prop for PickerOverlay (just like onSuccess, onError) so we can handle the event of the picker being closed from within it's UI.

This is so we can update our state when the user closes the PickerOverlay with the x in the top right corner or hit ESC.

josephrace commented 3 years ago

In case it still helps - the filestack-js picker options (see https://filestack.github.io/filestack-js/interfaces/pickeroptions.html) are exposed through the pickerOptions prop and there's an onClose method there e.g.

<PickerOverlay
  apikey={YOUR_API_KEY}
  pickerOptions={{
    onClose: () => {
      // update your state
    }
  }}
/>
highri5e commented 3 years ago

Great thanks @josephrace!!!

MagdielPm commented 2 years ago

Amazing, it works!! Thanks @josephrace 🚀