@hotta/react-native-imagepicker 0.2.4 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
1
  package com.htreactnative.imagepicker
2
2
 
3
+ import android.content.pm.ActivityInfo
3
4
  import android.graphics.BitmapFactory
4
5
  import android.graphics.Color
5
6
  import com.facebook.react.bridge.Promise
@@ -38,8 +39,16 @@ class NativeImagePickerModule(reactContext: ReactApplicationContext) :
38
39
  promise: Promise?
39
40
  ) {
40
41
  pickerOptions = options;
42
+ val imageCount = options?.getInt("imageCount") ?: 1
43
+ val isCamera = options?.getBoolean("isCamera") ?: false
41
44
  PictureSelector.create(reactApplicationContext.currentActivity)
42
45
  .openGallery(SelectMimeType.ofImage())
46
+ .setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)
47
+ .setSelectionMode(
48
+ if (imageCount > 1) SelectModeConfig.MULTIPLE else SelectModeConfig.SINGLE
49
+ )
50
+ .setMaxSelectNum(imageCount)
51
+ .isDisplayCamera(isCamera)
43
52
  .setImageEngine(imageEngine)
44
53
  .forResult(object : OnResultCallbackListener<LocalMedia> {
45
54
  override fun onResult(localMediaList: ArrayList<LocalMedia?>?) {
@@ -66,6 +75,7 @@ class NativeImagePickerModule(reactContext: ReactApplicationContext) :
66
75
  val isCamera = options?.getBoolean("isCamera") ?: false
67
76
  PictureSelector.create(reactApplicationContext.currentActivity)
68
77
  .openGallery(SelectMimeType.ofVideo())
78
+ .setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)
69
79
  .setSelectionMode(SelectModeConfig.SINGLE)
70
80
  .setMaxSelectNum(1)
71
81
  .isDisplayCamera(isCamera)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hotta/react-native-imagepicker",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "@hotta/react-native-imagepicker",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",