react-native-a11y-order 0.7.1-rc → 0.7.2-rc

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.

Potentially problematic release.


This version of react-native-a11y-order might be problematic. Click here for more details.

@@ -17,21 +17,31 @@
17
17
  #import <React/RCTView.h>
18
18
  #endif
19
19
 
20
+ @interface RNAOWeakWrapper : NSObject
21
+ @property (nonatomic, weak) id value;
22
+ @end
23
+
24
+ @implementation RNAOWeakWrapper
25
+ @end
26
+
20
27
  static char kRNAOScreenReaderFocusDelegate;
21
28
 
22
29
  @implementation UIView (RNAOA11yOrder)
23
30
 
24
31
  - (void)setScreenReaderFocusDelegate:(id<RNAOScreenReaderFocusDelegate>)focusDelegate {
25
- objc_setAssociatedObject(self, &kRNAOScreenReaderFocusDelegate, focusDelegate, OBJC_ASSOCIATION_ASSIGN);
32
+ RNAOWeakWrapper *weakDelegate = [[RNAOWeakWrapper alloc] init];
33
+ [weakDelegate setValue: focusDelegate];
34
+ objc_setAssociatedObject(self, &kRNAOScreenReaderFocusDelegate, weakDelegate, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
26
35
  }
27
36
 
28
37
  - (void)clearScreenReaderFocusDelegate {
29
- objc_setAssociatedObject(self, &kRNAOScreenReaderFocusDelegate, nil, OBJC_ASSOCIATION_ASSIGN);
38
+ objc_setAssociatedObject(self, &kRNAOScreenReaderFocusDelegate, nil, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
30
39
  }
31
40
 
32
41
  - (id<RNAOScreenReaderFocusDelegate>)getScreenReaderFocusDelegate {
33
42
  @try {
34
- return objc_getAssociatedObject(self, &kRNAOScreenReaderFocusDelegate);
43
+ RNAOWeakWrapper *wrapper = objc_getAssociatedObject(self, &kRNAOScreenReaderFocusDelegate);
44
+ return wrapper ? wrapper.value : nil;
35
45
  } @catch (NSException *exception) {
36
46
  return nil;
37
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-a11y-order",
3
- "version": "0.7.1-rc",
3
+ "version": "0.7.2-rc",
4
4
  "description": "ReactNative library for managing screen reader focus ordering",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",