react-native-a11y-order 0.1.0

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.
Files changed (146) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +53 -0
  3. package/android/build.gradle +90 -0
  4. package/android/gradle.properties +5 -0
  5. package/android/src/main/AndroidManifest.xml +4 -0
  6. package/android/src/main/java/com/a11yorder/A11yOrderModule.java +83 -0
  7. package/android/src/main/java/com/a11yorder/A11yOrderPackage.java +45 -0
  8. package/android/src/newarch/A11yOrderSpec.java +9 -0
  9. package/android/src/oldarch/A11yOrderSpec.java +15 -0
  10. package/ios/A11yOrder-Bridging-Header.h +3 -0
  11. package/ios/A11yOrder.h +6 -0
  12. package/ios/A11yOrder.mm +72 -0
  13. package/ios/A11yOrder.xcodeproj/project.pbxproj +281 -0
  14. package/ios/A11yOrder.xcodeproj/project.xcworkspace/contents.xcworkspacedata +4 -0
  15. package/ios/A11yOrder.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  16. package/ios/A11yOrder.xcodeproj/project.xcworkspace/xcuserdata/Artur_Kalach.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  17. package/ios/A11yOrder.xcodeproj/xcuserdata/Artur_Kalach.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +40 -0
  18. package/ios/A11yOrder.xcodeproj/xcuserdata/Artur_Kalach.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
  19. package/lib/commonjs/A11yModule/helper.js +21 -0
  20. package/lib/commonjs/A11yModule/helper.js.map +1 -0
  21. package/lib/commonjs/A11yModule/index.js +20 -0
  22. package/lib/commonjs/A11yModule/index.js.map +1 -0
  23. package/lib/commonjs/A11yModule/module.js +24 -0
  24. package/lib/commonjs/A11yModule/module.js.map +1 -0
  25. package/lib/commonjs/components/A11yOrder/A11yOrder.js +32 -0
  26. package/lib/commonjs/components/A11yOrder/A11yOrder.js.map +1 -0
  27. package/lib/commonjs/components/A11yOrder/A11yOrder.types.js +6 -0
  28. package/lib/commonjs/components/A11yOrder/A11yOrder.types.js.map +1 -0
  29. package/lib/commonjs/components/A11yOrder/index.js +13 -0
  30. package/lib/commonjs/components/A11yOrder/index.js.map +1 -0
  31. package/lib/commonjs/components/index.js +13 -0
  32. package/lib/commonjs/components/index.js.map +1 -0
  33. package/lib/commonjs/hooks/index.js +27 -0
  34. package/lib/commonjs/hooks/index.js.map +1 -0
  35. package/lib/commonjs/hooks/useA11yOrderManager/index.js +13 -0
  36. package/lib/commonjs/hooks/useA11yOrderManager/index.js.map +1 -0
  37. package/lib/commonjs/hooks/useA11yOrderManager/useA11yOrderManager.js +66 -0
  38. package/lib/commonjs/hooks/useA11yOrderManager/useA11yOrderManager.js.map +1 -0
  39. package/lib/commonjs/hooks/useDynamicFocusOrder/index.js +20 -0
  40. package/lib/commonjs/hooks/useDynamicFocusOrder/index.js.map +1 -0
  41. package/lib/commonjs/hooks/useDynamicFocusOrder/useDynamicFocusOrder.js +29 -0
  42. package/lib/commonjs/hooks/useDynamicFocusOrder/useDynamicFocusOrder.js.map +1 -0
  43. package/lib/commonjs/hooks/useDynamicFocusOrder/useDynamicFocusOrder.types.js +6 -0
  44. package/lib/commonjs/hooks/useDynamicFocusOrder/useDynamicFocusOrder.types.js.map +1 -0
  45. package/lib/commonjs/hooks/useFocusOrder/index.js +13 -0
  46. package/lib/commonjs/hooks/useFocusOrder/index.js.map +1 -0
  47. package/lib/commonjs/hooks/useFocusOrder/useFocusOrder.js +25 -0
  48. package/lib/commonjs/hooks/useFocusOrder/useFocusOrder.js.map +1 -0
  49. package/lib/commonjs/hooks/useFocusOrder/useFocusOrder.types.js +6 -0
  50. package/lib/commonjs/hooks/useFocusOrder/useFocusOrder.types.js.map +1 -0
  51. package/lib/commonjs/index.js +32 -0
  52. package/lib/commonjs/index.js.map +1 -0
  53. package/lib/commonjs/nativeSpecs/NativeA11yOrder.js +10 -0
  54. package/lib/commonjs/nativeSpecs/NativeA11yOrder.js.map +1 -0
  55. package/lib/module/A11yModule/helper.js +14 -0
  56. package/lib/module/A11yModule/helper.js.map +1 -0
  57. package/lib/module/A11yModule/index.js +3 -0
  58. package/lib/module/A11yModule/index.js.map +1 -0
  59. package/lib/module/A11yModule/module.js +18 -0
  60. package/lib/module/A11yModule/module.js.map +1 -0
  61. package/lib/module/components/A11yOrder/A11yOrder.js +23 -0
  62. package/lib/module/components/A11yOrder/A11yOrder.js.map +1 -0
  63. package/lib/module/components/A11yOrder/A11yOrder.types.js +2 -0
  64. package/lib/module/components/A11yOrder/A11yOrder.types.js.map +1 -0
  65. package/lib/module/components/A11yOrder/index.js +2 -0
  66. package/lib/module/components/A11yOrder/index.js.map +1 -0
  67. package/lib/module/components/index.js +2 -0
  68. package/lib/module/components/index.js.map +1 -0
  69. package/lib/module/hooks/index.js +4 -0
  70. package/lib/module/hooks/index.js.map +1 -0
  71. package/lib/module/hooks/useA11yOrderManager/index.js +2 -0
  72. package/lib/module/hooks/useA11yOrderManager/index.js.map +1 -0
  73. package/lib/module/hooks/useA11yOrderManager/useA11yOrderManager.js +58 -0
  74. package/lib/module/hooks/useA11yOrderManager/useA11yOrderManager.js.map +1 -0
  75. package/lib/module/hooks/useDynamicFocusOrder/index.js +3 -0
  76. package/lib/module/hooks/useDynamicFocusOrder/index.js.map +1 -0
  77. package/lib/module/hooks/useDynamicFocusOrder/useDynamicFocusOrder.js +22 -0
  78. package/lib/module/hooks/useDynamicFocusOrder/useDynamicFocusOrder.js.map +1 -0
  79. package/lib/module/hooks/useDynamicFocusOrder/useDynamicFocusOrder.types.js +2 -0
  80. package/lib/module/hooks/useDynamicFocusOrder/useDynamicFocusOrder.types.js.map +1 -0
  81. package/lib/module/hooks/useFocusOrder/index.js +2 -0
  82. package/lib/module/hooks/useFocusOrder/index.js.map +1 -0
  83. package/lib/module/hooks/useFocusOrder/useFocusOrder.js +18 -0
  84. package/lib/module/hooks/useFocusOrder/useFocusOrder.js.map +1 -0
  85. package/lib/module/hooks/useFocusOrder/useFocusOrder.types.js +2 -0
  86. package/lib/module/hooks/useFocusOrder/useFocusOrder.types.js.map +1 -0
  87. package/lib/module/index.js +3 -0
  88. package/lib/module/index.js.map +1 -0
  89. package/lib/module/nativeSpecs/NativeA11yOrder.js +3 -0
  90. package/lib/module/nativeSpecs/NativeA11yOrder.js.map +1 -0
  91. package/lib/typescript/A11yModule/helper.d.ts +8 -0
  92. package/lib/typescript/A11yModule/helper.d.ts.map +1 -0
  93. package/lib/typescript/A11yModule/index.d.ts +3 -0
  94. package/lib/typescript/A11yModule/index.d.ts.map +1 -0
  95. package/lib/typescript/A11yModule/module.d.ts +2 -0
  96. package/lib/typescript/A11yModule/module.d.ts.map +1 -0
  97. package/lib/typescript/components/A11yOrder/A11yOrder.d.ts +4 -0
  98. package/lib/typescript/components/A11yOrder/A11yOrder.d.ts.map +1 -0
  99. package/lib/typescript/components/A11yOrder/A11yOrder.types.d.ts +9 -0
  100. package/lib/typescript/components/A11yOrder/A11yOrder.types.d.ts.map +1 -0
  101. package/lib/typescript/components/A11yOrder/index.d.ts +2 -0
  102. package/lib/typescript/components/A11yOrder/index.d.ts.map +1 -0
  103. package/lib/typescript/components/index.d.ts +2 -0
  104. package/lib/typescript/components/index.d.ts.map +1 -0
  105. package/lib/typescript/hooks/index.d.ts +4 -0
  106. package/lib/typescript/hooks/index.d.ts.map +1 -0
  107. package/lib/typescript/hooks/useA11yOrderManager/index.d.ts +2 -0
  108. package/lib/typescript/hooks/useA11yOrderManager/index.d.ts.map +1 -0
  109. package/lib/typescript/hooks/useA11yOrderManager/useA11yOrderManager.d.ts +11 -0
  110. package/lib/typescript/hooks/useA11yOrderManager/useA11yOrderManager.d.ts.map +1 -0
  111. package/lib/typescript/hooks/useDynamicFocusOrder/index.d.ts +3 -0
  112. package/lib/typescript/hooks/useDynamicFocusOrder/index.d.ts.map +1 -0
  113. package/lib/typescript/hooks/useDynamicFocusOrder/useDynamicFocusOrder.d.ts +5 -0
  114. package/lib/typescript/hooks/useDynamicFocusOrder/useDynamicFocusOrder.d.ts.map +1 -0
  115. package/lib/typescript/hooks/useDynamicFocusOrder/useDynamicFocusOrder.types.d.ts +12 -0
  116. package/lib/typescript/hooks/useDynamicFocusOrder/useDynamicFocusOrder.types.d.ts.map +1 -0
  117. package/lib/typescript/hooks/useFocusOrder/index.d.ts +2 -0
  118. package/lib/typescript/hooks/useFocusOrder/index.d.ts.map +1 -0
  119. package/lib/typescript/hooks/useFocusOrder/useFocusOrder.d.ts +5 -0
  120. package/lib/typescript/hooks/useFocusOrder/useFocusOrder.d.ts.map +1 -0
  121. package/lib/typescript/hooks/useFocusOrder/useFocusOrder.types.d.ts +6 -0
  122. package/lib/typescript/hooks/useFocusOrder/useFocusOrder.types.d.ts.map +1 -0
  123. package/lib/typescript/index.d.ts +3 -0
  124. package/lib/typescript/index.d.ts.map +1 -0
  125. package/lib/typescript/nativeSpecs/NativeA11yOrder.d.ts +7 -0
  126. package/lib/typescript/nativeSpecs/NativeA11yOrder.d.ts.map +1 -0
  127. package/package.json +165 -0
  128. package/react-native-a11y-order.podspec +35 -0
  129. package/src/A11yModule/helper.ts +26 -0
  130. package/src/A11yModule/index.tsx +2 -0
  131. package/src/A11yModule/module.ts +32 -0
  132. package/src/components/A11yOrder/A11yOrder.tsx +28 -0
  133. package/src/components/A11yOrder/A11yOrder.types.ts +8 -0
  134. package/src/components/A11yOrder/index.ts +1 -0
  135. package/src/components/index.ts +1 -0
  136. package/src/hooks/index.ts +3 -0
  137. package/src/hooks/useA11yOrderManager/index.ts +1 -0
  138. package/src/hooks/useA11yOrderManager/useA11yOrderManager.ts +78 -0
  139. package/src/hooks/useDynamicFocusOrder/index.ts +2 -0
  140. package/src/hooks/useDynamicFocusOrder/useDynamicFocusOrder.ts +30 -0
  141. package/src/hooks/useDynamicFocusOrder/useDynamicFocusOrder.types.ts +12 -0
  142. package/src/hooks/useFocusOrder/index.ts +1 -0
  143. package/src/hooks/useFocusOrder/useFocusOrder.ts +25 -0
  144. package/src/hooks/useFocusOrder/useFocusOrder.types.ts +9 -0
  145. package/src/index.ts +7 -0
  146. package/src/nativeSpecs/NativeA11yOrder.ts +8 -0
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Artur Kalach
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,53 @@
1
+ # React Native A11y Order
2
+
3
+ React Native A11y Order Library for ordering screen reader order.
4
+
5
+
6
+ ## Installation
7
+
8
+ ```sh
9
+ npm install react-native-a11y-order
10
+ ```
11
+
12
+ ## Usage
13
+
14
+ ```js
15
+ import { A11yOrder, useFocusOrder } from 'react-native-a11y-order';
16
+
17
+ // ...
18
+
19
+ export default function App() {
20
+ const { a11yOrder, refs } = useFocusOrder<Text>(3);
21
+
22
+ return (
23
+ <View style={styles.container}>
24
+ <A11yOrder a11yOrder={a11yOrder}>
25
+ <Text style={styles.font} ref={refs[0]}>
26
+ First
27
+ </Text>
28
+ <Text style={styles.font} ref={refs[2]}>
29
+ Third
30
+ </Text>
31
+ <Text style={styles.font} ref={refs[1]}>
32
+ Second
33
+ </Text>
34
+ </A11yOrder>
35
+ <Text style={styles.font}>Four</Text>
36
+ <Text style={styles.font}>Five</Text>
37
+ <Text style={styles.font}>Six</Text>
38
+ </View>
39
+ );
40
+ }
41
+ ```
42
+
43
+ ## Contributing
44
+
45
+ See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
46
+
47
+ ## License
48
+
49
+ MIT
50
+
51
+ ---
52
+
53
+ Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
@@ -0,0 +1,90 @@
1
+ buildscript {
2
+ repositories {
3
+ google()
4
+ mavenCentral()
5
+ }
6
+
7
+ dependencies {
8
+ classpath "com.android.tools.build:gradle:7.2.1"
9
+ }
10
+ }
11
+
12
+ def isNewArchitectureEnabled() {
13
+ return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
14
+ }
15
+
16
+ apply plugin: "com.android.library"
17
+
18
+
19
+ def appProject = rootProject.allprojects.find { it.plugins.hasPlugin('com.android.application') }
20
+
21
+ if (isNewArchitectureEnabled()) {
22
+ apply plugin: "com.facebook.react"
23
+ }
24
+
25
+ def getExtOrDefault(name) {
26
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["A11yOrder_" + name]
27
+ }
28
+
29
+ def getExtOrIntegerDefault(name) {
30
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["A11yOrder_" + name]).toInteger()
31
+ }
32
+
33
+ android {
34
+ compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
35
+
36
+ defaultConfig {
37
+ minSdkVersion getExtOrIntegerDefault("minSdkVersion")
38
+ targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
39
+ buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
40
+ }
41
+ buildTypes {
42
+ release {
43
+ minifyEnabled false
44
+ }
45
+ }
46
+
47
+ lintOptions {
48
+ disable "GradleCompatible"
49
+ }
50
+
51
+ compileOptions {
52
+ sourceCompatibility JavaVersion.VERSION_1_8
53
+ targetCompatibility JavaVersion.VERSION_1_8
54
+ }
55
+
56
+ sourceSets {
57
+ main {
58
+ if (isNewArchitectureEnabled()) {
59
+ java.srcDirs += [
60
+ "src/newarch",
61
+ // This is needed to build Kotlin project with NewArch enabled
62
+ "${project.buildDir}/generated/source/codegen/java"
63
+ ]
64
+ } else {
65
+ java.srcDirs += ["src/oldarch"]
66
+ }
67
+ }
68
+ }
69
+ }
70
+
71
+ repositories {
72
+ mavenCentral()
73
+ google()
74
+ }
75
+
76
+
77
+ dependencies {
78
+ // For < 0.71, this will be from the local maven repo
79
+ // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
80
+ //noinspection GradleDynamicVersion
81
+ implementation "com.facebook.react:react-native:+"
82
+ }
83
+
84
+ if (isNewArchitectureEnabled()) {
85
+ react {
86
+ jsRootDir = file("../src/")
87
+ libraryName = "A11yOrder"
88
+ codegenJavaPackageName = "com.a11yorder"
89
+ }
90
+ }
@@ -0,0 +1,5 @@
1
+ A11yOrder_kotlinVersion=1.7.0
2
+ A11yOrder_minSdkVersion=21
3
+ A11yOrder_targetSdkVersion=31
4
+ A11yOrder_compileSdkVersion=31
5
+ A11yOrder_ndkversion=21.4.7075529
@@ -0,0 +1,4 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+ package="com.a11yorder">
3
+
4
+ </manifest>
@@ -0,0 +1,83 @@
1
+ package com.a11yorder;
2
+
3
+ import static com.facebook.react.uimanager.common.UIManagerType.FABRIC;
4
+
5
+ import android.app.Activity;
6
+ import android.os.Build;
7
+ import android.util.Log;
8
+ import android.view.View;
9
+
10
+ import androidx.annotation.NonNull;
11
+
12
+ import com.facebook.react.bridge.ReactApplicationContext;
13
+ import com.facebook.react.bridge.ReactMethod;
14
+ import com.facebook.react.bridge.ReadableArray;
15
+ import com.facebook.react.bridge.UIManager;
16
+ import com.facebook.react.uimanager.IllegalViewOperationException;
17
+ import com.facebook.react.uimanager.UIManagerHelper;
18
+ import com.facebook.react.uimanager.UIManagerModule;
19
+ import com.facebook.react.uimanager.common.ViewUtil;
20
+
21
+ import java.util.ArrayList;
22
+
23
+ public class A11yOrderModule extends A11yOrderSpec {
24
+ public static final String NAME = "A11yOrder";
25
+ private ReactApplicationContext context;
26
+ A11yOrderModule(ReactApplicationContext context) {
27
+ super(context);
28
+ this.context = context;
29
+ }
30
+
31
+
32
+ @Override
33
+ @NonNull
34
+ public String getName() {
35
+ return NAME;
36
+ }
37
+
38
+
39
+ @ReactMethod
40
+ public void setA11yOrder(@NonNull ReadableArray reactTags, Double nativeTag) {
41
+ final int length = reactTags.size();
42
+ if (length < 2) return;
43
+
44
+
45
+ final Activity activity = context.getCurrentActivity();
46
+
47
+ if (activity == null) {
48
+ return;
49
+ }
50
+
51
+ activity.runOnUiThread(() -> {
52
+ UIManager manager = null;
53
+ try {
54
+ int uiManagerType = ViewUtil.getUIManagerType(reactTags.getInt(0));
55
+ if (uiManagerType == FABRIC) {
56
+ manager = UIManagerHelper.getUIManager(context, uiManagerType);
57
+ } else {
58
+ manager = context.getNativeModule(UIManagerModule.class);
59
+ }
60
+ final ArrayList<View> views = new ArrayList<>();
61
+ for (int i = 0; i < length; i++) {
62
+ try {
63
+ views.add(manager.resolveView(reactTags.getInt(i)));
64
+ } catch (IllegalViewOperationException error) {
65
+ Log.e("ERROR", error.getMessage());
66
+ }
67
+ }
68
+ for (int i = 0; i < views.size() - 1; i++) {
69
+ final View currentView = views.get(i);
70
+ final View nextView = views.get(i + 1);
71
+ currentView.setNextFocusForwardId(nextView.getId());
72
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
73
+ currentView.setAccessibilityTraversalBefore(nextView.getId());
74
+ }
75
+ }
76
+ } catch (IllegalViewOperationException error) {
77
+ Log.e("ORDER_FOCUS_ERROR", error.getMessage());
78
+ }
79
+ });
80
+
81
+ }
82
+
83
+ }
@@ -0,0 +1,45 @@
1
+ package com.a11yorder;
2
+
3
+ import androidx.annotation.Nullable;
4
+
5
+ import com.facebook.react.bridge.NativeModule;
6
+ import com.facebook.react.bridge.ReactApplicationContext;
7
+ import com.facebook.react.module.model.ReactModuleInfo;
8
+ import com.facebook.react.module.model.ReactModuleInfoProvider;
9
+ import com.facebook.react.TurboReactPackage;
10
+
11
+ import java.util.HashMap;
12
+ import java.util.Map;
13
+
14
+ public class A11yOrderPackage extends TurboReactPackage {
15
+
16
+ @Nullable
17
+ @Override
18
+ public NativeModule getModule(String name, ReactApplicationContext reactContext) {
19
+ if (name.equals(A11yOrderModule.NAME)) {
20
+ return new A11yOrderModule(reactContext);
21
+ } else {
22
+ return null;
23
+ }
24
+ }
25
+
26
+ @Override
27
+ public ReactModuleInfoProvider getReactModuleInfoProvider() {
28
+ return () -> {
29
+ final Map<String, ReactModuleInfo> moduleInfos = new HashMap<>();
30
+ boolean isTurboModule = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
31
+ moduleInfos.put(
32
+ A11yOrderModule.NAME,
33
+ new ReactModuleInfo(
34
+ A11yOrderModule.NAME,
35
+ A11yOrderModule.NAME,
36
+ false, // canOverrideExistingModule
37
+ false, // needsEagerInit
38
+ true, // hasConstants
39
+ false, // isCxxModule
40
+ isTurboModule // isTurboModule
41
+ ));
42
+ return moduleInfos;
43
+ };
44
+ }
45
+ }
@@ -0,0 +1,9 @@
1
+ package com.a11yorder;
2
+
3
+ import com.facebook.react.bridge.ReactApplicationContext;
4
+
5
+ abstract class A11yOrderSpec extends NativeA11yOrderSpec {
6
+ A11yOrderSpec(ReactApplicationContext context) {
7
+ super(context);
8
+ }
9
+ }
@@ -0,0 +1,15 @@
1
+ package com.a11yorder;
2
+
3
+ import androidx.annotation.NonNull;
4
+
5
+ import com.facebook.react.bridge.ReactApplicationContext;
6
+ import com.facebook.react.bridge.ReactContextBaseJavaModule;
7
+ import com.facebook.react.bridge.ReadableArray;
8
+
9
+ public abstract class A11yOrderSpec extends ReactContextBaseJavaModule {
10
+ A11yOrderSpec(ReactApplicationContext context) {
11
+ super(context);
12
+ }
13
+
14
+ public abstract void setA11yOrder(@NonNull ReadableArray reactTags, Double _tag);
15
+ }
@@ -0,0 +1,3 @@
1
+ //
2
+ // Use this file to import your target's public headers that you would like to expose to Swift.
3
+ //
@@ -0,0 +1,6 @@
1
+ #import <React/RCTBridgeModule.h>
2
+ #import <React/RCTEventEmitter.h>
3
+
4
+ @interface A11yOrder : RCTEventEmitter <RCTBridgeModule>
5
+
6
+ @end
@@ -0,0 +1,72 @@
1
+ #import "A11yOrder.h"
2
+ #import <React/RCTLog.h>
3
+ #import <UIKit/UIKit.h>
4
+ #import <React/RCTUIManager.h>
5
+
6
+
7
+ #ifdef RCT_NEW_ARCH_ENABLED
8
+ #import "A11yOrderSpec/A11yOrderSpec.h"
9
+ using namespace facebook::react;
10
+
11
+ #endif
12
+
13
+ @implementation A11yOrder
14
+ {
15
+ bool hasListeners;
16
+ }
17
+
18
+ RCT_EXPORT_MODULE()
19
+
20
+ -(void)startObserving {
21
+ hasListeners = YES;
22
+ }
23
+
24
+ -(void)stopObserving {
25
+ hasListeners = NO;
26
+ }
27
+
28
+ - (NSArray<NSString *> *)supportedEvents
29
+ {
30
+ return @[];
31
+ }
32
+
33
+
34
+ RCT_EXPORT_METHOD(
35
+ setA11yOrder: (nonnull NSArray *)elements
36
+ node:(nonnull NSNumber *)node
37
+ ) {
38
+ dispatch_async(dispatch_get_main_queue(), ^{
39
+ UIView *field = [self.bridge.uiManager viewForReactTag:node];
40
+ if(field != nil) {
41
+ UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, field); // ToDo, make this optional
42
+ }
43
+ NSMutableArray *fields = [NSMutableArray arrayWithCapacity:[elements count]];
44
+
45
+ [elements enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL * stop) {
46
+ NSNumber *tag = (NSNumber *)obj;
47
+ UIView *field = [self.bridge.uiManager viewForReactTag:tag];
48
+ if (field != nil) {
49
+ [fields addObject:field];
50
+ }
51
+ }];
52
+ [field setAccessibilityElements: fields];
53
+ });
54
+ }
55
+
56
+
57
+ + (BOOL)requiresMainQueueSetup
58
+ {
59
+ return YES;
60
+ }
61
+
62
+
63
+ // Don't compile this code when we build for the old architecture.
64
+ #ifdef RCT_NEW_ARCH_ENABLED
65
+ - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
66
+ (const facebook::react::ObjCTurboModule::InitParams &)params
67
+ {
68
+ return std::make_shared<facebook::react::NativeA11yOrderSpecJSI>(params);
69
+ }
70
+ #endif
71
+
72
+ @end
@@ -0,0 +1,281 @@
1
+ // !$*UTF8*$!
2
+ {
3
+ archiveVersion = 1;
4
+ classes = {
5
+ };
6
+ objectVersion = 46;
7
+ objects = {
8
+
9
+ /* Begin PBXCopyFilesBuildPhase section */
10
+ 58B511D91A9E6C8500147676 /* CopyFiles */ = {
11
+ isa = PBXCopyFilesBuildPhase;
12
+ buildActionMask = 2147483647;
13
+ dstPath = "include/$(PRODUCT_NAME)";
14
+ dstSubfolderSpec = 16;
15
+ files = (
16
+ );
17
+ runOnlyForDeploymentPostprocessing = 0;
18
+ };
19
+ /* End PBXCopyFilesBuildPhase section */
20
+
21
+ /* Begin PBXFileReference section */
22
+ 134814201AA4EA6300B7C361 /* libA11yOrder.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libA11yOrder.a; sourceTree = BUILT_PRODUCTS_DIR; };
23
+ 49BCF4A12A10FE3E00AAB9D7 /* A11yOrder-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "A11yOrder-Bridging-Header.h"; sourceTree = "<group>"; };
24
+ B3E7B5881CC2AC0600A0062D /* A11yOrder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = A11yOrder.h; sourceTree = "<group>"; };
25
+ B3E7B5891CC2AC0600A0062D /* A11yOrder.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = A11yOrder.mm; sourceTree = "<group>"; };
26
+ /* End PBXFileReference section */
27
+
28
+ /* Begin PBXFrameworksBuildPhase section */
29
+ 58B511D81A9E6C8500147676 /* Frameworks */ = {
30
+ isa = PBXFrameworksBuildPhase;
31
+ buildActionMask = 2147483647;
32
+ files = (
33
+ );
34
+ runOnlyForDeploymentPostprocessing = 0;
35
+ };
36
+ /* End PBXFrameworksBuildPhase section */
37
+
38
+ /* Begin PBXGroup section */
39
+ 134814211AA4EA7D00B7C361 /* Products */ = {
40
+ isa = PBXGroup;
41
+ children = (
42
+ 134814201AA4EA6300B7C361 /* libA11yOrder.a */,
43
+ );
44
+ name = Products;
45
+ sourceTree = "<group>";
46
+ };
47
+ 58B511D21A9E6C8500147676 = {
48
+ isa = PBXGroup;
49
+ children = (
50
+ B3E7B5881CC2AC0600A0062D /* A11yOrder.h */,
51
+ B3E7B5891CC2AC0600A0062D /* A11yOrder.mm */,
52
+ 134814211AA4EA7D00B7C361 /* Products */,
53
+ 49BCF4A12A10FE3E00AAB9D7 /* A11yOrder-Bridging-Header.h */,
54
+ );
55
+ sourceTree = "<group>";
56
+ };
57
+ /* End PBXGroup section */
58
+
59
+ /* Begin PBXNativeTarget section */
60
+ 58B511DA1A9E6C8500147676 /* A11yOrder */ = {
61
+ isa = PBXNativeTarget;
62
+ buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "A11yOrder" */;
63
+ buildPhases = (
64
+ 58B511D71A9E6C8500147676 /* Sources */,
65
+ 58B511D81A9E6C8500147676 /* Frameworks */,
66
+ 58B511D91A9E6C8500147676 /* CopyFiles */,
67
+ );
68
+ buildRules = (
69
+ );
70
+ dependencies = (
71
+ );
72
+ name = A11yOrder;
73
+ productName = RCTDataManager;
74
+ productReference = 134814201AA4EA6300B7C361 /* libA11yOrder.a */;
75
+ productType = "com.apple.product-type.library.static";
76
+ };
77
+ /* End PBXNativeTarget section */
78
+
79
+ /* Begin PBXProject section */
80
+ 58B511D31A9E6C8500147676 /* Project object */ = {
81
+ isa = PBXProject;
82
+ attributes = {
83
+ LastUpgradeCheck = 0920;
84
+ ORGANIZATIONNAME = Facebook;
85
+ TargetAttributes = {
86
+ 58B511DA1A9E6C8500147676 = {
87
+ CreatedOnToolsVersion = 6.1.1;
88
+ LastSwiftMigration = 1420;
89
+ };
90
+ };
91
+ };
92
+ buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "A11yOrder" */;
93
+ compatibilityVersion = "Xcode 3.2";
94
+ developmentRegion = English;
95
+ hasScannedForEncodings = 0;
96
+ knownRegions = (
97
+ English,
98
+ en,
99
+ );
100
+ mainGroup = 58B511D21A9E6C8500147676;
101
+ productRefGroup = 58B511D21A9E6C8500147676;
102
+ projectDirPath = "";
103
+ projectRoot = "";
104
+ targets = (
105
+ 58B511DA1A9E6C8500147676 /* A11yOrder */,
106
+ );
107
+ };
108
+ /* End PBXProject section */
109
+
110
+ /* Begin PBXSourcesBuildPhase section */
111
+ 58B511D71A9E6C8500147676 /* Sources */ = {
112
+ isa = PBXSourcesBuildPhase;
113
+ buildActionMask = 2147483647;
114
+ files = (
115
+ );
116
+ runOnlyForDeploymentPostprocessing = 0;
117
+ };
118
+ /* End PBXSourcesBuildPhase section */
119
+
120
+ /* Begin XCBuildConfiguration section */
121
+ 58B511ED1A9E6C8500147676 /* Debug */ = {
122
+ isa = XCBuildConfiguration;
123
+ buildSettings = {
124
+ ALWAYS_SEARCH_USER_PATHS = NO;
125
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
126
+ CLANG_CXX_LIBRARY = "libc++";
127
+ CLANG_ENABLE_MODULES = YES;
128
+ CLANG_ENABLE_OBJC_ARC = YES;
129
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
130
+ CLANG_WARN_BOOL_CONVERSION = YES;
131
+ CLANG_WARN_COMMA = YES;
132
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
133
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
134
+ CLANG_WARN_EMPTY_BODY = YES;
135
+ CLANG_WARN_ENUM_CONVERSION = YES;
136
+ CLANG_WARN_INFINITE_RECURSION = YES;
137
+ CLANG_WARN_INT_CONVERSION = YES;
138
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
139
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
140
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
141
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
142
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
143
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
144
+ CLANG_WARN_UNREACHABLE_CODE = YES;
145
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
146
+ COPY_PHASE_STRIP = NO;
147
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
148
+ ENABLE_TESTABILITY = YES;
149
+ "EXCLUDED_ARCHS[sdk=*]" = arm64;
150
+ GCC_C_LANGUAGE_STANDARD = gnu99;
151
+ GCC_DYNAMIC_NO_PIC = NO;
152
+ GCC_NO_COMMON_BLOCKS = YES;
153
+ GCC_OPTIMIZATION_LEVEL = 0;
154
+ GCC_PREPROCESSOR_DEFINITIONS = (
155
+ "DEBUG=1",
156
+ "$(inherited)",
157
+ );
158
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
159
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
160
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
161
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
162
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
163
+ GCC_WARN_UNUSED_FUNCTION = YES;
164
+ GCC_WARN_UNUSED_VARIABLE = YES;
165
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
166
+ MTL_ENABLE_DEBUG_INFO = YES;
167
+ ONLY_ACTIVE_ARCH = YES;
168
+ SDKROOT = iphoneos;
169
+ };
170
+ name = Debug;
171
+ };
172
+ 58B511EE1A9E6C8500147676 /* Release */ = {
173
+ isa = XCBuildConfiguration;
174
+ buildSettings = {
175
+ ALWAYS_SEARCH_USER_PATHS = NO;
176
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
177
+ CLANG_CXX_LIBRARY = "libc++";
178
+ CLANG_ENABLE_MODULES = YES;
179
+ CLANG_ENABLE_OBJC_ARC = YES;
180
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
181
+ CLANG_WARN_BOOL_CONVERSION = YES;
182
+ CLANG_WARN_COMMA = YES;
183
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
184
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
185
+ CLANG_WARN_EMPTY_BODY = YES;
186
+ CLANG_WARN_ENUM_CONVERSION = YES;
187
+ CLANG_WARN_INFINITE_RECURSION = YES;
188
+ CLANG_WARN_INT_CONVERSION = YES;
189
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
190
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
191
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
192
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
193
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
194
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
195
+ CLANG_WARN_UNREACHABLE_CODE = YES;
196
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
197
+ COPY_PHASE_STRIP = YES;
198
+ ENABLE_NS_ASSERTIONS = NO;
199
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
200
+ "EXCLUDED_ARCHS[sdk=*]" = arm64;
201
+ GCC_C_LANGUAGE_STANDARD = gnu99;
202
+ GCC_NO_COMMON_BLOCKS = YES;
203
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
204
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
205
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
206
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
207
+ GCC_WARN_UNUSED_FUNCTION = YES;
208
+ GCC_WARN_UNUSED_VARIABLE = YES;
209
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
210
+ MTL_ENABLE_DEBUG_INFO = NO;
211
+ SDKROOT = iphoneos;
212
+ VALIDATE_PRODUCT = YES;
213
+ };
214
+ name = Release;
215
+ };
216
+ 58B511F01A9E6C8500147676 /* Debug */ = {
217
+ isa = XCBuildConfiguration;
218
+ buildSettings = {
219
+ CLANG_ENABLE_MODULES = YES;
220
+ HEADER_SEARCH_PATHS = (
221
+ "$(inherited)",
222
+ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
223
+ "$(SRCROOT)/../../../React/**",
224
+ "$(SRCROOT)/../../react-native/React/**",
225
+ );
226
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
227
+ LIBRARY_SEARCH_PATHS = "$(inherited)";
228
+ OTHER_LDFLAGS = "-ObjC";
229
+ PRODUCT_NAME = A11yOrder;
230
+ SKIP_INSTALL = YES;
231
+ SWIFT_OBJC_BRIDGING_HEADER = "A11yOrder-Bridging-Header.h";
232
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
233
+ SWIFT_VERSION = 5.0;
234
+ };
235
+ name = Debug;
236
+ };
237
+ 58B511F11A9E6C8500147676 /* Release */ = {
238
+ isa = XCBuildConfiguration;
239
+ buildSettings = {
240
+ CLANG_ENABLE_MODULES = YES;
241
+ HEADER_SEARCH_PATHS = (
242
+ "$(inherited)",
243
+ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
244
+ "$(SRCROOT)/../../../React/**",
245
+ "$(SRCROOT)/../../react-native/React/**",
246
+ );
247
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
248
+ LIBRARY_SEARCH_PATHS = "$(inherited)";
249
+ OTHER_LDFLAGS = "-ObjC";
250
+ PRODUCT_NAME = A11yOrder;
251
+ SKIP_INSTALL = YES;
252
+ SWIFT_OBJC_BRIDGING_HEADER = "A11yOrder-Bridging-Header.h";
253
+ SWIFT_VERSION = 5.0;
254
+ };
255
+ name = Release;
256
+ };
257
+ /* End XCBuildConfiguration section */
258
+
259
+ /* Begin XCConfigurationList section */
260
+ 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "A11yOrder" */ = {
261
+ isa = XCConfigurationList;
262
+ buildConfigurations = (
263
+ 58B511ED1A9E6C8500147676 /* Debug */,
264
+ 58B511EE1A9E6C8500147676 /* Release */,
265
+ );
266
+ defaultConfigurationIsVisible = 0;
267
+ defaultConfigurationName = Release;
268
+ };
269
+ 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "A11yOrder" */ = {
270
+ isa = XCConfigurationList;
271
+ buildConfigurations = (
272
+ 58B511F01A9E6C8500147676 /* Debug */,
273
+ 58B511F11A9E6C8500147676 /* Release */,
274
+ );
275
+ defaultConfigurationIsVisible = 0;
276
+ defaultConfigurationName = Release;
277
+ };
278
+ /* End XCConfigurationList section */
279
+ };
280
+ rootObject = 58B511D31A9E6C8500147676 /* Project object */;
281
+ }