one 2.6.11 → 2.6.12

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.
@@ -25,6 +25,7 @@ import com.facebook.react.modules.core.PermissionAwareActivity
25
25
  import com.facebook.react.modules.core.PermissionListener
26
26
  import com.margelo.nitro.NitroModules
27
27
  import com.margelo.nitro.core.Promise
28
+ import dev.onejs.onenative.OneImageOrientation
28
29
  import dev.onejs.onenative.OneNativeCropActivity
29
30
  import java.io.File
30
31
  import java.io.FileOutputStream
@@ -700,8 +701,10 @@ class HybridOneImagePicker : HybridOneImagePickerSpec(), ActivityEventListener,
700
701
  private fun applyQuality(file: File): File {
701
702
  if (pendingQuality >= 100) return file
702
703
  val options = BitmapFactory.Options().apply { inJustDecodeBounds = false }
703
- val bitmap =
704
+ val decoded =
704
705
  file.inputStream().use { BitmapFactory.decodeStream(it, null, options) } ?: return file
706
+ // the new jpeg carries no exif, so the orientation moves into the pixels.
707
+ val bitmap = OneImageOrientation.upright(decoded, OneImageOrientation.read(file))
705
708
  val dest = cacheFile("IMG", "jpg")
706
709
  try {
707
710
  FileOutputStream(dest).use { output ->
@@ -712,7 +715,8 @@ class HybridOneImagePicker : HybridOneImagePickerSpec(), ActivityEventListener,
712
715
  } catch (e: Exception) {
713
716
  return file
714
717
  } finally {
715
- bitmap.recycle()
718
+ if (bitmap !== decoded) bitmap.recycle()
719
+ decoded.recycle()
716
720
  }
717
721
  file.delete()
718
722
  return dest
@@ -739,7 +743,13 @@ class HybridOneImagePicker : HybridOneImagePickerSpec(), ActivityEventListener,
739
743
  val options = BitmapFactory.Options().apply { inJustDecodeBounds = true }
740
744
  file.inputStream().use { BitmapFactory.decodeStream(it, null, options) }
741
745
  if (options.outWidth <= 0 || options.outHeight <= 0) return Pair(0, 0)
742
- return Pair(options.outWidth, options.outHeight)
746
+ // exif orientations 5 to 8 store the pixels transposed to the display
747
+ // axes, so the reported size swaps to match what renders, as on ios.
748
+ return if (OneImageOrientation.isTransposed(OneImageOrientation.read(file))) {
749
+ Pair(options.outHeight, options.outWidth)
750
+ } else {
751
+ Pair(options.outWidth, options.outHeight)
752
+ }
743
753
  }
744
754
 
745
755
  private fun videoSize(file: File): Pair<Int, Int> {
@@ -0,0 +1,73 @@
1
+ package dev.onejs.onenative
2
+
3
+ import android.graphics.Bitmap
4
+ import android.graphics.Matrix
5
+ import android.graphics.Rect
6
+ import android.media.ExifInterface
7
+ import java.io.File
8
+
9
+ // exif orientation for picked and cropped images. decoders ignore the tag
10
+ // and the jpegs One writes carry no exif, so pixels written back out are
11
+ // turned upright first.
12
+ object OneImageOrientation {
13
+ // normal when the file has no orientation tag or is not an exif format.
14
+ fun read(file: File): Int =
15
+ try {
16
+ ExifInterface(file.absolutePath)
17
+ .getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL)
18
+ } catch (e: Exception) {
19
+ ExifInterface.ORIENTATION_NORMAL
20
+ }
21
+
22
+ // orientations 5 to 8 store the pixels transposed to the display axes.
23
+ fun isTransposed(orientation: Int): Boolean =
24
+ orientation == ExifInterface.ORIENTATION_TRANSPOSE ||
25
+ orientation == ExifInterface.ORIENTATION_ROTATE_90 ||
26
+ orientation == ExifInterface.ORIENTATION_TRANSVERSE ||
27
+ orientation == ExifInterface.ORIENTATION_ROTATE_270
28
+
29
+ // the bitmap as it displays. returns the same bitmap when it is upright.
30
+ fun upright(bitmap: Bitmap, orientation: Int): Bitmap {
31
+ val matrix = Matrix()
32
+ when (orientation) {
33
+ ExifInterface.ORIENTATION_FLIP_HORIZONTAL -> matrix.setScale(-1f, 1f)
34
+ ExifInterface.ORIENTATION_ROTATE_180 -> matrix.setRotate(180f)
35
+ ExifInterface.ORIENTATION_FLIP_VERTICAL -> {
36
+ matrix.setRotate(180f)
37
+ matrix.postScale(-1f, 1f)
38
+ }
39
+ ExifInterface.ORIENTATION_TRANSPOSE -> {
40
+ matrix.setRotate(90f)
41
+ matrix.postScale(-1f, 1f)
42
+ }
43
+ ExifInterface.ORIENTATION_ROTATE_90 -> matrix.setRotate(90f)
44
+ ExifInterface.ORIENTATION_TRANSVERSE -> {
45
+ matrix.setRotate(-90f)
46
+ matrix.postScale(-1f, 1f)
47
+ }
48
+ ExifInterface.ORIENTATION_ROTATE_270 -> matrix.setRotate(-90f)
49
+ else -> return bitmap
50
+ }
51
+ return Bitmap.createBitmap(bitmap, 0, 0, bitmap.width, bitmap.height, matrix, true)
52
+ }
53
+
54
+ // maps a rect in upright pixels to the stored pixels of a width by height
55
+ // image, so a region decode of the result turned upright is that rect.
56
+ fun storedRect(rect: Rect, orientation: Int, width: Int, height: Int): Rect {
57
+ val a = storedPoint(rect.left, rect.top, orientation, width, height)
58
+ val b = storedPoint(rect.right, rect.bottom, orientation, width, height)
59
+ return Rect(minOf(a[0], b[0]), minOf(a[1], b[1]), maxOf(a[0], b[0]), maxOf(a[1], b[1]))
60
+ }
61
+
62
+ internal fun storedPoint(x: Int, y: Int, orientation: Int, width: Int, height: Int): IntArray =
63
+ when (orientation) {
64
+ ExifInterface.ORIENTATION_FLIP_HORIZONTAL -> intArrayOf(width - x, y)
65
+ ExifInterface.ORIENTATION_ROTATE_180 -> intArrayOf(width - x, height - y)
66
+ ExifInterface.ORIENTATION_FLIP_VERTICAL -> intArrayOf(x, height - y)
67
+ ExifInterface.ORIENTATION_TRANSPOSE -> intArrayOf(y, x)
68
+ ExifInterface.ORIENTATION_ROTATE_90 -> intArrayOf(y, height - x)
69
+ ExifInterface.ORIENTATION_TRANSVERSE -> intArrayOf(width - y, height - x)
70
+ ExifInterface.ORIENTATION_ROTATE_270 -> intArrayOf(width - y, x)
71
+ else -> intArrayOf(x, y)
72
+ }
73
+ }
@@ -26,7 +26,7 @@ class OneLocationService : Service() {
26
26
  }
27
27
  val notification: Notification = NotificationCompat.Builder(this, CHANNEL_ID)
28
28
  .setContentTitle("Location updates active")
29
- .setContentText("One is receiving location updates in the background.")
29
+ .setContentText("${applicationInfo.loadLabel(packageManager)} is receiving location updates in the background.")
30
30
  .setSmallIcon(android.R.drawable.ic_menu_mylocation)
31
31
  .setOngoing(true)
32
32
  .build()
@@ -100,6 +100,9 @@ class OneNativeCameraView(private val reactContext: ThemedReactContext) :
100
100
 
101
101
  override fun onDetachedFromWindow() {
102
102
  generation += 1
103
+ // reattaching starts a new scanning run, which delivers a code seen in
104
+ // the previous one again.
105
+ lastCode = null
103
106
  releaseSession()
104
107
  super.onDetachedFromWindow()
105
108
  }
@@ -138,6 +141,8 @@ class OneNativeCameraView(private val reactContext: ThemedReactContext) :
138
141
  if (!active || windowToken == null) {
139
142
  generation += 1
140
143
  releaseSession()
144
+ // a new scanning run delivers a code seen in the previous one again.
145
+ lastCode = null
141
146
  // stay silent until the first determined state so a mount with
142
147
  // active=false keeps the JS 'waiting' state like the iOS view.
143
148
  if (lastState.isNotEmpty()) emitState("inactive")
@@ -11,6 +11,7 @@ import android.graphics.Matrix
11
11
  import android.graphics.Paint
12
12
  import android.graphics.Rect
13
13
  import android.graphics.RectF
14
+ import android.media.ExifInterface
14
15
  import android.os.Bundle
15
16
  import android.view.Gravity
16
17
  import android.view.MotionEvent
@@ -30,6 +31,9 @@ import kotlin.math.min
30
31
  // handle: move plus resize is the subset this editor covers.
31
32
  class OneNativeCropActivity : Activity() {
32
33
  private var cropView: CropView? = null
34
+ private var exifOrientation = ExifInterface.ORIENTATION_NORMAL
35
+ private var storedWidth = 0
36
+ private var storedHeight = 0
33
37
 
34
38
  override fun onCreate(savedInstanceState: Bundle?) {
35
39
  super.onCreate(savedInstanceState)
@@ -97,16 +101,23 @@ class OneNativeCropActivity : Activity() {
97
101
  super.onBackPressed()
98
102
  }
99
103
 
104
+ // the editor shows the image upright, so the frame it reports is in
105
+ // upright pixels; cropFull maps it back to the stored pixels.
100
106
  private fun decodeDisplay(file: File): Pair<Bitmap, Int>? {
101
107
  return try {
102
108
  val bounds = BitmapFactory.Options().apply { inJustDecodeBounds = true }
103
109
  BitmapFactory.decodeFile(file.absolutePath, bounds)
110
+ exifOrientation = OneImageOrientation.read(file)
111
+ storedWidth = bounds.outWidth
112
+ storedHeight = bounds.outHeight
104
113
  var sample = 1
105
114
  while (bounds.outWidth / sample > 2048 || bounds.outHeight / sample > 2048) {
106
115
  sample *= 2
107
116
  }
108
117
  val options = BitmapFactory.Options().apply { inSampleSize = sample }
109
- val bitmap = BitmapFactory.decodeFile(file.absolutePath, options) ?: return null
118
+ val decoded = BitmapFactory.decodeFile(file.absolutePath, options) ?: return null
119
+ val bitmap = OneImageOrientation.upright(decoded, exifOrientation)
120
+ if (bitmap !== decoded) decoded.recycle()
110
121
  Pair(bitmap, sample)
111
122
  } catch (e: Exception) {
112
123
  null
@@ -118,7 +129,10 @@ class OneNativeCropActivity : Activity() {
118
129
  // the region decoder cannot open the file.
119
130
  private fun cropFull(file: File, rect: Rect, quality: Int): File? {
120
131
  return try {
121
- val bitmap = decodeRegion(file, rect) ?: return null
132
+ val stored = OneImageOrientation.storedRect(rect, exifOrientation, storedWidth, storedHeight)
133
+ val region = decodeRegion(file, stored) ?: return null
134
+ val bitmap = OneImageOrientation.upright(region, exifOrientation)
135
+ if (bitmap !== region) region.recycle()
122
136
  try {
123
137
  val dir = File(cacheDir, "one-native-image-picker")
124
138
  dir.mkdirs()
@@ -28,8 +28,10 @@ __export(index_native_exports, {
28
28
  module.exports = __toCommonJS(index_native_exports);
29
29
  var import_jsx_runtime = require("react/jsx-runtime");
30
30
  var import_react_native = require("react-native");
31
- var ToolbarHostNative = (0, import_react_native.requireNativeComponent)("OneToolbarHost");
31
+ var isAvailable = import_react_native.Platform.OS === "ios" && !import_react_native.Platform.isTV;
32
+ var ToolbarHostNative = isAvailable ? (0, import_react_native.requireNativeComponent)("OneToolbarHost") : null;
32
33
  function ToolbarHost(props) {
34
+ if (!ToolbarHostNative) return null;
33
35
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolbarHostNative, {
34
36
  ...props,
35
37
  style: {
@@ -42,8 +44,9 @@ function ToolbarHost(props) {
42
44
  }
43
45
  });
44
46
  }
45
- var ToolbarItemNative = (0, import_react_native.requireNativeComponent)("OneToolbarItem");
47
+ var ToolbarItemNative = isAvailable ? (0, import_react_native.requireNativeComponent)("OneToolbarItem") : null;
46
48
  function ToolbarItem(props) {
49
+ if (!ToolbarItemNative) return null;
47
50
  var { image, onSelected, ...rest } = props;
48
51
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolbarItemNative, {
49
52
  ...rest,
@@ -28,8 +28,10 @@ __export(index_native_exports, {
28
28
  module.exports = __toCommonJS(index_native_exports);
29
29
  var import_jsx_runtime = require("react/jsx-runtime");
30
30
  var import_react_native = require("react-native");
31
- var ToolbarHostNative = (0, import_react_native.requireNativeComponent)("OneToolbarHost");
31
+ var isAvailable = import_react_native.Platform.OS === "ios" && !import_react_native.Platform.isTV;
32
+ var ToolbarHostNative = isAvailable ? (0, import_react_native.requireNativeComponent)("OneToolbarHost") : null;
32
33
  function ToolbarHost(props) {
34
+ if (!ToolbarHostNative) return null;
33
35
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolbarHostNative, {
34
36
  ...props,
35
37
  style: {
@@ -42,8 +44,9 @@ function ToolbarHost(props) {
42
44
  }
43
45
  });
44
46
  }
45
- var ToolbarItemNative = (0, import_react_native.requireNativeComponent)("OneToolbarItem");
47
+ var ToolbarItemNative = isAvailable ? (0, import_react_native.requireNativeComponent)("OneToolbarItem") : null;
46
48
  function ToolbarItem(props) {
49
+ if (!ToolbarItemNative) return null;
47
50
  var { image, onSelected, ...rest } = props;
48
51
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolbarItemNative, {
49
52
  ...rest,
@@ -1 +1 @@
1
- {"version":3,"file":"index.native.js","names":[],"sources":["cjs/platform/toolbar/index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar index_native_exports = {};\n__export(index_native_exports, {\n ToolbarHost: () => ToolbarHost,\n ToolbarItem: () => ToolbarItem\n});\nmodule.exports = __toCommonJS(index_native_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_react_native = require(\"react-native\");\nvar ToolbarHostNative = (0, import_react_native.requireNativeComponent)(\"OneToolbarHost\");\nfunction ToolbarHost(props) {\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolbarHostNative, {\n ...props,\n style: {\n position: \"absolute\",\n top: 0,\n left: 0,\n width: 1,\n height: 1,\n backgroundColor: \"transparent\"\n }\n });\n}\nvar ToolbarItemNative = (0, import_react_native.requireNativeComponent)(\"OneToolbarItem\");\nfunction ToolbarItem(props) {\n var { image, onSelected, ...rest } = props;\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolbarItemNative, {\n ...rest,\n imageSource: image,\n onSelected: onSelected ? function() {\n return onSelected();\n } : void 0\n });\n}\n//# sourceMappingURL=index.native.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,uBAAuB,CAAC;AAC5B,SAAS,sBAAsB;CAC7B,mBAAmB;CACnB,mBAAmB;AACrB,CAAC;AACD,OAAO,UAAU,aAAa,oBAAoB;AAClD,IAAI,qBAAqB,QAAQ,mBAAmB;AACpD,IAAI,sBAAsB,QAAQ,cAAc;AAChD,IAAI,qBAAqB,GAAG,oBAAoB,uBAAsB,CAAE,gBAAgB;AACxF,SAAS,YAAY,OAAO;CAC1B,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,mBAAmB;EACpE,GAAG;EACH,OAAO;GACL,UAAU;GACV,KAAK;GACL,MAAM;GACN,OAAO;GACP,QAAQ;GACR,iBAAiB;EACnB;CACF,CAAC;AACH;AACA,IAAI,qBAAqB,GAAG,oBAAoB,uBAAsB,CAAE,gBAAgB;AACxF,SAAS,YAAY,OAAO;CAC1B,IAAI,EAAE,OAAO,YAAY,GAAG,SAAS;CACrC,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,mBAAmB;EACpE,GAAG;EACH,aAAa;EACb,YAAY,aAAa,WAAW;GAClC,OAAO,WAAW;EACpB,IAAI,KAAK;CACX,CAAC;AACH"}
1
+ {"version":3,"file":"index.native.js","names":[],"sources":["cjs/platform/toolbar/index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar index_native_exports = {};\n__export(index_native_exports, {\n ToolbarHost: () => ToolbarHost,\n ToolbarItem: () => ToolbarItem\n});\nmodule.exports = __toCommonJS(index_native_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_react_native = require(\"react-native\");\nvar isAvailable = import_react_native.Platform.OS === \"ios\" && !import_react_native.Platform.isTV;\nvar ToolbarHostNative = isAvailable ? (0, import_react_native.requireNativeComponent)(\"OneToolbarHost\") : null;\nfunction ToolbarHost(props) {\n if (!ToolbarHostNative) return null;\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolbarHostNative, {\n ...props,\n style: {\n position: \"absolute\",\n top: 0,\n left: 0,\n width: 1,\n height: 1,\n backgroundColor: \"transparent\"\n }\n });\n}\nvar ToolbarItemNative = isAvailable ? (0, import_react_native.requireNativeComponent)(\"OneToolbarItem\") : null;\nfunction ToolbarItem(props) {\n if (!ToolbarItemNative) return null;\n var { image, onSelected, ...rest } = props;\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolbarItemNative, {\n ...rest,\n imageSource: image,\n onSelected: onSelected ? function() {\n return onSelected();\n } : void 0\n });\n}\n//# sourceMappingURL=index.native.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;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C1B,IAAI,CAAC,mBAAmB,OAAO;CAC/B,IAAI,EAAE,OAAO,YAAY,GAAG,SAAS;CACrC,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,mBAAmB;EACpE,GAAG;EACH,aAAa;EACb,YAAY,aAAa,WAAW;GAClC,OAAO,WAAW;EACpB,IAAI,KAAK;CACX,CAAC;AACH"}
@@ -28,7 +28,7 @@ var import_react = require("react");
28
28
  var import_NativeNitroImage = require("react-native-nitro-image/src/NativeNitroImage");
29
29
  var import_loadImage = require("react-native-nitro-image/src/loadImage");
30
30
  function Image(param) {
31
- var { source, onLoadStart, onLoad, onError, onLoadEnd, ...props } = param;
31
+ var { source, resizeMode = "cover", onLoadStart, onLoad, onError, onLoadEnd, ...props } = param;
32
32
  var uri = typeof source === "number" ? source : typeof source === "string" ? source : source.uri;
33
33
  var [loaded, setLoaded] = (0, import_react.useState)();
34
34
  (0, import_react.useEffect)(function() {
@@ -57,6 +57,7 @@ function Image(param) {
57
57
  }, [uri]);
58
58
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_NativeNitroImage.NativeNitroImage, {
59
59
  image: (loaded === null || loaded === void 0 ? void 0 : loaded.uri) === uri ? loaded.image : void 0,
60
+ resizeMode,
60
61
  ...props
61
62
  }, String(uri));
62
63
  }
@@ -28,7 +28,7 @@ var import_react = require("react");
28
28
  var import_NativeNitroImage = require("react-native-nitro-image/src/NativeNitroImage");
29
29
  var import_loadImage = require("react-native-nitro-image/src/loadImage");
30
30
  function Image(param) {
31
- var { source, onLoadStart, onLoad, onError, onLoadEnd, ...props } = param;
31
+ var { source, resizeMode = "cover", onLoadStart, onLoad, onError, onLoadEnd, ...props } = param;
32
32
  var uri = typeof source === "number" ? source : typeof source === "string" ? source : source.uri;
33
33
  var [loaded, setLoaded] = (0, import_react.useState)();
34
34
  (0, import_react.useEffect)(function() {
@@ -57,6 +57,7 @@ function Image(param) {
57
57
  }, [uri]);
58
58
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_NativeNitroImage.NativeNitroImage, {
59
59
  image: (loaded === null || loaded === void 0 ? void 0 : loaded.uri) === uri ? loaded.image : void 0,
60
+ resizeMode,
60
61
  ...props
61
62
  }, String(uri));
62
63
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Image.native.js","names":[],"sources":["cjs/platform/ui/Image.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar Image_native_exports = {};\n__export(Image_native_exports, {\n Image: () => Image\n});\nmodule.exports = __toCommonJS(Image_native_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_react = require(\"react\");\nvar import_NativeNitroImage = require(\"react-native-nitro-image/src/NativeNitroImage\");\nvar import_loadImage = require(\"react-native-nitro-image/src/loadImage\");\nfunction Image(param) {\n var { source, onLoadStart, onLoad, onError, onLoadEnd, ...props } = param;\n var uri = typeof source === \"number\" ? source : typeof source === \"string\" ? source : source.uri;\n var [loaded, setLoaded] = (0, import_react.useState)();\n (0, import_react.useEffect)(function() {\n var cancelled = false;\n onLoadStart === null || onLoadStart === void 0 ? void 0 : onLoadStart();\n Promise.resolve((0, import_loadImage.loadImage)(typeof uri === \"number\" ? uri : {\n url: uri\n })).then(function(image) {\n if (cancelled) return;\n setLoaded({\n uri,\n image\n });\n onLoad === null || onLoad === void 0 ? void 0 : onLoad({\n nativeEvent: {\n source: {\n uri: String(uri),\n width: image.width,\n height: image.height\n }\n }\n });\n onLoadEnd === null || onLoadEnd === void 0 ? void 0 : onLoadEnd();\n }, function(error) {\n if (cancelled) return;\n onError === null || onError === void 0 ? void 0 : onError({\n nativeEvent: {\n error: error instanceof Error ? error.message : String(error)\n }\n });\n onLoadEnd === null || onLoadEnd === void 0 ? void 0 : onLoadEnd();\n });\n return function() {\n cancelled = true;\n };\n }, [\n uri\n ]);\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_NativeNitroImage.NativeNitroImage, {\n image: (loaded === null || loaded === void 0 ? void 0 : loaded.uri) === uri ? loaded.image : void 0,\n ...props\n }, String(uri));\n}\n//# sourceMappingURL=Image.native.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,uBAAuB,CAAC;AAC5B,SAAS,sBAAsB,EAC7B,aAAa,MACf,CAAC;AACD,OAAO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G,CAAE,wBAAwB,kBAAkB;EAC3F,QAAQ,WAAW,QAAQ,WAAW,KAAK,IAAI,KAAK,IAAI,OAAO,SAAS,MAAM,OAAO,QAAQ,KAAK;EAClG,GAAG;CACL,GAAG,OAAO,GAAG,CAAC;AAChB"}
1
+ {"version":3,"file":"Image.native.js","names":[],"sources":["cjs/platform/ui/Image.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar Image_native_exports = {};\n__export(Image_native_exports, {\n Image: () => Image\n});\nmodule.exports = __toCommonJS(Image_native_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_react = require(\"react\");\nvar import_NativeNitroImage = require(\"react-native-nitro-image/src/NativeNitroImage\");\nvar import_loadImage = require(\"react-native-nitro-image/src/loadImage\");\nfunction Image(param) {\n var { source, resizeMode = \"cover\", onLoadStart, onLoad, onError, onLoadEnd, ...props } = param;\n var uri = typeof source === \"number\" ? source : typeof source === \"string\" ? source : source.uri;\n var [loaded, setLoaded] = (0, import_react.useState)();\n (0, import_react.useEffect)(function() {\n var cancelled = false;\n onLoadStart === null || onLoadStart === void 0 ? void 0 : onLoadStart();\n Promise.resolve((0, import_loadImage.loadImage)(typeof uri === \"number\" ? uri : {\n url: uri\n })).then(function(image) {\n if (cancelled) return;\n setLoaded({\n uri,\n image\n });\n onLoad === null || onLoad === void 0 ? void 0 : onLoad({\n nativeEvent: {\n source: {\n uri: String(uri),\n width: image.width,\n height: image.height\n }\n }\n });\n onLoadEnd === null || onLoadEnd === void 0 ? void 0 : onLoadEnd();\n }, function(error) {\n if (cancelled) return;\n onError === null || onError === void 0 ? void 0 : onError({\n nativeEvent: {\n error: error instanceof Error ? error.message : String(error)\n }\n });\n onLoadEnd === null || onLoadEnd === void 0 ? void 0 : onLoadEnd();\n });\n return function() {\n cancelled = true;\n };\n }, [\n uri\n ]);\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_NativeNitroImage.NativeNitroImage, {\n image: (loaded === null || loaded === void 0 ? void 0 : loaded.uri) === uri ? loaded.image : void 0,\n // nitro's android view keeps ImageView's fit-center scale until resizeMode is\n // sent, so send the documented default on every platform.\n resizeMode,\n ...props\n }, String(uri));\n}\n//# sourceMappingURL=Image.native.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GA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,CAAC;EACD,OAAO,WAAW;GAChB,YAAY;EACd;CACF,GAAG,CACD,GACF,CAAC;CACD,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,wBAAwB,kBAAkB;EAC3F,QAAQ,WAAW,QAAQ,WAAW,KAAK,IAAI,KAAK,IAAI,OAAO,SAAS,MAAM,OAAO,QAAQ,KAAK;EAGlG;EACA,GAAG;CACL,GAAG,OAAO,GAAG,CAAC;AAChB"}
@@ -1,8 +1,10 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { requireNativeComponent } from "react-native";
2
+ import { Platform, requireNativeComponent } from "react-native";
3
3
 
4
- var ToolbarHostNative = requireNativeComponent("OneToolbarHost");
4
+ var isAvailable = Platform.OS === "ios" && !Platform.isTV;
5
+ var ToolbarHostNative = isAvailable ? requireNativeComponent("OneToolbarHost") : null;
5
6
  function ToolbarHost(props) {
7
+ if (!ToolbarHostNative) return null;
6
8
  return /* @__PURE__ */ jsx(ToolbarHostNative, {
7
9
  ...props,
8
10
  style: {
@@ -15,8 +17,9 @@ function ToolbarHost(props) {
15
17
  }
16
18
  });
17
19
  }
18
- var ToolbarItemNative = requireNativeComponent("OneToolbarItem");
20
+ var ToolbarItemNative = isAvailable ? requireNativeComponent("OneToolbarItem") : null;
19
21
  function ToolbarItem(props) {
22
+ if (!ToolbarItemNative) return null;
20
23
  var { image, onSelected, ...rest } = props;
21
24
  return /* @__PURE__ */ jsx(ToolbarItemNative, {
22
25
  ...rest,
@@ -1 +1 @@
1
- {"version":3,"file":"index.native.js","names":[],"sources":["esm/platform/toolbar/index.native.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { requireNativeComponent } from \"react-native\";\nvar ToolbarHostNative = requireNativeComponent(\"OneToolbarHost\");\nfunction ToolbarHost(props) {\n return /* @__PURE__ */ _jsx(ToolbarHostNative, {\n ...props,\n style: {\n position: \"absolute\",\n top: 0,\n left: 0,\n width: 1,\n height: 1,\n backgroundColor: \"transparent\"\n }\n });\n}\nvar ToolbarItemNative = requireNativeComponent(\"OneToolbarItem\");\nfunction ToolbarItem(props) {\n var { image, onSelected, ...rest } = props;\n return /* @__PURE__ */ _jsx(ToolbarItemNative, {\n ...rest,\n imageSource: image,\n onSelected: onSelected ? function() {\n return onSelected();\n } : void 0\n });\n}\nexport {\n ToolbarHost,\n ToolbarItem\n};\n//# sourceMappingURL=index.native.js.map\n"],"mappings":";;;;AAEA,IAAI,oBAAoB,uBAAuB,gBAAgB;AAC/D,SAAS,YAAY,OAAO;CAC1B,OAAuB,oBAAK,mBAAmB;EAC7C,GAAG;EACH,OAAO;GACL,UAAU;GACV,KAAK;GACL,MAAM;GACN,OAAO;GACP,QAAQ;GACR,iBAAiB;EACnB;CACF,CAAC;AACH;AACA,IAAI,oBAAoB,uBAAuB,gBAAgB;AAC/D,SAAS,YAAY,OAAO;CAC1B,IAAI,EAAE,OAAO,YAAY,GAAG,SAAS;CACrC,OAAuB,oBAAK,mBAAmB;EAC7C,GAAG;EACH,aAAa;EACb,YAAY,aAAa,WAAW;GAClC,OAAO,WAAW;EACpB,IAAI,KAAK;CACX,CAAC;AACH"}
1
+ {"version":3,"file":"index.native.js","names":[],"sources":["esm/platform/toolbar/index.native.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { Platform, requireNativeComponent } from \"react-native\";\nvar isAvailable = Platform.OS === \"ios\" && !Platform.isTV;\nvar ToolbarHostNative = isAvailable ? requireNativeComponent(\"OneToolbarHost\") : null;\nfunction ToolbarHost(props) {\n if (!ToolbarHostNative) return null;\n return /* @__PURE__ */ _jsx(ToolbarHostNative, {\n ...props,\n style: {\n position: \"absolute\",\n top: 0,\n left: 0,\n width: 1,\n height: 1,\n backgroundColor: \"transparent\"\n }\n });\n}\nvar ToolbarItemNative = isAvailable ? requireNativeComponent(\"OneToolbarItem\") : null;\nfunction ToolbarItem(props) {\n if (!ToolbarItemNative) return null;\n var { image, onSelected, ...rest } = props;\n return /* @__PURE__ */ _jsx(ToolbarItemNative, {\n ...rest,\n imageSource: image,\n onSelected: onSelected ? function() {\n return onSelected();\n } : void 0\n });\n}\nexport {\n ToolbarHost,\n ToolbarItem\n};\n//# sourceMappingURL=index.native.js.map\n"],"mappings":";;;;AAEA,IAAI,cAAc,SAAS,OAAO,SAAS,CAAC,SAAS;AACrD,IAAI,oBAAoB,cAAc,uBAAuB,gBAAgB,IAAI;AACjF,SAAS,YAAY,OAAO;CAC1B,IAAI,CAAC,mBAAmB,OAAO;CAC/B,OAAuB,oBAAK,mBAAmB;EAC7C,GAAG;EACH,OAAO;GACL,UAAU;GACV,KAAK;GACL,MAAM;GACN,OAAO;GACP,QAAQ;GACR,iBAAiB;EACnB;CACF,CAAC;AACH;AACA,IAAI,oBAAoB,cAAc,uBAAuB,gBAAgB,IAAI;AACjF,SAAS,YAAY,OAAO;CAC1B,IAAI,CAAC,mBAAmB,OAAO;CAC/B,IAAI,EAAE,OAAO,YAAY,GAAG,SAAS;CACrC,OAAuB,oBAAK,mBAAmB;EAC7C,GAAG;EACH,aAAa;EACb,YAAY,aAAa,WAAW;GAClC,OAAO,WAAW;EACpB,IAAI,KAAK;CACX,CAAC;AACH"}
@@ -4,7 +4,7 @@ import { NativeNitroImage } from "react-native-nitro-image/src/NativeNitroImage"
4
4
  import { loadImage } from "react-native-nitro-image/src/loadImage";
5
5
 
6
6
  function Image(param) {
7
- var { source, onLoadStart, onLoad, onError, onLoadEnd, ...props } = param;
7
+ var { source, resizeMode = "cover", onLoadStart, onLoad, onError, onLoadEnd, ...props } = param;
8
8
  var uri = typeof source === "number" ? source : typeof source === "string" ? source : source.uri;
9
9
  var [loaded, setLoaded] = useState();
10
10
  useEffect(function() {
@@ -33,6 +33,7 @@ function Image(param) {
33
33
  }, [uri]);
34
34
  return /* @__PURE__ */ jsx(NativeNitroImage, {
35
35
  image: (loaded === null || loaded === void 0 ? void 0 : loaded.uri) === uri ? loaded.image : void 0,
36
+ resizeMode,
36
37
  ...props
37
38
  }, String(uri));
38
39
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Image.native.js","names":[],"sources":["esm/platform/ui/Image.native.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useEffect, useState } from \"react\";\nimport { NativeNitroImage } from \"react-native-nitro-image/src/NativeNitroImage\";\nimport { loadImage } from \"react-native-nitro-image/src/loadImage\";\nfunction Image(param) {\n var { source, onLoadStart, onLoad, onError, onLoadEnd, ...props } = param;\n var uri = typeof source === \"number\" ? source : typeof source === \"string\" ? source : source.uri;\n var [loaded, setLoaded] = useState();\n useEffect(function() {\n var cancelled = false;\n onLoadStart === null || onLoadStart === void 0 ? void 0 : onLoadStart();\n Promise.resolve(loadImage(typeof uri === \"number\" ? uri : {\n url: uri\n })).then(function(image) {\n if (cancelled) return;\n setLoaded({\n uri,\n image\n });\n onLoad === null || onLoad === void 0 ? void 0 : onLoad({\n nativeEvent: {\n source: {\n uri: String(uri),\n width: image.width,\n height: image.height\n }\n }\n });\n onLoadEnd === null || onLoadEnd === void 0 ? void 0 : onLoadEnd();\n }, function(error) {\n if (cancelled) return;\n onError === null || onError === void 0 ? void 0 : onError({\n nativeEvent: {\n error: error instanceof Error ? error.message : String(error)\n }\n });\n onLoadEnd === null || onLoadEnd === void 0 ? void 0 : onLoadEnd();\n });\n return function() {\n cancelled = true;\n };\n }, [\n uri\n ]);\n return /* @__PURE__ */ _jsx(NativeNitroImage, {\n image: (loaded === null || loaded === void 0 ? void 0 : loaded.uri) === uri ? loaded.image : void 0,\n ...props\n }, String(uri));\n}\nexport {\n Image\n};\n//# sourceMappingURL=Image.native.js.map\n"],"mappings":";;;;;;AAIA,SAAS,MAAM,OAAO;CACpB,IAAI,EAAE,QAAQ,aAAa,QAAQ,SAAS,WAAW,GAAG,UAAU;CACpE,IAAI,MAAM,OAAO,WAAW,WAAW,SAAS,OAAO,WAAW,WAAW,SAAS,OAAO;CAC7F,IAAI,CAAC,QAAQ,aAAa,SAAS;CACnC,UAAU,WAAW;EACnB,IAAI,YAAY;EAChB,gBAAgB,QAAQ,gBAAgB,KAAK,IAAI,KAAK,IAAI,YAAY;EACtE,QAAQ,QAAQ,UAAU,OAAO,QAAQ,WAAW,MAAM,EACxD,KAAK,IACP,CAAC,CAAC,CAAC,CAAC,KAAK,SAAS,OAAO;GACvB,IAAI,WAAW;GACf,UAAU;IACR;IACA;GACF,CAAC;GACD,WAAW,QAAQ,WAAW,KAAK,IAAI,KAAK,IAAI,OAAO,EACrD,aAAa,EACX,QAAQ;IACN,KAAK,OAAO,GAAG;IACf,OAAO,MAAM;IACb,QAAQ,MAAM;GAChB,EACF,EACF,CAAC;GACD,cAAc,QAAQ,cAAc,KAAK,IAAI,KAAK,IAAI,UAAU;EAClE,GAAG,SAAS,OAAO;GACjB,IAAI,WAAW;GACf,YAAY,QAAQ,YAAY,KAAK,IAAI,KAAK,IAAI,QAAQ,EACxD,aAAa,EACX,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,EAC9D,EACF,CAAC;GACD,cAAc,QAAQ,cAAc,KAAK,IAAI,KAAK,IAAI,UAAU;EAClE,CAAC;EACD,OAAO,WAAW;GAChB,YAAY;EACd;CACF,GAAG,CACD,GACF,CAAC;CACD,OAAuB,oBAAK,kBAAkB;EAC5C,QAAQ,WAAW,QAAQ,WAAW,KAAK,IAAI,KAAK,IAAI,OAAO,SAAS,MAAM,OAAO,QAAQ,KAAK;EAClG,GAAG;CACL,GAAG,OAAO,GAAG,CAAC;AAChB"}
1
+ {"version":3,"file":"Image.native.js","names":[],"sources":["esm/platform/ui/Image.native.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useEffect, useState } from \"react\";\nimport { NativeNitroImage } from \"react-native-nitro-image/src/NativeNitroImage\";\nimport { loadImage } from \"react-native-nitro-image/src/loadImage\";\nfunction Image(param) {\n var { source, resizeMode = \"cover\", onLoadStart, onLoad, onError, onLoadEnd, ...props } = param;\n var uri = typeof source === \"number\" ? source : typeof source === \"string\" ? source : source.uri;\n var [loaded, setLoaded] = useState();\n useEffect(function() {\n var cancelled = false;\n onLoadStart === null || onLoadStart === void 0 ? void 0 : onLoadStart();\n Promise.resolve(loadImage(typeof uri === \"number\" ? uri : {\n url: uri\n })).then(function(image) {\n if (cancelled) return;\n setLoaded({\n uri,\n image\n });\n onLoad === null || onLoad === void 0 ? void 0 : onLoad({\n nativeEvent: {\n source: {\n uri: String(uri),\n width: image.width,\n height: image.height\n }\n }\n });\n onLoadEnd === null || onLoadEnd === void 0 ? void 0 : onLoadEnd();\n }, function(error) {\n if (cancelled) return;\n onError === null || onError === void 0 ? void 0 : onError({\n nativeEvent: {\n error: error instanceof Error ? error.message : String(error)\n }\n });\n onLoadEnd === null || onLoadEnd === void 0 ? void 0 : onLoadEnd();\n });\n return function() {\n cancelled = true;\n };\n }, [\n uri\n ]);\n return /* @__PURE__ */ _jsx(NativeNitroImage, {\n image: (loaded === null || loaded === void 0 ? void 0 : loaded.uri) === uri ? loaded.image : void 0,\n // nitro's android view keeps ImageView's fit-center scale until resizeMode is\n // sent, so send the documented default on every platform.\n resizeMode,\n ...props\n }, String(uri));\n}\nexport {\n Image\n};\n//# sourceMappingURL=Image.native.js.map\n"],"mappings":";;;;;;AAIA,SAAS,MAAM,OAAO;CACpB,IAAI,EAAE,QAAQ,aAAa,SAAS,aAAa,QAAQ,SAAS,WAAW,GAAG,UAAU;CAC1F,IAAI,MAAM,OAAO,WAAW,WAAW,SAAS,OAAO,WAAW,WAAW,SAAS,OAAO;CAC7F,IAAI,CAAC,QAAQ,aAAa,SAAS;CACnC,UAAU,WAAW;EACnB,IAAI,YAAY;EAChB,gBAAgB,QAAQ,gBAAgB,KAAK,IAAI,KAAK,IAAI,YAAY;EACtE,QAAQ,QAAQ,UAAU,OAAO,QAAQ,WAAW,MAAM,EACxD,KAAK,IACP,CAAC,CAAC,CAAC,CAAC,KAAK,SAAS,OAAO;GACvB,IAAI,WAAW;GACf,UAAU;IACR;IACA;GACF,CAAC;GACD,WAAW,QAAQ,WAAW,KAAK,IAAI,KAAK,IAAI,OAAO,EACrD,aAAa,EACX,QAAQ;IACN,KAAK,OAAO,GAAG;IACf,OAAO,MAAM;IACb,QAAQ,MAAM;GAChB,EACF,EACF,CAAC;GACD,cAAc,QAAQ,cAAc,KAAK,IAAI,KAAK,IAAI,UAAU;EAClE,GAAG,SAAS,OAAO;GACjB,IAAI,WAAW;GACf,YAAY,QAAQ,YAAY,KAAK,IAAI,KAAK,IAAI,QAAQ,EACxD,aAAa,EACX,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,EAC9D,EACF,CAAC;GACD,cAAc,QAAQ,cAAc,KAAK,IAAI,KAAK,IAAI,UAAU;EAClE,CAAC;EACD,OAAO,WAAW;GAChB,YAAY;EACd;CACF,GAAG,CACD,GACF,CAAC;CACD,OAAuB,oBAAK,kBAAkB;EAC5C,QAAQ,WAAW,QAAQ,WAAW,KAAK,IAAI,KAAK,IAAI,OAAO,SAAS,MAAM,OAAO,QAAQ,KAAK;EAGlG;EACA,GAAG;CACL,GAAG,OAAO,GAAG,CAAC;AAChB"}
@@ -25,10 +25,14 @@ final class HybridOneClipboard: HybridOneClipboardSpec {
25
25
 
26
26
  func setString(text: String, options: ClipboardSetStringOptions) throws -> Promise<Bool> {
27
27
  return Promise.async { @MainActor in
28
+ // assigning .string replaces every pasteboard item, so html goes in
29
+ // one item that carries both representations, like android's
30
+ // newHtmlText.
28
31
  if options.inputFormat == "html", let data = text.data(using: .utf8) {
29
- UIPasteboard.general.setData(data, forPasteboardType: Self.htmlType)
32
+ UIPasteboard.general.items = [[Self.htmlType: data, "public.utf8-plain-text": text]]
33
+ } else {
34
+ UIPasteboard.general.string = text
30
35
  }
31
- UIPasteboard.general.string = text
32
36
  return true
33
37
  }
34
38
  }
@@ -501,10 +501,20 @@ final class HybridOneImagePicker: HybridOneImagePickerSpec {
501
501
  }
502
502
 
503
503
  // recompress a copied image to jpeg at the requested quality, replacing
504
- // the file. null when the image did not decode.
504
+ // the file. null when the image did not decode. the new jpeg carries no
505
+ // exif, so the decode applies the orientation to the pixels at full size.
505
506
  private static func compressImage(_ url: URL, quality: Double) -> ImagePickerAsset? {
506
507
  guard let source = CGImageSourceCreateWithURL(url as CFURL, nil),
507
- let cgImage = CGImageSourceCreateImageAtIndex(source, 0, nil)
508
+ let properties = CGImageSourceCopyPropertiesAtIndex(source, 0, nil) as? [CFString: Any],
509
+ let width = (properties[kCGImagePropertyPixelWidth] as? NSNumber)?.intValue,
510
+ let height = (properties[kCGImagePropertyPixelHeight] as? NSNumber)?.intValue,
511
+ let cgImage = CGImageSourceCreateThumbnailAtIndex(
512
+ source, 0,
513
+ [
514
+ kCGImageSourceCreateThumbnailFromImageAlways: true,
515
+ kCGImageSourceCreateThumbnailWithTransform: true,
516
+ kCGImageSourceThumbnailMaxPixelSize: max(width, height),
517
+ ] as CFDictionary)
508
518
  else {
509
519
  return nil
510
520
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "one",
3
- "version": "2.6.11",
3
+ "version": "2.6.12",
4
4
  "description": "One is a React framework for web, iOS, and Android apps.",
5
5
  "license": "BSD-3-Clause",
6
6
  "sideEffects": [
@@ -236,18 +236,18 @@
236
236
  "@react-navigation/native-stack": "8.0.0-alpha.58",
237
237
  "@react-navigation/routers": "8.0.0-alpha.20",
238
238
  "@ungap/structured-clone": "^1.2.0",
239
- "@vxrn/color-scheme": "2.6.11",
240
- "@vxrn/compiler": "2.6.11",
241
- "@vxrn/resolve": "2.6.11",
242
- "@vxrn/tslib-lite": "2.6.11",
243
- "@vxrn/use-isomorphic-layout-effect": "2.6.11",
244
- "@vxrn/utils": "2.6.11",
245
- "@vxrn/vite-plugin-metro": "2.6.11",
239
+ "@vxrn/color-scheme": "2.6.12",
240
+ "@vxrn/compiler": "2.6.12",
241
+ "@vxrn/resolve": "2.6.12",
242
+ "@vxrn/tslib-lite": "2.6.12",
243
+ "@vxrn/use-isomorphic-layout-effect": "2.6.12",
244
+ "@vxrn/utils": "2.6.12",
245
+ "@vxrn/vite-plugin-metro": "2.6.12",
246
246
  "babel-dead-code-elimination": "1.0.10",
247
247
  "babel-plugin-module-resolver": "^5.0.2",
248
248
  "citty": "^0.1.6",
249
249
  "core-js": "^3.38.1",
250
- "create-vxrn": "2.6.11",
250
+ "create-vxrn": "2.6.12",
251
251
  "escape-string-regexp": "^5.0.0",
252
252
  "fast-deep-equal": "^3.1.3",
253
253
  "fast-glob": "^3.3.3",
@@ -269,7 +269,7 @@
269
269
  "tsconfig-paths": "^4",
270
270
  "use-latest-callback": "^0.2.3",
271
271
  "vite": "^8.2.2",
272
- "vxrn": "2.6.11",
272
+ "vxrn": "2.6.12",
273
273
  "web-streams-polyfill": "^4.3.0",
274
274
  "ws": "^8.21.0",
275
275
  "xxhashjs": "^0.2.2"
@@ -337,7 +337,7 @@
337
337
  "@types/react-dom": "^19.2.2",
338
338
  "@types/react-test-renderer": "^19.1.0",
339
339
  "@types/xxhashjs": "^0.2.4",
340
- "@vxrn/emitter": "2.6.11",
340
+ "@vxrn/emitter": "2.6.12",
341
341
  "depcheck": "^1.4.7",
342
342
  "esbuild": "^0.25.12",
343
343
  "immer": "^10.1.1",
@@ -513,7 +513,7 @@
513
513
  }
514
514
  }
515
515
  },
516
- "releaseSourceCommit": "fa440f1b25732fb2be740c48fd328ee0fb1bb0fd",
516
+ "releaseSourceCommit": "a04a783d5665af4b8696633597697e3cf2f16e0f",
517
517
  "repository": {
518
518
  "type": "git",
519
519
  "url": "git+https://github.com/onejs/one.git",
@@ -1,14 +1,19 @@
1
- import { requireNativeComponent, type ViewProps } from 'react-native'
1
+ import { Platform, requireNativeComponent, type ViewProps } from 'react-native'
2
2
 
3
3
  import type { ToolbarHostProps, ToolbarItemProps } from './types'
4
4
 
5
5
  export type { ToolbarHostProps, ToolbarItemProps, BasicTextStyle } from './types'
6
6
 
7
- const ToolbarHostNative = requireNativeComponent<
8
- ViewProps & { children?: React.ReactNode }
9
- >('OneToolbarHost')
7
+ // the toolbar views exist only on ios, so android renders nothing, like
8
+ // MenuAction and the zoom transition views.
9
+ const isAvailable = Platform.OS === 'ios' && !Platform.isTV
10
+
11
+ const ToolbarHostNative = isAvailable
12
+ ? requireNativeComponent<ViewProps & { children?: React.ReactNode }>('OneToolbarHost')
13
+ : null
10
14
 
11
15
  export function ToolbarHost(props: ToolbarHostProps) {
16
+ if (!ToolbarHostNative) return null
12
17
  return (
13
18
  <ToolbarHostNative
14
19
  {...props}
@@ -24,10 +29,12 @@ export function ToolbarHost(props: ToolbarHostProps) {
24
29
  )
25
30
  }
26
31
 
27
- const ToolbarItemNative: React.ComponentType<any> =
28
- requireNativeComponent('OneToolbarItem')
32
+ const ToolbarItemNative: React.ComponentType<any> | null = isAvailable
33
+ ? requireNativeComponent('OneToolbarItem')
34
+ : null
29
35
 
30
36
  export function ToolbarItem(props: ToolbarItemProps) {
37
+ if (!ToolbarItemNative) return null
31
38
  const { image, onSelected, ...rest } = props
32
39
  return (
33
40
  <ToolbarItemNative
@@ -19,7 +19,15 @@ export type ImageProps = Omit<
19
19
  onError?: (event: { nativeEvent: { error: string } }) => void
20
20
  }
21
21
 
22
- export function Image({ source, onLoadStart, onLoad, onError, onLoadEnd, ...props }: ImageProps) {
22
+ export function Image({
23
+ source,
24
+ resizeMode = 'cover',
25
+ onLoadStart,
26
+ onLoad,
27
+ onError,
28
+ onLoadEnd,
29
+ ...props
30
+ }: ImageProps) {
23
31
  const uri = typeof source === 'number' ? source : typeof source === 'string' ? source : source.uri
24
32
  const [loaded, setLoaded] = useState<{ uri: string | number; image: LoadedImage }>()
25
33
 
@@ -57,6 +65,9 @@ export function Image({ source, onLoadStart, onLoad, onError, onLoadEnd, ...prop
57
65
  <NativeNitroImage
58
66
  key={String(uri)}
59
67
  image={loaded?.uri === uri ? loaded.image : undefined}
68
+ // nitro's android view keeps ImageView's fit-center scale until resizeMode is
69
+ // sent, so send the documented default on every platform.
70
+ resizeMode={resizeMode}
60
71
  {...props}
61
72
  />
62
73
  )
@@ -1,5 +1,5 @@
1
1
  import type { ToolbarHostProps, ToolbarItemProps } from './types';
2
2
  export type { ToolbarHostProps, ToolbarItemProps, BasicTextStyle } from './types';
3
- export declare function ToolbarHost(props: ToolbarHostProps): import("react/jsx-runtime").JSX.Element;
4
- export declare function ToolbarItem(props: ToolbarItemProps): import("react/jsx-runtime").JSX.Element;
3
+ export declare function ToolbarHost(props: ToolbarHostProps): import("react/jsx-runtime").JSX.Element | null;
4
+ export declare function ToolbarItem(props: ToolbarItemProps): import("react/jsx-runtime").JSX.Element | null;
5
5
  //# sourceMappingURL=index.native.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../src/platform/toolbar/index.native.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAEjE,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAMjF,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CAclD;AAKD,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CASlD"}
1
+ {"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../src/platform/toolbar/index.native.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAEjE,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAUjF,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,kDAelD;AAMD,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,kDAUlD"}
@@ -20,5 +20,5 @@ export type ImageProps = Omit<RNImageProps, 'source' | 'resizeMode' | 'onLoad' |
20
20
  };
21
21
  }) => void;
22
22
  };
23
- export declare function Image({ source, onLoadStart, onLoad, onError, onLoadEnd, ...props }: ImageProps): import("react/jsx-runtime").JSX.Element;
23
+ export declare function Image({ source, resizeMode, onLoadStart, onLoad, onError, onLoadEnd, ...props }: ImageProps): import("react/jsx-runtime").JSX.Element;
24
24
  //# sourceMappingURL=Image.native.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Image.native.d.ts","sourceRoot":"","sources":["../../../src/platform/ui/Image.native.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,IAAI,YAAY,EAAE,MAAM,cAAc,CAAA;AAE9D,MAAM,MAAM,UAAU,GAAG,IAAI,CAC3B,YAAY,EACZ,QAAQ,GAAG,YAAY,GAAG,QAAQ,GAAG,SAAS,CAC/C,GAAG;IACF,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAA;IACzC,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAA;IACvD,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE;QACf,WAAW,EAAE;YAAE,MAAM,EAAE;gBAAE,GAAG,EAAE,MAAM,CAAC;gBAAC,KAAK,EAAE,MAAM,CAAC;gBAAC,MAAM,EAAE,MAAM,CAAA;aAAE,CAAA;SAAE,CAAA;KACxE,KAAK,IAAI,CAAA;IACV,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,WAAW,EAAE;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,KAAK,IAAI,CAAA;CAC9D,CAAA;AAED,wBAAgB,KAAK,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,UAAU,2CAyC9F"}
1
+ {"version":3,"file":"Image.native.d.ts","sourceRoot":"","sources":["../../../src/platform/ui/Image.native.tsx"],"names":[],"mappings":"AAMA,OAAO,KA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