@ce1pers/use-image

1.0.4 • Public • Published

@ce1pers/use-image

React hook to getting image file in device.

Installation

npm

npm i @ce1pers/use-image

yarn

yarn add @ce1pers/use-image

Usage

// Import hook.
import useImage, { GRANTED, DENIED, NEVER_ASK_AGAIN } from "@ce1pers/use-image";

...

// Make any event handler(function).
const handleAnyButtonClick = async () => {
  const isGranted = await checkPermission();
  if (isGranted === GRANTED) {
    const asset = await selectImage();
    // Do something you want.
  } else {
    // Open app's info/setting (Optional).
    openSetting();
  }
};

...

Readme

Keywords

Package Sidebar

Install

npm i @ce1pers/use-image

Weekly Downloads

2

Version

1.0.4

License

MIT

Unpacked Size

3.91 kB

Total Files

4

Last publish

Collaborators

  • __coma__