1.0.22 • Published 7 years ago

@paralect/native-media-picker v1.0.22

Weekly downloads
17
License
ISC
Repository
github
Last release
7 years ago

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

VariableDescriptionTypeDefault value
imageSideCapMaximum value of the side of the image. Oversized image will be resized proportionallyInteger1024
maxItemsCount of images to pick. Multiple pick enabled if 1+Integer1
bashowRoundAimAdd round presetBooleanfalse
saveStateSave state of picker after dismissingBooleanfalse
bashowFiltersEnable option to choose filters for imageBooleanfalse

Result dictionary

keyDescriptionType
itemsBase64 encoded imagesArray
isCancelledFlag tell picking cancelledBoolean

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:

  1. Update package version in package.json
  2. Run following script ./bin/new-release.sh "v1.0.1" "Publish empty release" (specify changes list and version)
  3. Wait for Drone to publish npm package.
1.0.22

7 years ago

1.0.21

7 years ago

1.0.20

7 years ago

1.0.19

7 years ago

1.0.17

7 years ago

1.0.15

7 years ago

1.0.14

7 years ago

1.0.13

7 years ago

1.0.12

7 years ago

1.0.11

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.4

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago