react-native-get-media
v1.0.2
Published
Get media (photo/camera) easily without worrying about permission, without worrying if user block permission, without worrying either user pick camera or gallery. Just focus on your app, we handle media request thingy for you
Downloads
18
Maintainers
Readme
react-native-get-media
Get media (photo/camera) easily without worrying about permission, without worrying if user block permission. Just focus on your app, we handle media request thingy.
We handle:
- Asking user whether to use Camera or Gallery.
- Asking permission (in Javascript level, make sure you already configure
react-native-permissions
on native level). - Asking user to open setting if user already block permission in the first place.
- Return object returned by
react-native-image-picker
.
Dependencies
This libraries requires these libraries. PLease install it by yourself:
react-native-image-picker
react-native-permissions
react-native-actionsheet
Can install in one simple command npm i -S react-native-image-picker react-native-permissions react-native-actionsheet
or yarn add react-native-image-picker react-native-permissions react-native-actionsheet
.
Make sure you install and configure according to their documentations respectively.
"react-native-image-picker": "^1.1.0", "react-native-permissions": "^2.0.8", "react-native-actionsheet": "2.4.2"
Usage
//importing
import GetMedia from 'react-native-get-media';
//make sure you render the component. This is just wrapper of react-native-actionsheet. While onMedia Props return the same thing that react-native-image-picker returns. you can follow their docs.
<GetMedia
ref={instance => (this.getMedia = instance)}
onMedia={this.onImagePicked}
labels={{
cancel: 'Cancel,
camera: 'Camera,
gallery: 'Gallery',
}}
/>
//to call the get media wherever in the component
this.getMedia.askGetMedia();