Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/srbrahma/expo-image-picker-hook


https://github.com/srbrahma/expo-image-picker-hook

Last synced: 16 days ago
JSON representation

Awesome Lists containing this project

README

        

[![npm](https://img.shields.io/npm/v/expo-image-picker-hook)](https://www.npmjs.com/package/expo-image-picker-hook)
[![TypeScript](https://badgen.net/npm/types/env-var)](http://www.typescriptlang.org/)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)

# expo-image-picker-hook

Convenient hook for `expo-image-picker`.

Supports `blob` and `base64`.

## 💿 Installation
```bash
expo install expo-image-picker-hook expo-image-picker
```

## 📖 Usage

```tsx
function MyComponent() {
const ImagePicker = useImagePicker({
aspect: [2, 1],
quality: 0.9,
permissionNotGrantedText: 'You need to give the app permission to select the image.',
})

const pick = () => {
ImagePicker.pick()
.catch(err => Alert.alert('Error', err.message))
}

const upload = () => {
ImagePicker.upload({ fun: (image) => myApi.uploadImage(image) }, { mode: 'base64' })
.catch(err => Alert.alert('Error', err.message))
}

return (





)
}
```

## 📰 [Changelog](CHANGELOG.md)