react-native-photo-video-editor 0.3.4 → 0.3.5

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.
@@ -126,6 +126,19 @@ object PhotoExporter {
126
126
  ExifInterface.ORIENTATION_ROTATE_270 -> matrix.postRotate(270f)
127
127
  ExifInterface.ORIENTATION_FLIP_HORIZONTAL -> matrix.postScale(-1f, 1f)
128
128
  ExifInterface.ORIENTATION_FLIP_VERTICAL -> matrix.postScale(1f, -1f)
129
+ // Mirrored-and-rotated: what a front-facing camera writes for a portrait
130
+ // shot (CameraX marks the capture as reversed-horizontal, which combines
131
+ // with the 90/270 sensor rotation into TRANSPOSE/TRANSVERSE rather than
132
+ // a plain ROTATE_90/270). Falling through to `else` here left those
133
+ // photos unrotated in the editor.
134
+ ExifInterface.ORIENTATION_TRANSPOSE -> {
135
+ matrix.postRotate(90f)
136
+ matrix.postScale(-1f, 1f)
137
+ }
138
+ ExifInterface.ORIENTATION_TRANSVERSE -> {
139
+ matrix.postRotate(270f)
140
+ matrix.postScale(-1f, 1f)
141
+ }
129
142
  else -> return bitmap
130
143
  }
131
144
  return Bitmap.createBitmap(bitmap, 0, 0, bitmap.width, bitmap.height, matrix, true)
@@ -112,6 +112,19 @@ class PhotoEditSession(private val context: Context, sourceUri: String, maxPrevi
112
112
  ExifInterface.ORIENTATION_ROTATE_270 -> matrix.postRotate(270f)
113
113
  ExifInterface.ORIENTATION_FLIP_HORIZONTAL -> matrix.postScale(-1f, 1f)
114
114
  ExifInterface.ORIENTATION_FLIP_VERTICAL -> matrix.postScale(1f, -1f)
115
+ // Mirrored-and-rotated: what a front-facing camera writes for a portrait
116
+ // shot (CameraX marks the capture as reversed-horizontal, which combines
117
+ // with the 90/270 sensor rotation into TRANSPOSE/TRANSVERSE rather than
118
+ // a plain ROTATE_90/270). Falling through to `else` here left those
119
+ // photos unrotated in the editor.
120
+ ExifInterface.ORIENTATION_TRANSPOSE -> {
121
+ matrix.postRotate(90f)
122
+ matrix.postScale(-1f, 1f)
123
+ }
124
+ ExifInterface.ORIENTATION_TRANSVERSE -> {
125
+ matrix.postRotate(270f)
126
+ matrix.postScale(-1f, 1f)
127
+ }
115
128
  else -> return decoded
116
129
  }
117
130
  return Bitmap.createBitmap(decoded, 0, 0, decoded.width, decoded.height, matrix, true)
@@ -52,6 +52,8 @@ final class OnlineStickerSheetViewController: UIViewController {
52
52
  view.backgroundColor = DesignTokens.elevatedPanel
53
53
  buildUI()
54
54
  loadLocalStickers()
55
+ rebuildCategoryChips()
56
+ applyFilter()
55
57
  }
56
58
 
57
59
  override func viewDidDisappear(_ animated: Bool) {
@@ -187,9 +189,6 @@ final class OnlineStickerSheetViewController: UIViewController {
187
189
  ?? hostBundle.url(forResource: "PhotoVideoEditorStickers", withExtension: "bundle")
188
190
  guard let bundleURL, let bundle = Bundle(url: bundleURL) else { return }
189
191
  localStickerNames = (bundle.urls(forResourcesWithExtension: "png", subdirectory: nil) ?? []).map(\.lastPathComponent).sorted()
190
- displayedLocalStickerNames = localStickerNames
191
- rebuildCategoryChips()
192
- applyFilter()
193
192
  }
194
193
 
195
194
  private func localStickerURL(named name: String) -> URL? {
@@ -294,12 +293,14 @@ extension OnlineStickerSheetViewController: UICollectionViewDataSource, UICollec
294
293
  let cell = collectionView.dequeueReusableCell(withReuseIdentifier: Self.cellReuseID, for: indexPath) as! BundledStickerCell
295
294
  if indexPath.item < displayedRuntimeStickers.count {
296
295
  let sticker = displayedRuntimeStickers[indexPath.item]
296
+ cell.representedStickerURI = sticker.uri
297
297
  cell.configure(image: nil)
298
- loadRuntimeSticker(sticker) { [weak collectionView] _, image in
299
- guard collectionView?.indexPath(for: cell) == indexPath else { return }
298
+ loadRuntimeSticker(sticker) { [weak cell] _, image in
299
+ guard let cell, cell.representedStickerURI == sticker.uri else { return }
300
300
  cell.configure(image: image)
301
301
  }
302
302
  } else {
303
+ cell.representedStickerURI = nil
303
304
  let name = displayedLocalStickerNames[indexPath.item - displayedRuntimeStickers.count]
304
305
  let image = localStickerURL(named: name).flatMap { UIImage(contentsOfFile: $0.path) }
305
306
  cell.configure(image: image)
@@ -330,6 +331,7 @@ extension OnlineStickerSheetViewController: UICollectionViewDataSource, UICollec
330
331
 
331
332
  /// One grid cell for a bundled sticker image.
332
333
  private final class BundledStickerCell: UICollectionViewCell {
334
+ var representedStickerURI: String?
333
335
  private let imageView = UIImageView()
334
336
 
335
337
  override init(frame: CGRect) {
@@ -356,6 +358,7 @@ private final class BundledStickerCell: UICollectionViewCell {
356
358
 
357
359
  override func prepareForReuse() {
358
360
  super.prepareForReuse()
361
+ representedStickerURI = nil
359
362
  imageView.image = nil
360
363
  }
361
364
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-photo-video-editor",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "description": "Native photo and video editor for React Native, powered by Kotlin and Swift.",
5
5
  "main": "./lib/module/index.js",
6
6
  "module": "./lib/module/index.js",