expo-camera 16.0.8 → 16.0.9

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,6 +10,12 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 16.0.9 — 2024-12-05
14
+
15
+ ### 🐛 Bug fixes
16
+
17
+ - Fix `zoom` on Android and adjust the magnitude on iOS. ([#33319](https://github.com/expo/expo/pull/33319) by [@alanjhughes](https://github.com/alanjhughes))
18
+
13
19
  ## 16.0.8 — 2024-11-29
14
20
 
15
21
  _This version does not introduce any user-facing changes._
@@ -1,7 +1,7 @@
1
1
  apply plugin: 'com.android.library'
2
2
 
3
3
  group = 'host.exp.exponent'
4
- version = '16.0.8'
4
+ version = '16.0.9'
5
5
 
6
6
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
7
7
  apply from: expoModulesCorePlugin
@@ -14,7 +14,7 @@ android {
14
14
  namespace "expo.modules.camera"
15
15
  defaultConfig {
16
16
  versionCode 32
17
- versionName "16.0.8"
17
+ versionName "16.0.9"
18
18
  }
19
19
  }
20
20
 
@@ -136,9 +136,7 @@ class CameraViewModule : Module() {
136
136
  }
137
137
 
138
138
  Prop("zoom") { view, zoom: Float? ->
139
- zoom?.let {
140
- view.camera?.cameraControl?.setLinearZoom(it)
141
- }
139
+ view.zoom = zoom ?: 0f
142
140
  }
143
141
 
144
142
  Prop("mode") { view, mode: CameraMode? ->
@@ -159,7 +157,13 @@ class CameraViewModule : Module() {
159
157
 
160
158
  Prop("videoQuality") { view, quality: VideoQuality? ->
161
159
  quality?.let {
162
- view.videoQuality = it
160
+ if (view.videoQuality != quality) {
161
+ view.videoQuality = it
162
+ }
163
+ return@Prop
164
+ }
165
+ if (view.videoQuality != VideoQuality.VIDEO1080P) {
166
+ view.videoQuality = VideoQuality.VIDEO1080P
163
167
  }
164
168
  }
165
169
 
@@ -180,11 +184,12 @@ class CameraViewModule : Module() {
180
184
  pictureSize?.let {
181
185
  if (view.pictureSize != pictureSize) {
182
186
  view.pictureSize = it
183
- return@Prop
184
187
  }
188
+ return@Prop
189
+ }
190
+ if (view.pictureSize.isNotEmpty()) {
191
+ view.pictureSize = ""
185
192
  }
186
-
187
- view.pictureSize = ""
188
193
  }
189
194
 
190
195
  Prop("autoFocus") { view, autoFocus: FocusMode? ->
@@ -199,10 +204,14 @@ class CameraViewModule : Module() {
199
204
 
200
205
  Prop("mirror") { view, mirror: Boolean? ->
201
206
  mirror?.let {
202
- view.mirror = it
203
- return@Prop
207
+ if (view.mirror != mirror) {
208
+ view.mirror = it
209
+ return@Prop
210
+ }
211
+ }
212
+ if (view.mirror != false) {
213
+ view.mirror = false
204
214
  }
205
- view.mirror = false
206
215
  }
207
216
 
208
217
  Prop("videoBitrate") { view, bitrate: Int? ->
@@ -146,6 +146,12 @@ class ExpoCameraView(
146
146
  shouldCreateCamera = true
147
147
  }
148
148
 
149
+ var zoom: Float = 0f
150
+ set(value) {
151
+ field = value
152
+ camera?.cameraControl?.setLinearZoom(value.coerceIn(0f, 1f))
153
+ }
154
+
149
155
  var autoFocus: FocusMode = FocusMode.OFF
150
156
  set(value) {
151
157
  field = value
@@ -415,6 +421,8 @@ class ExpoCameraView(
415
421
  camera?.let {
416
422
  observeCameraState(it.cameraInfo)
417
423
  }
424
+ // Set the previous zoom level after recreating the camera
425
+ camera?.cameraControl?.setLinearZoom(zoom.coerceIn(0f, 1f))
418
426
  this.cameraProvider = cameraProvider
419
427
  } catch (e: Exception) {
420
428
  onMountError(
@@ -286,7 +286,8 @@ public class CameraView: ExpoView, EXAppLifecycleListener,
286
286
 
287
287
  do {
288
288
  try device.lockForConfiguration()
289
- device.videoZoomFactor = (device.activeFormat.videoMaxZoomFactor - 1.0) * zoom + 1.0
289
+ let minZoom = 1.0
290
+ device.videoZoomFactor = minZoom * pow(device.activeFormat.videoMaxZoomFactor / minZoom, zoom)
290
291
  } catch {
291
292
  log.info("\(#function): \(error.localizedDescription)")
292
293
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-camera",
3
- "version": "16.0.8",
3
+ "version": "16.0.9",
4
4
  "description": "A React component that renders a preview for the device's either front or back camera. Camera's parameters like zoom, auto focus, white balance and flash mode are adjustable. With expo-camera, one can also take photos and record videos that are saved to the app's cache. Morever, the component is also capable of detecting faces and bar codes appearing on the preview.",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -50,5 +50,5 @@
50
50
  "optional": true
51
51
  }
52
52
  },
53
- "gitHead": "728158f99d680cf64fb06f08301d3806c18c6f63"
53
+ "gitHead": "a1fac063b47a647f2a9737e201d502066c52d4b0"
54
54
  }