Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/srbrahma/expo-image-picker-hook
https://github.com/srbrahma/expo-image-picker-hook
Last synced: 16 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/srbrahma/expo-image-picker-hook
- Owner: SrBrahma
- License: mit
- Created: 2022-06-12T05:53:33.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-06-12T21:37:25.000Z (over 2 years ago)
- Last Synced: 2024-12-17T16:04:01.016Z (17 days ago)
- Language: TypeScript
- Size: 1.17 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
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)