@fluentui-react-native/callout 0.19.18 → 0.19.22

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.json CHANGED
@@ -2,7 +2,73 @@
2
2
  "name": "@fluentui-react-native/callout",
3
3
  "entries": [
4
4
  {
5
- "date": "Tue, 25 Jan 2022 21:54:01 GMT",
5
+ "date": "Wed, 02 Feb 2022 02:26:23 GMT",
6
+ "tag": "@fluentui-react-native/callout_v0.19.22",
7
+ "version": "0.19.22",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "beachball",
12
+ "package": "@fluentui-react-native/callout",
13
+ "comment": "Bump @fluentui-react-native/interactive-hooks to v0.12.2",
14
+ "commit": "c42dec6d24b24ded9a85dd11076e49d9b92980aa"
15
+ },
16
+ {
17
+ "author": "beachball",
18
+ "package": "@fluentui-react-native/callout",
19
+ "comment": "Bump @uifabricshared/foundation-compose to v1.11.9",
20
+ "commit": "c42dec6d24b24ded9a85dd11076e49d9b92980aa"
21
+ }
22
+ ]
23
+ }
24
+ },
25
+ {
26
+ "date": "Fri, 28 Jan 2022 20:52:39 GMT",
27
+ "tag": "@fluentui-react-native/callout_v0.19.21",
28
+ "version": "0.19.21",
29
+ "comments": {
30
+ "patch": [
31
+ {
32
+ "author": "sanajmi@microsoft.com",
33
+ "package": "@fluentui-react-native/callout",
34
+ "commit": "de0a37f48e525af8a22a37be8234731308e585c5",
35
+ "comment": "ContextualMenu macOS: fix focus shifting on click"
36
+ }
37
+ ]
38
+ }
39
+ },
40
+ {
41
+ "date": "Wed, 26 Jan 2022 20:31:04 GMT",
42
+ "tag": "@fluentui-react-native/callout_v0.19.20",
43
+ "version": "0.19.20",
44
+ "comments": {
45
+ "patch": [
46
+ {
47
+ "author": "beachball",
48
+ "package": "@fluentui-react-native/callout",
49
+ "comment": "Bump @fluentui-react-native/interactive-hooks to v0.12.1",
50
+ "commit": "1f6a66699e8a06bfd55a613ee9019ba8ca27d0b4"
51
+ }
52
+ ]
53
+ }
54
+ },
55
+ {
56
+ "date": "Wed, 26 Jan 2022 17:02:27 GMT",
57
+ "tag": "@fluentui-react-native/callout_v0.19.19",
58
+ "version": "0.19.19",
59
+ "comments": {
60
+ "patch": [
61
+ {
62
+ "author": "beachball",
63
+ "package": "@fluentui-react-native/callout",
64
+ "comment": "Bump @fluentui-react-native/interactive-hooks to v0.12.0",
65
+ "commit": "883ef66b94a1efb5d429c5ecad015f312be3b4c3"
66
+ }
67
+ ]
68
+ }
69
+ },
70
+ {
71
+ "date": "Tue, 25 Jan 2022 21:55:31 GMT",
6
72
  "tag": "@fluentui-react-native/callout_v0.19.18",
7
73
  "version": "0.19.18",
8
74
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,45 @@
1
1
  # Change Log - @fluentui-react-native/callout
2
2
 
3
- This log was last generated on Tue, 25 Jan 2022 21:54:01 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 02 Feb 2022 02:26:23 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 0.19.22
8
+
9
+ Wed, 02 Feb 2022 02:26:23 GMT
10
+
11
+ ### Patches
12
+
13
+ - Bump @fluentui-react-native/interactive-hooks to v0.12.2
14
+ - Bump @uifabricshared/foundation-compose to v1.11.9
15
+
16
+ ## 0.19.21
17
+
18
+ Fri, 28 Jan 2022 20:52:39 GMT
19
+
20
+ ### Patches
21
+
22
+ - ContextualMenu macOS: fix focus shifting on click (sanajmi@microsoft.com)
23
+
24
+ ## 0.19.20
25
+
26
+ Wed, 26 Jan 2022 20:31:04 GMT
27
+
28
+ ### Patches
29
+
30
+ - Bump @fluentui-react-native/interactive-hooks to v0.12.1
31
+
32
+ ## 0.19.19
33
+
34
+ Wed, 26 Jan 2022 17:02:27 GMT
35
+
36
+ ### Patches
37
+
38
+ - Bump @fluentui-react-native/interactive-hooks to v0.12.0
39
+
7
40
  ## 0.19.18
8
41
 
9
- Tue, 25 Jan 2022 21:54:01 GMT
42
+ Tue, 25 Jan 2022 21:55:31 GMT
10
43
 
11
44
  ### Patches
12
45
 
@@ -58,17 +58,6 @@ class CalloutView: RCTView, CalloutWindowLifeCycleDelegate {
58
58
  // MARK: RCTComponent Overrides
59
59
 
60
60
  override func insertReactSubview(_ subview: NSView!, at atIndex: Int) {
61
- /*
62
- If we attach a touch handler to the proxy view directly, the touch coordinates
63
- are incorrect and the wrong subview recieves the touch event, most likely
64
- because macOS screen coordinates have a flipped Y axis. The workaround is to
65
- attach a separate touch handler to each subview
66
- */
67
- guard let touchHandler = RCTTouchHandler(bridge: bridge) else {
68
- preconditionFailure("Callout could not create RCTTouchHandler")
69
- }
70
- touchHandler.attach(to: subview as? RCTUIView)
71
-
72
61
  proxyView.insertReactSubview(subview, at: atIndex)
73
62
  }
74
63
 
@@ -281,37 +270,53 @@ class CalloutView: RCTView, CalloutWindowLifeCycleDelegate {
281
270
 
282
271
  // MARK: Private variables
283
272
 
273
+ /// The view the Callout is presented from, if anchorRect is nil.
284
274
  private var anchorView: NSView?
285
275
 
286
- private var proxyView = RCTView()
276
+ /// The view we forward Callout's Children to. It's hosted within the CalloutWindow's
277
+ /// view heirarchy, ensuring our React Views are not placed in the main window.
278
+ private lazy var proxyView: NSView = {
279
+ let visualEffectView = FlippedVisualEffectView()
280
+ visualEffectView.translatesAutoresizingMaskIntoConstraints = false
281
+ visualEffectView.material = .menu
282
+ visualEffectView.state = .active
283
+ visualEffectView.wantsLayer = true
284
+ visualEffectView.layer?.cornerRadius = calloutWindowCornerRadius
285
+
286
+ /**
287
+ * We can't directly call touchHandler.attach(to:) because `visualEffectView` is not an RCTUIView.
288
+ * We get around this limitation by just replicating what `attach` did internally: add a gestureRecognizer.
289
+ */
290
+ guard let touchHandler = RCTTouchHandler(bridge: bridge) else {
291
+ preconditionFailure("Callout could not create RCTTouchHandler")
292
+ }
293
+ visualEffectView.addGestureRecognizer(touchHandler)
294
+
295
+ return visualEffectView
296
+ }()
287
297
 
288
298
  private lazy var calloutWindow: CalloutWindow = {
289
299
  let window = CalloutWindow()
290
300
  window.lifeCycleDelegate = self
291
301
 
292
- let visualEffect = NSVisualEffectView()
293
- visualEffect.translatesAutoresizingMaskIntoConstraints = false
294
- visualEffect.material = .menu
295
- visualEffect.state = .active
296
- visualEffect.wantsLayer = true
297
- visualEffect.layer?.cornerRadius = calloutWindowCornerRadius
298
-
299
302
  guard let contentView = window.contentView else {
300
303
  preconditionFailure("Callout window has no content view")
301
304
  }
302
305
 
303
- contentView.addSubview(visualEffect)
304
- NSLayoutConstraint.activate([
305
- visualEffect.leadingAnchor.constraint(equalTo: contentView.leadingAnchor),
306
- visualEffect.trailingAnchor.constraint(equalTo: contentView.trailingAnchor),
307
- visualEffect.topAnchor.constraint(equalTo: contentView.topAnchor),
308
- visualEffect.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),
309
- ])
310
-
311
- visualEffect.addSubview(proxyView)
306
+ contentView.addSubview(proxyView)
307
+ window.initialFirstResponder = proxyView
312
308
 
313
309
  return window
314
310
  }()
315
311
  }
316
312
 
313
+ /// React Native macOS uses a flipped coordinate space by default. Let's stay consistent and
314
+ /// ensure any views hosting React Native views are also flipped. This helps RCTTouchHandler
315
+ /// register clicks in the right location.
316
+ private class FlippedVisualEffectView: NSVisualEffectView {
317
+ override var isFlipped: Bool {
318
+ return true
319
+ }
320
+ }
321
+
317
322
  private var calloutWindowCornerRadius: CGFloat = 5.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui-react-native/callout",
3
- "version": "0.19.18",
3
+ "version": "0.19.22",
4
4
  "description": "A cross-platform Callout component using the Fluent Design System",
5
5
  "license": "MIT",
6
6
  "author": "",
@@ -27,10 +27,10 @@
27
27
  "dependencies": {
28
28
  "@fluentui-react-native/adapters": "^0.8.2",
29
29
  "@fluentui-react-native/component-cache": "^1.3.1",
30
- "@fluentui-react-native/interactive-hooks": ">=0.11.15 <1.0.0",
30
+ "@fluentui-react-native/interactive-hooks": ">=0.12.2 <1.0.0",
31
31
  "@fluentui-react-native/tokens": ">=0.11.5 <1.0.0",
32
32
  "@uifabricshared/foundation-composable": ">=0.10.2 <1.0.0",
33
- "@uifabricshared/foundation-compose": "^1.11.8",
33
+ "@uifabricshared/foundation-compose": "^1.11.9",
34
34
  "@uifabricshared/foundation-settings": ">=0.11.2 <1.0.0"
35
35
  },
36
36
  "devDependencies": {