@craft-native/ios 0.0.192 → 0.0.194

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@craft-native/ios",
3
- "version": "0.0.192",
3
+ "version": "0.0.194",
4
4
  "homepage": "https://github.com/craft-native/craft/tree/main/packages/ios#readme",
5
5
  "repository": {
6
6
  "type": "git",
@@ -726,6 +726,11 @@ private func craftNativeAlignContentCode(_ value: String) -> UInt32 {
726
726
  }
727
727
  }
728
728
 
729
+ /// Keep the indicator's intrinsic size separate from authored style transforms.
730
+ private final class CraftNativeActivityIndicatorView: UIActivityIndicatorView {
731
+ var indicatorScale: CGFloat = 1
732
+ }
733
+
729
734
  /// A native screen's `<Video>`: AVPlayerViewController in place.
730
735
  ///
731
736
  /// With sound, a video takes the audio session as a playing sound does
@@ -4401,6 +4406,11 @@ final class CraftNativeScreenController: UIViewController, UIScrollViewDelegate,
4401
4406
  navigationController?.setNavigationBarHidden(hidden, animated: view.window != nil)
4402
4407
  }
4403
4408
  }
4409
+ if options.keys.contains("leftButtons") {
4410
+ let buttons = (options["leftButtons"] as? [[String: Any]]) ?? []
4411
+ navigationItem.leftItemsSupplementBackButton = true
4412
+ navigationItem.leftBarButtonItems = buttons.compactMap(navigationButton)
4413
+ }
4404
4414
  if options.keys.contains("rightButtons") {
4405
4415
  let buttons = (options["rightButtons"] as? [[String: Any]]) ?? []
4406
4416
  navigationItem.rightBarButtonItems = buttons.compactMap(navigationButton).reversed()
@@ -4475,6 +4485,7 @@ final class CraftNativeScreenController: UIViewController, UIScrollViewDelegate,
4475
4485
  } else {
4476
4486
  item.accessibilityLabel = id
4477
4487
  }
4488
+ if spec["variant"] as? String == "neutral" { item.tintColor = .label }
4478
4489
  if let tint = (spec["color"] as? String).flatMap({ UIColor(hex: $0) }) { item.tintColor = tint }
4479
4490
  // `image`: a picture (an https URL, the account's own photo), drawn
4480
4491
  // round as iOS draws an account button. The symbol or title shows
@@ -5510,7 +5521,7 @@ final class CraftNativeScreenController: UIViewController, UIScrollViewDelegate,
5510
5521
  updateHandler(nonEmptyHandler(events["onValueChange"]) ?? nonEmptyHandler(events["onChange"]), for: slider)
5511
5522
  updateAuxiliaryHandler(events["onSlidingComplete"], in: &sliderCompleteHandlers, for: slider)
5512
5523
  case "ActivityIndicator":
5513
- let indicator = result as! UIActivityIndicatorView
5524
+ let indicator = result as! CraftNativeActivityIndicatorView
5514
5525
  let requestedSize = props["size"]
5515
5526
  indicator.style = (requestedSize as? String) == "large" ? .large : .medium
5516
5527
  let scale: CGFloat
@@ -5522,7 +5533,7 @@ final class CraftNativeScreenController: UIViewController, UIScrollViewDelegate,
5522
5533
  } else {
5523
5534
  scale = 1
5524
5535
  }
5525
- indicator.transform = CGAffineTransform(scaleX: scale, y: scale)
5536
+ indicator.indicatorScale = scale
5526
5537
  indicator.color = color(props["color"]) ?? .tintColor
5527
5538
  indicator.hidesWhenStopped = props["hidesWhenStopped"] as? Bool ?? true
5528
5539
  if props["animating"] as? Bool == false {
@@ -5728,7 +5739,7 @@ final class CraftNativeScreenController: UIViewController, UIScrollViewDelegate,
5728
5739
  slider.addTarget(self, action: #selector(sliderFinished(_:)), for: [.touchUpInside, .touchUpOutside, .touchCancel])
5729
5740
  return slider
5730
5741
  case "ActivityIndicator":
5731
- return UIActivityIndicatorView(style: .medium)
5742
+ return CraftNativeActivityIndicatorView(style: .medium)
5732
5743
  case "StatusBar", "RefreshControl":
5733
5744
  return CraftNativeFlowView()
5734
5745
  case "Image":
@@ -6437,8 +6448,9 @@ final class CraftNativeScreenController: UIViewController, UIScrollViewDelegate,
6437
6448
  }
6438
6449
 
6439
6450
  private func applyTransform(_ raw: Any?, to view: UIView) {
6440
- view.transform = .identity
6451
+ let intrinsicScale = (view as? CraftNativeActivityIndicatorView)?.indicatorScale ?? 1
6441
6452
  view.layer.transform = CATransform3DIdentity
6453
+ view.transform = CGAffineTransform(scaleX: intrinsicScale, y: intrinsicScale)
6442
6454
  guard let transforms = raw as? [[String: Any]] else { return }
6443
6455
  var affine = CGAffineTransform.identity
6444
6456
  var threeDimensional = CATransform3DIdentity
@@ -6461,6 +6473,7 @@ final class CraftNativeScreenController: UIViewController, UIScrollViewDelegate,
6461
6473
  hasThreeDimensionalRotation = true
6462
6474
  }
6463
6475
  }
6476
+ affine = affine.scaledBy(x: intrinsicScale, y: intrinsicScale)
6464
6477
  if hasThreeDimensionalRotation {
6465
6478
  view.layer.transform = CATransform3DConcat(CATransform3DMakeAffineTransform(affine), threeDimensional)
6466
6479
  } else {