@paralect/native-media-picker
v1.0.22
Published
An instagram-like designed native media picker for ReactNative applications
Downloads
3
Readme
native-media-picker
React-native media picker for IOS and Android. Instagram like designed.
Getting started
Run in react-native project folder:
$ npm i @paralect/native-media-picker
Import module in your javascript file
import NativeMediaPicker from '@paralect/native-media-picker';
Usage
Pick image for avatar
const config = {
imageSideCap : 512,
showRoundAim : true
}
NativeMediaPicker.showMediaPicker(config)
.then( result => {
console.log(result.items)
console.log(result.isCancelled)
} )
.catch( error => { Alert.alert(error.message) } );
Pick multiple images and save picker state.
const config = {
imageSideCap : 1024,
maxItems : 5,
saveState: true
}
NativeMediaPicker.showMediaPicker(config)
.then( result => { console.log(result) } )
.catch( error => { Alert.alert(error.message) } );
Show picker with saved state
NativeMediaPicker.showStoredMediaPicker()
.then( (result) => { console.log(result) } )
.catch( error => { Alert.alert(error.message) } );
Reset saved picker
NativeMediaPicker.resetPicker()
Configuration variables
| Variable | Description | Type | Default value |
| --------------|-------------| ----------| --------------|
| imageSideCap
| Maximum value of the side of the image. Oversized image will be resized proportionally | Integer | 1024 |
| maxItems
| Count of images to pick. Multiple pick enabled if 1+ | Integer | 1 |
| showRoundAim
| Add round preset | Boolean | false |
| saveState
| Save state of picker after dismissing | Boolean | false |
| showFilters
| Enable option to choose filters for image | Boolean | false |
Result dictionary
| key | Description | Type |
| --------------|-------------| ----------|
| items
| Base64 encoded images | Array |
| isCancelled
| Flag tell picking cancelled | Boolean |
Setup
Cropping rules
Maximim aspect ratio:
- for landscape images - 1.5
- for portrait images - 1.2
Release new version
To release new npm package you need to:
- Update package version in package.json
- Run following script
./bin/new-release.sh "v1.0.1" "Publish empty release"
(specify changes list and version) - Wait for Drone to publish npm package.