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

Once closed it cannot be reopened #127

Open
haris316 opened this issue Jun 1, 2022 · 2 comments
Open

Once closed it cannot be reopened #127

haris316 opened this issue Jun 1, 2022 · 2 comments

Comments

@haris316
Copy link

haris316 commented Jun 1, 2022

Capture
What I am trying to do is display a picker overlay on a button click. Once the Overlay appears and a user mistakenly closes it, there is no option to re-render it.

I have already tried onClose but it does not matter if my local variable is set to false. The component does not appear.

Any help would be appreciated..

@peterjhart
Copy link

import { PickerOverlay } from 'filestack-react';

function MyComponent(): JSX.Element {
  const [isOpen, setIsOpen] = setState<boolean>(false);

  const pickerOptions = {
    onClose,
  };

  function onClose() {
    setIsOpen(false);
  }

  function open() {
    setIsOpen(true);
  }

  return (
    <>
      { isOpen && (
        <div style="position:absolute">
          <PickerOverlay apiKey={MY_KEY} pickerOptions={pickerOptions} />
        </div>
      )}
      <button onClick={open}>Upload</open>
    </>
  );
}

@jared-christensen
Copy link

Wish this was an example in the readme.

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

3 participants