This is a very slightly modified plugin. Original is here: https://github.com/nstudio/nativescript-rad-imagepicker
This version adds recordLocation
to the configurable options and fixes an issue with the originally chosen MVN repository for Glide when building the app.
NativeScript plugin for whatsapp style image picking. This Plugin uses PixImagePicker for Android and ImagePicker for iOS
npm install nativescript-rad-imagepicker-with-loc
you will need to reference the above package in place of @nstudio/nativescript-rad-imagepicker' below
const RadImagepicker = require('@nstudio/nativescript-rad-imagepicker').RadImagepicker;
const PickerOptions = require('@nstudio/nativescript-rad-imagepicker').PickerOptions;
const radImagepicker = new RadImagepicker();
radImagepicker.pick(opts).then((selectedImages) => {
if (selectedImages) {
// Do something with selected images
// currently
// the image will be of type nativescript image source
// tns-core-modules/image-source
}
});
Following picker options are available
PickerOptions {
doneButtonTitle?: string; // only affects ios
noImagesTitle?: string; // only affects ios
allowVideoSelection?: boolean; // only affects ios
recordLocation?: boolean; // only affects ios
imageLimit?: number;
}
Picker api
pick(options: PickerOptions): Promise<Array<any>>;
When the promise resolves, you will get array of imageSource
Add desired colors in app/App_Resources/Android/src/main/res/values/colors.xml
<color name="ns_blue">#272734</color>
<color name="colorPrimaryPix">#075e54</color>
<color name="colorPrimaryLightPix">#80075e54</color>
Make sure these lines are in your Manifest.xml
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-feature android:name="android.hardware.camera" />
Add these to info.plist, you can add more descriptive message here
<key>NSCameraUsageDescription</key>
<string>This app uses your camera</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This app uses your photo library</string>
Made With
Special Thanks to Richard Smith and Osei Fortune :)
Apache License Version 2.0, January 2004