Skip to content

Commit d5a15d1

Browse files
authored
fix(VibrancyView): remove hit test override (#3866)
* fix(VibrancyView): remove hit test override * Change files * Update an import so we use the furn callout package in fluent tester * f
1 parent f02d26d commit d5a15d1

File tree

3 files changed

+19
-31
lines changed

3 files changed

+19
-31
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "minor",
3+
"comment": "fix(VibrancyView): remove hit test override",
4+
"packageName": "@fluentui-react-native/vibrancy-view",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}
Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,19 @@
11
import AppKit
2+
23
#if USE_REACT_AS_MODULE
3-
import React
4-
#endif // USE_REACT_AS_MODULE
4+
import React
5+
#endif // USE_REACT_AS_MODULE
56

67
/// React Native macOS inherits some assumptions from React Native on iOS / UIKit.
78
/// This serves as an issue when we want to write our own native components derived from NSView, as we don't
89
/// inherit the "fixes" we need from RCTView to get views working properly.. This subclass "fixes" the minimal amount
910
/// so that our native component works as expected.
1011
internal class FixedVisualEffectView: NSVisualEffectView {
1112

12-
/// React Native macOS uses a flipped coordinate space by default. to match the other platforms.
13-
/// Let's stay consistent and ensure any views hosting React Native views are also flipped.
14-
/// This helps RCTTouchHandler register clicks in the right location, and ensures `layer.geometryFlipped` is true.
15-
override var isFlipped: Bool {
16-
return true
17-
}
18-
19-
/// This subclass is necessary due to differences' in hitTest()'s implementation between iOS and macOS
20-
/// On iOS / UIKit, hitTest(_ point:, with event:) takes a point in the receiver's local coordinate system.
21-
/// On macOS / AppKit, hitTest(_ point) takes a point in the reciever's superviews' coordinate system.
22-
/// RCTView assumes the iOS implementation, so it has an override of hitTest(_ point). Let's copy the
23-
/// implementatation to our native component, so that clicks for subviews of type RCTView are handled properly.
24-
/// Another solution would be to add an RCTView subview that covers the full bounds of our native view
25-
open override func hitTest(_ point: NSPoint) -> NSView? {
26-
var pointForHitTest = point
27-
for subview in subviews {
28-
if let subview = subview as? RCTView {
29-
pointForHitTest = subview.convert(point, from: superview)
30-
}
31-
let result = subview.hitTest(pointForHitTest)
32-
if (result != nil) {
33-
return result
34-
}
35-
}
36-
return nil
37-
}
13+
/// React Native macOS uses a flipped coordinate space by default. to match the other platforms.
14+
/// Let's stay consistent and ensure any views hosting React Native views are also flipped.
15+
/// This helps RCTTouchHandler register clicks in the right location, and ensures `layer.geometryFlipped` is true.
16+
override var isFlipped: Bool {
17+
return true
18+
}
3819
}

yarn.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18846,8 +18846,8 @@ __metadata:
1884618846
linkType: hard
1884718847

1884818848
"react-native-macos@npm:^0.73.0":
18849-
version: 0.73.35
18850-
resolution: "react-native-macos@npm:0.73.35"
18849+
version: 0.73.36
18850+
resolution: "react-native-macos@npm:0.73.36"
1885118851
dependencies:
1885218852
"@jest/create-cache-key-function": "npm:^29.6.3"
1885318853
"@react-native-community/cli": "npm:12.3.6"
@@ -18891,7 +18891,7 @@ __metadata:
1889118891
react: 18.2.0
1889218892
bin:
1889318893
react-native-macos: cli.js
18894-
checksum: 10c0/365b0886e810bbce800a781d4eb186e07d34b8c0daadb25efd4235d3afab4e806b36a44aceef751c586c787ae392ad1c9bee87b3f3475d8769d37de5b8dce4b5
18894+
checksum: 10c0/c58570ab2dd5836a96ccb477e60e8462a89c730d0c4ab3edae780fb0963fc6ca944dcbc321e2e8314e727c41de56a296327b3534fadc6031b62ae53bca54b226
1889518895
languageName: node
1889618896
linkType: hard
1889718897

0 commit comments

Comments
 (0)