expo-image-picker 14.3.2 → 14.4.0

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.
package/CHANGELOG.md CHANGED
@@ -10,11 +10,15 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
- ## 14.3.2 — 2023-07-23
13
+ ## 14.4.0 — 2023-07-28
14
+
15
+ _This version does not introduce any user-facing changes._
16
+
17
+ ## 14.3.2 - 2023-07-23
14
18
 
15
19
  ### 💡 Others
16
20
 
17
- - On Android, restore behavior from [#22658](https://github.com/expo/expo/pull/22658). ([#23617](https://github.com/expo/expo/pull/23617) by [@alanhughes](https://github.com/alanjhughes))
21
+ - On Android, restore behavior from [#22658](https://github.com/expo/expo/pull/22658). ([#23617](https://github.com/expo/expo/pull/23617) by [@alanhughes](https://github.com/alanjhughes)) ([#22658](https://github.com/expo/expo/pull/22658), [#23617](https://github.com/expo/expo/pull/23617) by [@alanjhughes](https://github.com/alanjhughes))
18
22
 
19
23
  ## 14.3.1 - 2023-07-04
20
24
 
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
3
3
  apply plugin: 'maven-publish'
4
4
 
5
5
  group = 'host.exp.exponent'
6
- version = '14.3.2'
6
+ version = '14.4.0'
7
7
 
8
8
  buildscript {
9
9
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
@@ -67,7 +67,7 @@ android {
67
67
  minSdkVersion safeExtGet("minSdkVersion", 21)
68
68
  targetSdkVersion safeExtGet("targetSdkVersion", 33)
69
69
  versionCode 22
70
- versionName "14.3.2"
70
+ versionName "14.4.0"
71
71
  }
72
72
  lintOptions {
73
73
  abortOnError false
@@ -1,3 +1,3 @@
1
- declare const _default: import("expo-modules-core").ProxyNativeModule;
1
+ declare const _default: any;
2
2
  export default _default;
3
3
  //# sourceMappingURL=ExponentImagePicker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExponentImagePicker.d.ts","sourceRoot":"","sources":["../src/ExponentImagePicker.ts"],"names":[],"mappings":";AACA,wBAAsD"}
1
+ {"version":3,"file":"ExponentImagePicker.d.ts","sourceRoot":"","sources":["../src/ExponentImagePicker.ts"],"names":[],"mappings":";AACA,wBAA0D"}
@@ -1,3 +1,3 @@
1
- import { NativeModulesProxy } from 'expo-modules-core';
2
- export default NativeModulesProxy.ExponentImagePicker;
1
+ import { requireNativeModule } from 'expo-modules-core';
2
+ export default requireNativeModule('ExponentImagePicker');
3
3
  //# sourceMappingURL=ExponentImagePicker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExponentImagePicker.js","sourceRoot":"","sources":["../src/ExponentImagePicker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,eAAe,kBAAkB,CAAC,mBAAmB,CAAC","sourcesContent":["import { NativeModulesProxy } from 'expo-modules-core';\nexport default NativeModulesProxy.ExponentImagePicker;\n"]}
1
+ {"version":3,"file":"ExponentImagePicker.js","sourceRoot":"","sources":["../src/ExponentImagePicker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,eAAe,mBAAmB,CAAC,qBAAqB,CAAC,CAAC","sourcesContent":["import { requireNativeModule } from 'expo-modules-core';\nexport default requireNativeModule('ExponentImagePicker');\n"]}
@@ -102,6 +102,7 @@ public class ImagePickerModule: Module, OnMediaPickingResultHandler {
102
102
  let options = pickingContext.options
103
103
 
104
104
  let picker = UIImagePickerController()
105
+ picker.fixCannotMoveEditingBox()
105
106
 
106
107
  if sourceType == .camera {
107
108
  #if targetEnvironment(simulator)
@@ -0,0 +1,58 @@
1
+ // Copyright 2016-present 650 Industries. All rights reserved.
2
+
3
+ extension UIImagePickerController {
4
+ func fixCannotMoveEditingBox() {
5
+ if let cropView = cropView,
6
+ let scrollView = scrollView,
7
+ scrollView.contentOffset.y == 0
8
+ {
9
+ let top = cropView.frame.minY + self.view.safeAreaInsets.top
10
+ let bottom = scrollView.frame.height - cropView.frame.height - top
11
+ scrollView.contentInset = UIEdgeInsets(top: top, left: 0, bottom: bottom, right: 0)
12
+
13
+ var offset: CGFloat = 0
14
+ if scrollView.contentSize.height > scrollView.contentSize.width {
15
+ offset = 0.5 * (scrollView.contentSize.height - scrollView.contentSize.width)
16
+ }
17
+ scrollView.contentOffset = CGPoint(x: 0, y: -top + offset)
18
+ }
19
+
20
+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { [weak self] in
21
+ self?.fixCannotMoveEditingBox()
22
+ }
23
+ }
24
+
25
+ var cropView: UIView? {
26
+ return findCropView(from: self.view)
27
+ }
28
+
29
+ var scrollView: UIScrollView? {
30
+ return findScrollView(from: self.view)
31
+ }
32
+
33
+ func findCropView(from view: UIView) -> UIView? {
34
+ let width = UIScreen.main.bounds.width
35
+ let size = view.bounds.size
36
+ if width == size.height, width == size.height {
37
+ return view
38
+ }
39
+ for view in view.subviews {
40
+ if let cropView = findCropView(from: view) {
41
+ return cropView
42
+ }
43
+ }
44
+ return nil
45
+ }
46
+
47
+ func findScrollView(from view: UIView) -> UIScrollView? {
48
+ if let scrollView = view as? UIScrollView {
49
+ return scrollView
50
+ }
51
+ for view in view.subviews {
52
+ if let scrollView = findScrollView(from: view) {
53
+ return scrollView
54
+ }
55
+ }
56
+ return nil
57
+ }
58
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-image-picker",
3
- "version": "14.3.2",
3
+ "version": "14.4.0",
4
4
  "description": "Provides access to the system's UI for selecting images and videos from the phone's library or taking a photo with the camera.",
5
5
  "main": "build/ImagePicker.js",
6
6
  "types": "build/ImagePicker.d.ts",
@@ -44,5 +44,5 @@
44
44
  "peerDependencies": {
45
45
  "expo": "*"
46
46
  },
47
- "gitHead": "c0d646e9295094bca877513e500d3c9f2e990c42"
47
+ "gitHead": "663654577a7068c641b5e9474efbc502e3f334ea"
48
48
  }
@@ -1,2 +1,2 @@
1
- import { NativeModulesProxy } from 'expo-modules-core';
2
- export default NativeModulesProxy.ExponentImagePicker;
1
+ import { requireNativeModule } from 'expo-modules-core';
2
+ export default requireNativeModule('ExponentImagePicker');