MinJieLiu/react-photo-view

Open image programmatically

Opened this issue · 0 comments

Hi, i'm looking for a way to open the overlay with a specific image from "outside", i.e. using a React hook.
Is this possible?

function App() {
  const photoView = usePhotoView()

  return (
    <>
      <button onClick={() => photoView.open(someImage)}>Open Image</button>
      <PhotoProvider photoView={photoView}>
        {/* ... */}
      </PhotoProvider>
    </>
  );
}