@fluentui-react-native/focus-zone 0.10.25 → 0.10.26

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,22 @@
2
2
  "name": "@fluentui-react-native/focus-zone",
3
3
  "entries": [
4
4
  {
5
- "date": "Thu, 20 Oct 2022 18:28:41 GMT",
5
+ "date": "Thu, 20 Oct 2022 19:20:31 GMT",
6
+ "tag": "@fluentui-react-native/focus-zone_v0.10.26",
7
+ "version": "0.10.26",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "sanajmi@microsoft.com",
12
+ "package": "@fluentui-react-native/focus-zone",
13
+ "commit": "9e827dde137238cae829145564cbc880bbdc5a90",
14
+ "comment": "FocusZone (macOS): Fix RTL bug"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Thu, 20 Oct 2022 18:30:02 GMT",
6
21
  "tag": "@fluentui-react-native/focus-zone_v0.10.25",
7
22
  "version": "0.10.25",
8
23
  "comments": {
@@ -17,7 +32,7 @@
17
32
  "author": "beachball",
18
33
  "package": "@fluentui-react-native/focus-zone",
19
34
  "comment": "Bump @fluentui-react-native/interactive-hooks to v0.19.1",
20
- "commit": "34dd5c82030fc890c2133c9190d17bdcba6e173e"
35
+ "commit": "9e827dde137238cae829145564cbc880bbdc5a90"
21
36
  }
22
37
  ]
23
38
  }
package/CHANGELOG.md CHANGED
@@ -1,12 +1,20 @@
1
1
  # Change Log - @fluentui-react-native/focus-zone
2
2
 
3
- This log was last generated on Thu, 20 Oct 2022 18:28:41 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 20 Oct 2022 19:20:31 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 0.10.26
8
+
9
+ Thu, 20 Oct 2022 19:20:31 GMT
10
+
11
+ ### Patches
12
+
13
+ - FocusZone (macOS): Fix RTL bug (sanajmi@microsoft.com)
14
+
7
15
  ## 0.10.25
8
16
 
9
- Thu, 20 Oct 2022 18:28:41 GMT
17
+ Thu, 20 Oct 2022 18:30:02 GMT
10
18
 
11
19
  ### Patches
12
20
 
@@ -1,5 +1,6 @@
1
1
  #import "KeyCodes.h"
2
2
  #import "RCTFocusZone.h"
3
+ #import "RCTi18nUtil.h"
3
4
 
4
5
  typedef enum {
5
6
  FocusZoneActionNone,
@@ -25,9 +26,18 @@ static inline CGFloat GetDistanceBetweenPoints(NSPoint point1, NSPoint point2)
25
26
  return sqrt(delta.x * delta.x + delta.y * delta.y);
26
27
  }
27
28
 
28
- static inline CGFloat GetDistanceBetweenOriginsOfRects(NSRect rect1, NSRect rect2)
29
+ static inline CGFloat GetDistanceBetweenRects(NSRect rect1, NSRect rect2)
29
30
  {
30
- return GetDistanceBetweenPoints(rect1.origin, rect2.origin);
31
+ // Get the top left corner of the rect, top right in RTL
32
+ bool isRTL = [[RCTI18nUtil sharedInstance] isRTL];
33
+
34
+ CGFloat rect1Offset = isRTL ? rect1.size.width : 0;
35
+ CGFloat rect2Offset = isRTL ? rect2.size.width : 0;
36
+
37
+ NSPoint rect1Corner = NSMakePoint(rect1.origin.x + rect1Offset , rect1.origin.y);
38
+ NSPoint rect2Corner = NSMakePoint(rect2.origin.x + rect2Offset , rect2.origin.y);
39
+
40
+ return GetDistanceBetweenPoints(rect1Corner, rect2Corner);
31
41
  }
32
42
 
33
43
  static inline CGFloat GetMinDistanceBetweenRectVerticesAndPoint(NSRect rect, NSPoint point)
@@ -270,7 +280,7 @@ static BOOL ShouldSkipFocusZone(NSView *view)
270
280
 
271
281
  if (!skip)
272
282
  {
273
- CGFloat distance = GetDistanceBetweenOriginsOfRects(firstResponderRect, candidateRect);
283
+ CGFloat distance = GetDistanceBetweenRects(firstResponderRect, candidateRect);
274
284
 
275
285
  // If there are other candidate views inside the same ScrollView as the firstResponder,
276
286
  // prefer those views over other views outside the scrollview, even if they are closer.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui-react-native/focus-zone",
3
- "version": "0.10.25",
3
+ "version": "0.10.26",
4
4
  "description": "A cross-platform FocusZone component using the Fluent Design System",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",