extends ReactViewManager {
7 | public abstract void setOrderKey(T view, @androidx.annotation.Nullable String value);
8 | }
9 |
--------------------------------------------------------------------------------
/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: ['module:metro-react-native-babel-preset'],
3 | };
4 |
--------------------------------------------------------------------------------
/example/.bundle/config:
--------------------------------------------------------------------------------
1 | BUNDLE_PATH: "vendor/bundle"
2 | BUNDLE_FORCE_RUBY_PLATFORM: 1
3 |
--------------------------------------------------------------------------------
/example/.node-version:
--------------------------------------------------------------------------------
1 | 18
2 |
--------------------------------------------------------------------------------
/example/.watchmanconfig:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/example/Gemfile:
--------------------------------------------------------------------------------
1 | source 'https://rubygems.org'
2 |
3 | # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
4 | ruby '>= 2.6.10'
5 |
6 | gem 'cocoapods', '>= 1.11.3'
7 |
--------------------------------------------------------------------------------
/example/Gemfile.lock:
--------------------------------------------------------------------------------
1 | GEM
2 | remote: https://rubygems.org/
3 | specs:
4 | CFPropertyList (3.0.7)
5 | base64
6 | nkf
7 | rexml
8 | activesupport (6.1.7.8)
9 | concurrent-ruby (~> 1.0, >= 1.0.2)
10 | i18n (>= 1.6, < 2)
11 | minitest (>= 5.1)
12 | tzinfo (~> 2.0)
13 | zeitwerk (~> 2.3)
14 | addressable (2.8.7)
15 | public_suffix (>= 2.0.2, < 7.0)
16 | algoliasearch (1.27.5)
17 | httpclient (~> 2.8, >= 2.8.3)
18 | json (>= 1.5.1)
19 | atomos (0.1.3)
20 | base64 (0.2.0)
21 | claide (1.1.0)
22 | cocoapods (1.15.2)
23 | addressable (~> 2.8)
24 | claide (>= 1.0.2, < 2.0)
25 | cocoapods-core (= 1.15.2)
26 | cocoapods-deintegrate (>= 1.0.3, < 2.0)
27 | cocoapods-downloader (>= 2.1, < 3.0)
28 | cocoapods-plugins (>= 1.0.0, < 2.0)
29 | cocoapods-search (>= 1.0.0, < 2.0)
30 | cocoapods-trunk (>= 1.6.0, < 2.0)
31 | cocoapods-try (>= 1.1.0, < 2.0)
32 | colored2 (~> 3.1)
33 | escape (~> 0.0.4)
34 | fourflusher (>= 2.3.0, < 3.0)
35 | gh_inspector (~> 1.0)
36 | molinillo (~> 0.8.0)
37 | nap (~> 1.0)
38 | ruby-macho (>= 2.3.0, < 3.0)
39 | xcodeproj (>= 1.23.0, < 2.0)
40 | cocoapods-core (1.15.2)
41 | activesupport (>= 5.0, < 8)
42 | addressable (~> 2.8)
43 | algoliasearch (~> 1.0)
44 | concurrent-ruby (~> 1.1)
45 | fuzzy_match (~> 2.0.4)
46 | nap (~> 1.0)
47 | netrc (~> 0.11)
48 | public_suffix (~> 4.0)
49 | typhoeus (~> 1.0)
50 | cocoapods-deintegrate (1.0.5)
51 | cocoapods-downloader (2.1)
52 | cocoapods-plugins (1.0.0)
53 | nap
54 | cocoapods-search (1.0.1)
55 | cocoapods-trunk (1.6.0)
56 | nap (>= 0.8, < 2.0)
57 | netrc (~> 0.11)
58 | cocoapods-try (1.2.0)
59 | colored2 (3.1.2)
60 | concurrent-ruby (1.3.3)
61 | escape (0.0.4)
62 | ethon (0.16.0)
63 | ffi (>= 1.15.0)
64 | ffi (1.17.0)
65 | fourflusher (2.3.1)
66 | fuzzy_match (2.0.4)
67 | gh_inspector (1.1.3)
68 | httpclient (2.8.3)
69 | i18n (1.14.5)
70 | concurrent-ruby (~> 1.0)
71 | json (2.7.2)
72 | minitest (5.24.1)
73 | molinillo (0.8.0)
74 | nanaimo (0.3.0)
75 | nap (1.1.0)
76 | netrc (0.11.0)
77 | nkf (0.2.0)
78 | public_suffix (4.0.7)
79 | rexml (3.2.9)
80 | strscan
81 | ruby-macho (2.5.1)
82 | strscan (3.1.0)
83 | typhoeus (1.4.1)
84 | ethon (>= 0.9.0)
85 | tzinfo (2.0.6)
86 | concurrent-ruby (~> 1.0)
87 | xcodeproj (1.24.0)
88 | CFPropertyList (>= 2.3.3, < 4.0)
89 | atomos (~> 0.1.3)
90 | claide (>= 1.0.2, < 2.0)
91 | colored2 (~> 3.1)
92 | nanaimo (~> 0.3.0)
93 | rexml (~> 3.2.4)
94 | zeitwerk (2.6.17)
95 |
96 | PLATFORMS
97 | ruby
98 |
99 | DEPENDENCIES
100 | cocoapods (>= 1.11.3)
101 |
102 | RUBY VERSION
103 | ruby 2.6.10p210
104 |
105 | BUNDLED WITH
106 | 1.17.2
107 |
--------------------------------------------------------------------------------
/example/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: "com.android.application"
2 | apply plugin: "com.facebook.react"
3 |
4 | import com.android.build.OutputFile
5 |
6 | /**
7 | * This is the configuration block to customize your React Native Android app.
8 | * By default you don't need to apply any configuration, just uncomment the lines you need.
9 | */
10 | react {
11 | /* Folders */
12 | // The root of your project, i.e. where "package.json" lives. Default is '..'
13 | // root = file("../")
14 | // The folder where the react-native NPM package is. Default is ../node_modules/react-native
15 | // reactNativeDir = file("../node_modules/react-native")
16 | // The folder where the react-native Codegen package is. Default is ../node_modules/react-native-codegen
17 | // codegenDir = file("../node_modules/react-native-codegen")
18 | // The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
19 | // cliFile = file("../node_modules/react-native/cli.js")
20 |
21 | /* Variants */
22 | // The list of variants to that are debuggable. For those we're going to
23 | // skip the bundling of the JS bundle and the assets. By default is just 'debug'.
24 | // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
25 | // debuggableVariants = ["liteDebug", "prodDebug"]
26 |
27 | /* Bundling */
28 | // A list containing the node command and its flags. Default is just 'node'.
29 | // nodeExecutableAndArgs = ["node"]
30 | //
31 | // The command to run when bundling. By default is 'bundle'
32 | // bundleCommand = "ram-bundle"
33 | //
34 | // The path to the CLI configuration file. Default is empty.
35 | // bundleConfig = file(../rn-cli.config.js)
36 | //
37 | // The name of the generated asset file containing your JS bundle
38 | // bundleAssetName = "MyApplication.android.bundle"
39 | //
40 | // The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
41 | // entryFile = file("../js/MyApplication.android.js")
42 | //
43 | // A list of extra flags to pass to the 'bundle' commands.
44 | // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
45 | // extraPackagerArgs = []
46 |
47 | /* Hermes Commands */
48 | // The hermes compiler command to run. By default it is 'hermesc'
49 | // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
50 | //
51 | // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
52 | // hermesFlags = ["-O", "-output-source-map"]
53 | }
54 |
55 | /**
56 | * Set this to true to create four separate APKs instead of one,
57 | * one for each native architecture. This is useful if you don't
58 | * use App Bundles (https://developer.android.com/guide/app-bundle/)
59 | * and want to have separate APKs to upload to the Play Store.
60 | */
61 | def enableSeparateBuildPerCPUArchitecture = false
62 |
63 | /**
64 | * Set this to true to Run Proguard on Release builds to minify the Java bytecode.
65 | */
66 | def enableProguardInReleaseBuilds = false
67 |
68 | /**
69 | * The preferred build flavor of JavaScriptCore (JSC)
70 | *
71 | * For example, to use the international variant, you can use:
72 | * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
73 | *
74 | * The international variant includes ICU i18n library and necessary data
75 | * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
76 | * give correct results when using with locales other than en-US. Note that
77 | * this variant is about 6MiB larger per architecture than default.
78 | */
79 | def jscFlavor = 'org.webkit:android-jsc:+'
80 |
81 | /**
82 | * Private function to get the list of Native Architectures you want to build.
83 | * This reads the value from reactNativeArchitectures in your gradle.properties
84 | * file and works together with the --active-arch-only flag of react-native run-android.
85 | */
86 | def reactNativeArchitectures() {
87 | def value = project.getProperties().get("reactNativeArchitectures")
88 | return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
89 | }
90 |
91 | android {
92 | ndkVersion rootProject.ext.ndkVersion
93 |
94 | compileSdkVersion rootProject.ext.compileSdkVersion
95 |
96 | namespace "com.a11yorderexample"
97 | defaultConfig {
98 | applicationId "com.a11yorderexample"
99 | minSdkVersion rootProject.ext.minSdkVersion
100 | targetSdkVersion rootProject.ext.targetSdkVersion
101 | versionCode 1
102 | versionName "1.0"
103 | }
104 |
105 | splits {
106 | abi {
107 | reset()
108 | enable enableSeparateBuildPerCPUArchitecture
109 | universalApk false // If true, also generate a universal APK
110 | include (*reactNativeArchitectures())
111 | }
112 | }
113 | signingConfigs {
114 | debug {
115 | storeFile file('debug.keystore')
116 | storePassword 'android'
117 | keyAlias 'androiddebugkey'
118 | keyPassword 'android'
119 | }
120 | }
121 | buildTypes {
122 | debug {
123 | signingConfig signingConfigs.debug
124 | }
125 | release {
126 | // Caution! In production, you need to generate your own keystore file.
127 | // see https://reactnative.dev/docs/signed-apk-android.
128 | signingConfig signingConfigs.debug
129 | minifyEnabled enableProguardInReleaseBuilds
130 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
131 | }
132 | }
133 |
134 | // applicationVariants are e.g. debug, release
135 | applicationVariants.all { variant ->
136 | variant.outputs.each { output ->
137 | // For each separate APK per architecture, set a unique version code as described here:
138 | // https://developer.android.com/studio/build/configure-apk-splits.html
139 | // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
140 | def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
141 | def abi = output.getFilter(OutputFile.ABI)
142 | if (abi != null) { // null for the universal-debug, universal-release variants
143 | output.versionCodeOverride =
144 | defaultConfig.versionCode * 1000 + versionCodes.get(abi)
145 | }
146 |
147 | }
148 | }
149 | }
150 |
151 | dependencies {
152 | // The version of react-native is set by the React Native Gradle Plugin
153 | implementation("com.facebook.react:react-android")
154 |
155 | implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0")
156 |
157 | debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
158 | debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
159 | exclude group:'com.squareup.okhttp3', module:'okhttp'
160 | }
161 |
162 | debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
163 | if (hermesEnabled.toBoolean()) {
164 | implementation("com.facebook.react:hermes-android")
165 | } else {
166 | implementation jscFlavor
167 | }
168 | }
169 |
170 | apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
171 |
--------------------------------------------------------------------------------
/example/android/app/debug.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArturKalach/react-native-a11y-order/4d68235fd01a3417cda52ef2578bddf7face4e76/example/android/app/debug.keystore
--------------------------------------------------------------------------------
/example/android/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
--------------------------------------------------------------------------------
/example/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/example/android/app/src/debug/java/com/a11yorderexample/ReactNativeFlipper.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Meta Platforms, Inc. and affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the LICENSE file in the root
5 | * directory of this source tree.
6 | */
7 | package com.a11yorderexample;
8 |
9 | import android.content.Context;
10 | import com.facebook.flipper.android.AndroidFlipperClient;
11 | import com.facebook.flipper.android.utils.FlipperUtils;
12 | import com.facebook.flipper.core.FlipperClient;
13 | import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin;
14 | import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin;
15 | import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin;
16 | import com.facebook.flipper.plugins.inspector.DescriptorMapping;
17 | import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin;
18 | import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor;
19 | import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
20 | import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
21 | import com.facebook.react.ReactInstanceEventListener;
22 | import com.facebook.react.ReactInstanceManager;
23 | import com.facebook.react.bridge.ReactContext;
24 | import com.facebook.react.modules.network.NetworkingModule;
25 | import okhttp3.OkHttpClient;
26 |
27 | /**
28 | * Class responsible of loading Flipper inside your React Native application. This is the debug
29 | * flavor of it. Here you can add your own plugins and customize the Flipper setup.
30 | */
31 | public class ReactNativeFlipper {
32 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
33 | if (FlipperUtils.shouldEnableFlipper(context)) {
34 | final FlipperClient client = AndroidFlipperClient.getInstance(context);
35 |
36 | client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
37 | client.addPlugin(new DatabasesFlipperPlugin(context));
38 | client.addPlugin(new SharedPreferencesFlipperPlugin(context));
39 | client.addPlugin(CrashReporterPlugin.getInstance());
40 |
41 | NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
42 | NetworkingModule.setCustomClientBuilder(
43 | new NetworkingModule.CustomClientBuilder() {
44 | @Override
45 | public void apply(OkHttpClient.Builder builder) {
46 | builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
47 | }
48 | });
49 | client.addPlugin(networkFlipperPlugin);
50 | client.start();
51 |
52 | // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
53 | // Hence we run if after all native modules have been initialized
54 | ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
55 | if (reactContext == null) {
56 | reactInstanceManager.addReactInstanceEventListener(
57 | new ReactInstanceEventListener() {
58 | @Override
59 | public void onReactContextInitialized(ReactContext reactContext) {
60 | reactInstanceManager.removeReactInstanceEventListener(this);
61 | reactContext.runOnNativeModulesQueueThread(
62 | new Runnable() {
63 | @Override
64 | public void run() {
65 | client.addPlugin(new FrescoFlipperPlugin());
66 | }
67 | });
68 | }
69 | });
70 | } else {
71 | client.addPlugin(new FrescoFlipperPlugin());
72 | }
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
12 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/example/android/app/src/main/java/com/a11yorderexample/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.a11yorderexample;
2 |
3 | import com.facebook.react.ReactActivity;
4 | import com.facebook.react.ReactActivityDelegate;
5 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
6 | import com.facebook.react.defaults.DefaultReactActivityDelegate;
7 |
8 | public class MainActivity extends ReactActivity {
9 |
10 | /**
11 | * Returns the name of the main component registered from JavaScript. This is used to schedule
12 | * rendering of the component.
13 | */
14 | @Override
15 | protected String getMainComponentName() {
16 | return "A11yOrderExample";
17 | }
18 |
19 | /**
20 | * Returns the instance of the {@link ReactActivityDelegate}. Here we use a util class {@link
21 | * DefaultReactActivityDelegate} which allows you to easily enable Fabric and Concurrent React
22 | * (aka React 18) with two boolean flags.
23 | */
24 | @Override
25 | protected ReactActivityDelegate createReactActivityDelegate() {
26 | return new DefaultReactActivityDelegate(
27 | this,
28 | getMainComponentName(),
29 | // If you opted-in for the New Architecture, we enable the Fabric Renderer.
30 | DefaultNewArchitectureEntryPoint.getFabricEnabled(), // fabricEnabled
31 | // If you opted-in for the New Architecture, we enable Concurrent React (i.e. React 18).
32 | DefaultNewArchitectureEntryPoint.getConcurrentReactEnabled() // concurrentRootEnabled
33 | );
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/example/android/app/src/main/java/com/a11yorderexample/MainApplication.java:
--------------------------------------------------------------------------------
1 | package com.a11yorderexample;
2 |
3 | import android.app.Application;
4 | import com.facebook.react.PackageList;
5 | import com.facebook.react.ReactApplication;
6 | import com.facebook.react.ReactNativeHost;
7 | import com.facebook.react.ReactPackage;
8 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
9 | import com.facebook.react.defaults.DefaultReactNativeHost;
10 | import com.facebook.soloader.SoLoader;
11 | import java.util.List;
12 |
13 | public class MainApplication extends Application implements ReactApplication {
14 |
15 | private final ReactNativeHost mReactNativeHost =
16 | new DefaultReactNativeHost(this) {
17 | @Override
18 | public boolean getUseDeveloperSupport() {
19 | return BuildConfig.DEBUG;
20 | }
21 |
22 | @Override
23 | protected List getPackages() {
24 | @SuppressWarnings("UnnecessaryLocalVariable")
25 | List packages = new PackageList(this).getPackages();
26 | // Packages that cannot be autolinked yet can be added manually here, for example:
27 | // packages.add(new MyReactNativePackage());
28 | return packages;
29 | }
30 |
31 | @Override
32 | protected String getJSMainModuleName() {
33 | return "index";
34 | }
35 |
36 | @Override
37 | protected boolean isNewArchEnabled() {
38 | return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
39 | }
40 |
41 | @Override
42 | protected Boolean isHermesEnabled() {
43 | return BuildConfig.IS_HERMES_ENABLED;
44 | }
45 | };
46 |
47 | @Override
48 | public ReactNativeHost getReactNativeHost() {
49 | return mReactNativeHost;
50 | }
51 |
52 | @Override
53 | public void onCreate() {
54 | super.onCreate();
55 | SoLoader.init(this, /* native exopackage */ false);
56 | if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
57 | // If you opted-in for the New Architecture, we load the native entry point for this app.
58 | DefaultNewArchitectureEntryPoint.load();
59 | }
60 | ReactNativeFlipper.initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable/rn_edit_text_material.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
21 |
22 |
23 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArturKalach/react-native-a11y-order/4d68235fd01a3417cda52ef2578bddf7face4e76/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArturKalach/react-native-a11y-order/4d68235fd01a3417cda52ef2578bddf7face4e76/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArturKalach/react-native-a11y-order/4d68235fd01a3417cda52ef2578bddf7face4e76/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArturKalach/react-native-a11y-order/4d68235fd01a3417cda52ef2578bddf7face4e76/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArturKalach/react-native-a11y-order/4d68235fd01a3417cda52ef2578bddf7face4e76/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArturKalach/react-native-a11y-order/4d68235fd01a3417cda52ef2578bddf7face4e76/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArturKalach/react-native-a11y-order/4d68235fd01a3417cda52ef2578bddf7face4e76/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArturKalach/react-native-a11y-order/4d68235fd01a3417cda52ef2578bddf7face4e76/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArturKalach/react-native-a11y-order/4d68235fd01a3417cda52ef2578bddf7face4e76/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArturKalach/react-native-a11y-order/4d68235fd01a3417cda52ef2578bddf7face4e76/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | A11yOrderExample
3 |
4 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/example/android/app/src/release/java/com/a11yorderexample/ReactNativeFlipper.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Meta Platforms, Inc. and affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the LICENSE file in the root
5 | * directory of this source tree.
6 | */
7 | package com.a11yorderexample;
8 |
9 | import android.content.Context;
10 | import com.facebook.react.ReactInstanceManager;
11 |
12 | /**
13 | * Class responsible of loading Flipper inside your React Native application. This is the release
14 | * flavor of it so it's empty as we don't want to load Flipper.
15 | */
16 | public class ReactNativeFlipper {
17 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
18 | // Do nothing as we don't want to initialize Flipper on Release.
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext {
5 | buildToolsVersion = "33.0.0"
6 | minSdkVersion = 21
7 | compileSdkVersion = 33
8 | targetSdkVersion = 33
9 |
10 | // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
11 | ndkVersion = "23.1.7779620"
12 | }
13 | repositories {
14 | google()
15 | mavenCentral()
16 | }
17 | dependencies {
18 | classpath("com.android.tools.build:gradle:7.3.1")
19 | classpath("com.facebook.react:react-native-gradle-plugin")
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx512m -XX:MaxMetaspaceSize=256m
13 | org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
19 |
20 | # AndroidX package structure to make it clearer which packages are bundled with the
21 | # Android operating system, and which are packaged with your app's APK
22 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
23 | android.useAndroidX=true
24 | # Automatically convert third-party libraries to use AndroidX
25 | android.enableJetifier=true
26 |
27 | # Version of flipper SDK to use with React Native
28 | FLIPPER_VERSION=0.125.0
29 |
30 | # Use this property to specify which architecture you want to build.
31 | # You can also override it from the CLI using
32 | # ./gradlew -PreactNativeArchitectures=x86_64
33 | reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
34 |
35 | # Use this property to enable support to the new architecture.
36 | # This will allow you to use TurboModules and the Fabric render in
37 | # your application. You should enable this flag either if you want
38 | # to write custom TurboModules/Fabric components OR use libraries that
39 | # are providing them.
40 | newArchEnabled=false
41 |
42 | # Use this property to enable or disable the Hermes JS engine.
43 | # If set to false, you will be using JSC instead.
44 | hermesEnabled=true
45 |
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArturKalach/react-native-a11y-order/4d68235fd01a3417cda52ef2578bddf7face4e76/example/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/example/android/gradlew:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # Copyright © 2015-2021 the original authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | #
21 | # Gradle start up script for POSIX generated by Gradle.
22 | #
23 | # Important for running:
24 | #
25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
26 | # noncompliant, but you have some other compliant shell such as ksh or
27 | # bash, then to run this script, type that shell name before the whole
28 | # command line, like:
29 | #
30 | # ksh Gradle
31 | #
32 | # Busybox and similar reduced shells will NOT work, because this script
33 | # requires all of these POSIX shell features:
34 | # * functions;
35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37 | # * compound commands having a testable exit status, especially «case»;
38 | # * various built-in commands including «command», «set», and «ulimit».
39 | #
40 | # Important for patching:
41 | #
42 | # (2) This script targets any POSIX shell, so it avoids extensions provided
43 | # by Bash, Ksh, etc; in particular arrays are avoided.
44 | #
45 | # The "traditional" practice of packing multiple parameters into a
46 | # space-separated string is a well documented source of bugs and security
47 | # problems, so this is (mostly) avoided, by progressively accumulating
48 | # options in "$@", and eventually passing that to Java.
49 | #
50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
52 | # see the in-line comments for details.
53 | #
54 | # There are tweaks for specific operating systems such as AIX, CygWin,
55 | # Darwin, MinGW, and NonStop.
56 | #
57 | # (3) This script is generated from the Groovy template
58 | # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59 | # within the Gradle project.
60 | #
61 | # You can find Gradle at https://github.com/gradle/gradle/.
62 | #
63 | ##############################################################################
64 |
65 | # Attempt to set APP_HOME
66 |
67 | # Resolve links: $0 may be a link
68 | app_path=$0
69 |
70 | # Need this for daisy-chained symlinks.
71 | while
72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
73 | [ -h "$app_path" ]
74 | do
75 | ls=$( ls -ld "$app_path" )
76 | link=${ls#*' -> '}
77 | case $link in #(
78 | /*) app_path=$link ;; #(
79 | *) app_path=$APP_HOME$link ;;
80 | esac
81 | done
82 |
83 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
84 |
85 | APP_NAME="Gradle"
86 | APP_BASE_NAME=${0##*/}
87 |
88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
90 |
91 | # Use the maximum available, or set MAX_FD != -1 to use that value.
92 | MAX_FD=maximum
93 |
94 | warn () {
95 | echo "$*"
96 | } >&2
97 |
98 | die () {
99 | echo
100 | echo "$*"
101 | echo
102 | exit 1
103 | } >&2
104 |
105 | # OS specific support (must be 'true' or 'false').
106 | cygwin=false
107 | msys=false
108 | darwin=false
109 | nonstop=false
110 | case "$( uname )" in #(
111 | CYGWIN* ) cygwin=true ;; #(
112 | Darwin* ) darwin=true ;; #(
113 | MSYS* | MINGW* ) msys=true ;; #(
114 | NONSTOP* ) nonstop=true ;;
115 | esac
116 |
117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
118 |
119 |
120 | # Determine the Java command to use to start the JVM.
121 | if [ -n "$JAVA_HOME" ] ; then
122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
123 | # IBM's JDK on AIX uses strange locations for the executables
124 | JAVACMD=$JAVA_HOME/jre/sh/java
125 | else
126 | JAVACMD=$JAVA_HOME/bin/java
127 | fi
128 | if [ ! -x "$JAVACMD" ] ; then
129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
130 |
131 | Please set the JAVA_HOME variable in your environment to match the
132 | location of your Java installation."
133 | fi
134 | else
135 | JAVACMD=java
136 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137 |
138 | Please set the JAVA_HOME variable in your environment to match the
139 | location of your Java installation."
140 | fi
141 |
142 | # Increase the maximum file descriptors if we can.
143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144 | case $MAX_FD in #(
145 | max*)
146 | MAX_FD=$( ulimit -H -n ) ||
147 | warn "Could not query maximum file descriptor limit"
148 | esac
149 | case $MAX_FD in #(
150 | '' | soft) :;; #(
151 | *)
152 | ulimit -n "$MAX_FD" ||
153 | warn "Could not set maximum file descriptor limit to $MAX_FD"
154 | esac
155 | fi
156 |
157 | # Collect all arguments for the java command, stacking in reverse order:
158 | # * args from the command line
159 | # * the main class name
160 | # * -classpath
161 | # * -D...appname settings
162 | # * --module-path (only if needed)
163 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
164 |
165 | # For Cygwin or MSYS, switch paths to Windows format before running java
166 | if "$cygwin" || "$msys" ; then
167 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
168 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
169 |
170 | JAVACMD=$( cygpath --unix "$JAVACMD" )
171 |
172 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
173 | for arg do
174 | if
175 | case $arg in #(
176 | -*) false ;; # don't mess with options #(
177 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
178 | [ -e "$t" ] ;; #(
179 | *) false ;;
180 | esac
181 | then
182 | arg=$( cygpath --path --ignore --mixed "$arg" )
183 | fi
184 | # Roll the args list around exactly as many times as the number of
185 | # args, so each arg winds up back in the position where it started, but
186 | # possibly modified.
187 | #
188 | # NB: a `for` loop captures its iteration list before it begins, so
189 | # changing the positional parameters here affects neither the number of
190 | # iterations, nor the values presented in `arg`.
191 | shift # remove old arg
192 | set -- "$@" "$arg" # push replacement arg
193 | done
194 | fi
195 |
196 | # Collect all arguments for the java command;
197 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
198 | # shell script including quotes and variable substitutions, so put them in
199 | # double quotes to make sure that they get re-expanded; and
200 | # * put everything else in single quotes, so that it's not re-expanded.
201 |
202 | set -- \
203 | "-Dorg.gradle.appname=$APP_BASE_NAME" \
204 | -classpath "$CLASSPATH" \
205 | org.gradle.wrapper.GradleWrapperMain \
206 | "$@"
207 |
208 | # Use "xargs" to parse quoted args.
209 | #
210 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
211 | #
212 | # In Bash we could simply go:
213 | #
214 | # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
215 | # set -- "${ARGS[@]}" "$@"
216 | #
217 | # but POSIX shell has neither arrays nor command substitution, so instead we
218 | # post-process each arg (as a line of input to sed) to backslash-escape any
219 | # character that might be a shell metacharacter, then use eval to reverse
220 | # that process (while maintaining the separation between arguments), and wrap
221 | # the whole thing up as a single "set" statement.
222 | #
223 | # This will of course break if any of these variables contains a newline or
224 | # an unmatched quote.
225 | #
226 |
227 | eval "set -- $(
228 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
229 | xargs -n1 |
230 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
231 | tr '\n' ' '
232 | )" '"$@"'
233 |
234 | exec "$JAVACMD" "$@"
235 |
--------------------------------------------------------------------------------
/example/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'A11yOrderExample'
2 | apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
3 | include ':app'
4 | includeBuild('../node_modules/react-native-gradle-plugin')
5 |
--------------------------------------------------------------------------------
/example/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "A11yOrderExample",
3 | "displayName": "A11yOrderExample"
4 | }
--------------------------------------------------------------------------------
/example/babel.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const pak = require('../package.json');
3 |
4 | module.exports = {
5 | presets: ['module:metro-react-native-babel-preset'],
6 | plugins: [
7 | [
8 | 'module-resolver',
9 | {
10 | extensions: ['.tsx', '.ts', '.js', '.json'],
11 | alias: {
12 | [pak.name]: path.join(__dirname, '..', pak.source),
13 | },
14 | },
15 | ],
16 | ],
17 | };
18 |
--------------------------------------------------------------------------------
/example/index.js:
--------------------------------------------------------------------------------
1 | import { AppRegistry } from 'react-native';
2 | import App from './src/App';
3 | import { name as appName } from './app.json';
4 |
5 | AppRegistry.registerComponent(appName, () => App);
6 |
--------------------------------------------------------------------------------
/example/ios/.xcode.env:
--------------------------------------------------------------------------------
1 | # This `.xcode.env` file is versioned and is used to source the environment
2 | # used when running script phases inside Xcode.
3 | # To customize your local environment, you can create an `.xcode.env.local`
4 | # file that is not versioned.
5 |
6 | # NODE_BINARY variable contains the PATH to the node executable.
7 | #
8 | # Customize the NODE_BINARY variable here.
9 | # For example, to use nvm with brew, add the following line
10 | # . "$(brew --prefix nvm)/nvm.sh" --no-use
11 | export NODE_BINARY=$(command -v node)
12 |
--------------------------------------------------------------------------------
/example/ios/A11yOrderExample-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | //
2 | // Use this file to import your target's public headers that you would like to expose to Swift.
3 | //
4 |
--------------------------------------------------------------------------------
/example/ios/A11yOrderExample.xcodeproj/xcshareddata/xcschemes/A11yOrderExample.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
53 |
55 |
61 |
62 |
63 |
64 |
70 |
72 |
78 |
79 |
80 |
81 |
83 |
84 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/example/ios/A11yOrderExample.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/ios/A11yOrderExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/A11yOrderExample/AppDelegate.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | @interface AppDelegate : RCTAppDelegate
5 |
6 | @end
7 |
--------------------------------------------------------------------------------
/example/ios/A11yOrderExample/AppDelegate.mm:
--------------------------------------------------------------------------------
1 | #import "AppDelegate.h"
2 |
3 | #import
4 |
5 | @implementation AppDelegate
6 |
7 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
8 | {
9 | self.moduleName = @"A11yOrderExample";
10 | // You can add your custom initial props in the dictionary below.
11 | // They will be passed down to the ViewController used by React Native.
12 | self.initialProps = @{};
13 |
14 | return [super application:application didFinishLaunchingWithOptions:launchOptions];
15 | }
16 |
17 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
18 | {
19 | #if DEBUG
20 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
21 | #else
22 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
23 | #endif
24 | }
25 |
26 | /// This method controls whether the `concurrentRoot`feature of React18 is turned on or off.
27 | ///
28 | /// @see: https://reactjs.org/blog/2022/03/29/react-v18.html
29 | /// @note: This requires to be rendering on Fabric (i.e. on the New Architecture).
30 | /// @return: `true` if the `concurrentRoot` feature is enabled. Otherwise, it returns `false`.
31 | - (BOOL)concurrentRootEnabled
32 | {
33 | return true;
34 | }
35 |
36 | @end
37 |
--------------------------------------------------------------------------------
/example/ios/A11yOrderExample/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "scale" : "2x",
6 | "size" : "20x20"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "scale" : "3x",
11 | "size" : "20x20"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "scale" : "2x",
16 | "size" : "29x29"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "scale" : "3x",
21 | "size" : "29x29"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "scale" : "2x",
26 | "size" : "40x40"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "scale" : "3x",
31 | "size" : "40x40"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "scale" : "2x",
36 | "size" : "60x60"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "scale" : "3x",
41 | "size" : "60x60"
42 | },
43 | {
44 | "idiom" : "ios-marketing",
45 | "scale" : "1x",
46 | "size" : "1024x1024"
47 | }
48 | ],
49 | "info" : {
50 | "author" : "xcode",
51 | "version" : 1
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/example/ios/A11yOrderExample/Images.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/example/ios/A11yOrderExample/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | A11yOrderExample
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(MARKETING_VERSION)
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | $(CURRENT_PROJECT_VERSION)
25 | LSRequiresIPhoneOS
26 |
27 | NSAppTransportSecurity
28 |
29 | NSExceptionDomains
30 |
31 | localhost
32 |
33 | NSExceptionAllowsInsecureHTTPLoads
34 |
35 |
36 |
37 |
38 | NSLocationWhenInUseUsageDescription
39 |
40 | UILaunchStoryboardName
41 | LaunchScreen
42 | UIRequiredDeviceCapabilities
43 |
44 | armv7
45 |
46 | UISupportedInterfaceOrientations
47 |
48 | UIInterfaceOrientationPortrait
49 | UIInterfaceOrientationLandscapeLeft
50 | UIInterfaceOrientationLandscapeRight
51 |
52 | UIViewControllerBasedStatusBarAppearance
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/example/ios/A11yOrderExample/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
24 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/example/ios/A11yOrderExample/main.m:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | #import "AppDelegate.h"
4 |
5 | int main(int argc, char *argv[])
6 | {
7 | @autoreleasepool {
8 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/example/ios/A11yOrderExampleTests/A11yOrderExampleTests.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | #import
5 | #import
6 |
7 | #define TIMEOUT_SECONDS 600
8 | #define TEXT_TO_LOOK_FOR @"Welcome to React"
9 |
10 | @interface A11yOrderExampleTests : XCTestCase
11 |
12 | @end
13 |
14 | @implementation A11yOrderExampleTests
15 |
16 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL (^)(UIView *view))test
17 | {
18 | if (test(view)) {
19 | return YES;
20 | }
21 | for (UIView *subview in [view subviews]) {
22 | if ([self findSubviewInView:subview matching:test]) {
23 | return YES;
24 | }
25 | }
26 | return NO;
27 | }
28 |
29 | - (void)testRendersWelcomeScreen
30 | {
31 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController];
32 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
33 | BOOL foundElement = NO;
34 |
35 | __block NSString *redboxError = nil;
36 | #ifdef DEBUG
37 | RCTSetLogFunction(
38 | ^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
39 | if (level >= RCTLogLevelError) {
40 | redboxError = message;
41 | }
42 | });
43 | #endif
44 |
45 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
46 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
47 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
48 |
49 | foundElement = [self findSubviewInView:vc.view
50 | matching:^BOOL(UIView *view) {
51 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
52 | return YES;
53 | }
54 | return NO;
55 | }];
56 | }
57 |
58 | #ifdef DEBUG
59 | RCTSetLogFunction(RCTDefaultLogFunction);
60 | #endif
61 |
62 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
63 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
64 | }
65 |
66 | @end
67 |
--------------------------------------------------------------------------------
/example/ios/A11yOrderExampleTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/example/ios/File.swift:
--------------------------------------------------------------------------------
1 | //
2 | // File.swift
3 | // A11yOrderExample
4 | //
5 |
6 | import Foundation
7 |
--------------------------------------------------------------------------------
/example/ios/Podfile:
--------------------------------------------------------------------------------
1 | require_relative '../node_modules/react-native/scripts/react_native_pods'
2 | require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
3 |
4 | platform :ios, min_ios_version_supported
5 | prepare_react_native_project!
6 |
7 | # If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
8 | # because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
9 | #
10 | # To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
11 | # ```js
12 | # module.exports = {
13 | # dependencies: {
14 | # ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
15 | # ```
16 | flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled
17 |
18 | linkage = ENV['USE_FRAMEWORKS']
19 | if linkage != nil
20 | Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
21 | use_frameworks! :linkage => linkage.to_sym
22 | end
23 |
24 | target 'A11yOrderExample' do
25 | config = use_native_modules!
26 |
27 | # Flags change depending on the env values.
28 | flags = get_default_flags()
29 |
30 | use_react_native!(
31 | :path => config[:reactNativePath],
32 | # Hermes is now enabled by default. Disable by setting this flag to false.
33 | # Upcoming versions of React Native may rely on get_default_flags(), but
34 | # we make it explicit here to aid in the React Native upgrade process.
35 | :hermes_enabled => flags[:hermes_enabled],
36 | :fabric_enabled => flags[:fabric_enabled],
37 | # Enables Flipper.
38 | #
39 | # Note that if you have use_frameworks! enabled, Flipper will not work and
40 | # you should disable the next line.
41 | :flipper_configuration => flipper_config,
42 | # An absolute path to your application root.
43 | :app_path => "#{Pod::Config.instance.installation_root}/.."
44 | )
45 |
46 | target 'A11yOrderExampleTests' do
47 | inherit! :complete
48 | # Pods for testing
49 | end
50 |
51 | post_install do |installer|
52 | react_native_post_install(
53 | installer,
54 | # Set `mac_catalyst_enabled` to `true` in order to apply patches
55 | # necessary for Mac Catalyst builds
56 | :mac_catalyst_enabled => false
57 | )
58 | __apply_Xcode_12_5_M1_post_install_workaround(installer)
59 | end
60 | end
61 |
--------------------------------------------------------------------------------
/example/ios/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - boost (1.76.0)
3 | - CocoaAsyncSocket (7.6.5)
4 | - DoubleConversion (1.1.6)
5 | - FBLazyVector (0.71.8)
6 | - FBReactNativeSpec (0.71.8):
7 | - RCT-Folly (= 2021.07.22.00)
8 | - RCTRequired (= 0.71.8)
9 | - RCTTypeSafety (= 0.71.8)
10 | - React-Core (= 0.71.8)
11 | - React-jsi (= 0.71.8)
12 | - ReactCommon/turbomodule/core (= 0.71.8)
13 | - Flipper (0.125.0):
14 | - Flipper-Folly (~> 2.6)
15 | - Flipper-RSocket (~> 1.4)
16 | - Flipper-Boost-iOSX (1.76.0.1.11)
17 | - Flipper-DoubleConversion (3.2.0.1)
18 | - Flipper-Fmt (7.1.7)
19 | - Flipper-Folly (2.6.10):
20 | - Flipper-Boost-iOSX
21 | - Flipper-DoubleConversion
22 | - Flipper-Fmt (= 7.1.7)
23 | - Flipper-Glog
24 | - libevent (~> 2.1.12)
25 | - OpenSSL-Universal (= 1.1.1100)
26 | - Flipper-Glog (0.5.0.5)
27 | - Flipper-PeerTalk (0.0.4)
28 | - Flipper-RSocket (1.4.3):
29 | - Flipper-Folly (~> 2.6)
30 | - FlipperKit (0.125.0):
31 | - FlipperKit/Core (= 0.125.0)
32 | - FlipperKit/Core (0.125.0):
33 | - Flipper (~> 0.125.0)
34 | - FlipperKit/CppBridge
35 | - FlipperKit/FBCxxFollyDynamicConvert
36 | - FlipperKit/FBDefines
37 | - FlipperKit/FKPortForwarding
38 | - SocketRocket (~> 0.6.0)
39 | - FlipperKit/CppBridge (0.125.0):
40 | - Flipper (~> 0.125.0)
41 | - FlipperKit/FBCxxFollyDynamicConvert (0.125.0):
42 | - Flipper-Folly (~> 2.6)
43 | - FlipperKit/FBDefines (0.125.0)
44 | - FlipperKit/FKPortForwarding (0.125.0):
45 | - CocoaAsyncSocket (~> 7.6)
46 | - Flipper-PeerTalk (~> 0.0.4)
47 | - FlipperKit/FlipperKitHighlightOverlay (0.125.0)
48 | - FlipperKit/FlipperKitLayoutHelpers (0.125.0):
49 | - FlipperKit/Core
50 | - FlipperKit/FlipperKitHighlightOverlay
51 | - FlipperKit/FlipperKitLayoutTextSearchable
52 | - FlipperKit/FlipperKitLayoutIOSDescriptors (0.125.0):
53 | - FlipperKit/Core
54 | - FlipperKit/FlipperKitHighlightOverlay
55 | - FlipperKit/FlipperKitLayoutHelpers
56 | - YogaKit (~> 1.18)
57 | - FlipperKit/FlipperKitLayoutPlugin (0.125.0):
58 | - FlipperKit/Core
59 | - FlipperKit/FlipperKitHighlightOverlay
60 | - FlipperKit/FlipperKitLayoutHelpers
61 | - FlipperKit/FlipperKitLayoutIOSDescriptors
62 | - FlipperKit/FlipperKitLayoutTextSearchable
63 | - YogaKit (~> 1.18)
64 | - FlipperKit/FlipperKitLayoutTextSearchable (0.125.0)
65 | - FlipperKit/FlipperKitNetworkPlugin (0.125.0):
66 | - FlipperKit/Core
67 | - FlipperKit/FlipperKitReactPlugin (0.125.0):
68 | - FlipperKit/Core
69 | - FlipperKit/FlipperKitUserDefaultsPlugin (0.125.0):
70 | - FlipperKit/Core
71 | - FlipperKit/SKIOSNetworkPlugin (0.125.0):
72 | - FlipperKit/Core
73 | - FlipperKit/FlipperKitNetworkPlugin
74 | - fmt (6.2.1)
75 | - glog (0.3.5)
76 | - hermes-engine (0.71.8):
77 | - hermes-engine/Pre-built (= 0.71.8)
78 | - hermes-engine/Pre-built (0.71.8)
79 | - libevent (2.1.12)
80 | - OpenSSL-Universal (1.1.1100)
81 | - RCT-Folly (2021.07.22.00):
82 | - boost
83 | - DoubleConversion
84 | - fmt (~> 6.2.1)
85 | - glog
86 | - RCT-Folly/Default (= 2021.07.22.00)
87 | - RCT-Folly/Default (2021.07.22.00):
88 | - boost
89 | - DoubleConversion
90 | - fmt (~> 6.2.1)
91 | - glog
92 | - RCT-Folly/Futures (2021.07.22.00):
93 | - boost
94 | - DoubleConversion
95 | - fmt (~> 6.2.1)
96 | - glog
97 | - libevent
98 | - RCTRequired (0.71.8)
99 | - RCTTypeSafety (0.71.8):
100 | - FBLazyVector (= 0.71.8)
101 | - RCTRequired (= 0.71.8)
102 | - React-Core (= 0.71.8)
103 | - React (0.71.8):
104 | - React-Core (= 0.71.8)
105 | - React-Core/DevSupport (= 0.71.8)
106 | - React-Core/RCTWebSocket (= 0.71.8)
107 | - React-RCTActionSheet (= 0.71.8)
108 | - React-RCTAnimation (= 0.71.8)
109 | - React-RCTBlob (= 0.71.8)
110 | - React-RCTImage (= 0.71.8)
111 | - React-RCTLinking (= 0.71.8)
112 | - React-RCTNetwork (= 0.71.8)
113 | - React-RCTSettings (= 0.71.8)
114 | - React-RCTText (= 0.71.8)
115 | - React-RCTVibration (= 0.71.8)
116 | - React-callinvoker (0.71.8)
117 | - React-Codegen (0.71.8):
118 | - FBReactNativeSpec
119 | - hermes-engine
120 | - RCT-Folly
121 | - RCTRequired
122 | - RCTTypeSafety
123 | - React-Core
124 | - React-jsi
125 | - React-jsiexecutor
126 | - ReactCommon/turbomodule/bridging
127 | - ReactCommon/turbomodule/core
128 | - React-Core (0.71.8):
129 | - glog
130 | - hermes-engine
131 | - RCT-Folly (= 2021.07.22.00)
132 | - React-Core/Default (= 0.71.8)
133 | - React-cxxreact (= 0.71.8)
134 | - React-hermes
135 | - React-jsi (= 0.71.8)
136 | - React-jsiexecutor (= 0.71.8)
137 | - React-perflogger (= 0.71.8)
138 | - Yoga
139 | - React-Core/CoreModulesHeaders (0.71.8):
140 | - glog
141 | - hermes-engine
142 | - RCT-Folly (= 2021.07.22.00)
143 | - React-Core/Default
144 | - React-cxxreact (= 0.71.8)
145 | - React-hermes
146 | - React-jsi (= 0.71.8)
147 | - React-jsiexecutor (= 0.71.8)
148 | - React-perflogger (= 0.71.8)
149 | - Yoga
150 | - React-Core/Default (0.71.8):
151 | - glog
152 | - hermes-engine
153 | - RCT-Folly (= 2021.07.22.00)
154 | - React-cxxreact (= 0.71.8)
155 | - React-hermes
156 | - React-jsi (= 0.71.8)
157 | - React-jsiexecutor (= 0.71.8)
158 | - React-perflogger (= 0.71.8)
159 | - Yoga
160 | - React-Core/DevSupport (0.71.8):
161 | - glog
162 | - hermes-engine
163 | - RCT-Folly (= 2021.07.22.00)
164 | - React-Core/Default (= 0.71.8)
165 | - React-Core/RCTWebSocket (= 0.71.8)
166 | - React-cxxreact (= 0.71.8)
167 | - React-hermes
168 | - React-jsi (= 0.71.8)
169 | - React-jsiexecutor (= 0.71.8)
170 | - React-jsinspector (= 0.71.8)
171 | - React-perflogger (= 0.71.8)
172 | - Yoga
173 | - React-Core/RCTActionSheetHeaders (0.71.8):
174 | - glog
175 | - hermes-engine
176 | - RCT-Folly (= 2021.07.22.00)
177 | - React-Core/Default
178 | - React-cxxreact (= 0.71.8)
179 | - React-hermes
180 | - React-jsi (= 0.71.8)
181 | - React-jsiexecutor (= 0.71.8)
182 | - React-perflogger (= 0.71.8)
183 | - Yoga
184 | - React-Core/RCTAnimationHeaders (0.71.8):
185 | - glog
186 | - hermes-engine
187 | - RCT-Folly (= 2021.07.22.00)
188 | - React-Core/Default
189 | - React-cxxreact (= 0.71.8)
190 | - React-hermes
191 | - React-jsi (= 0.71.8)
192 | - React-jsiexecutor (= 0.71.8)
193 | - React-perflogger (= 0.71.8)
194 | - Yoga
195 | - React-Core/RCTBlobHeaders (0.71.8):
196 | - glog
197 | - hermes-engine
198 | - RCT-Folly (= 2021.07.22.00)
199 | - React-Core/Default
200 | - React-cxxreact (= 0.71.8)
201 | - React-hermes
202 | - React-jsi (= 0.71.8)
203 | - React-jsiexecutor (= 0.71.8)
204 | - React-perflogger (= 0.71.8)
205 | - Yoga
206 | - React-Core/RCTImageHeaders (0.71.8):
207 | - glog
208 | - hermes-engine
209 | - RCT-Folly (= 2021.07.22.00)
210 | - React-Core/Default
211 | - React-cxxreact (= 0.71.8)
212 | - React-hermes
213 | - React-jsi (= 0.71.8)
214 | - React-jsiexecutor (= 0.71.8)
215 | - React-perflogger (= 0.71.8)
216 | - Yoga
217 | - React-Core/RCTLinkingHeaders (0.71.8):
218 | - glog
219 | - hermes-engine
220 | - RCT-Folly (= 2021.07.22.00)
221 | - React-Core/Default
222 | - React-cxxreact (= 0.71.8)
223 | - React-hermes
224 | - React-jsi (= 0.71.8)
225 | - React-jsiexecutor (= 0.71.8)
226 | - React-perflogger (= 0.71.8)
227 | - Yoga
228 | - React-Core/RCTNetworkHeaders (0.71.8):
229 | - glog
230 | - hermes-engine
231 | - RCT-Folly (= 2021.07.22.00)
232 | - React-Core/Default
233 | - React-cxxreact (= 0.71.8)
234 | - React-hermes
235 | - React-jsi (= 0.71.8)
236 | - React-jsiexecutor (= 0.71.8)
237 | - React-perflogger (= 0.71.8)
238 | - Yoga
239 | - React-Core/RCTSettingsHeaders (0.71.8):
240 | - glog
241 | - hermes-engine
242 | - RCT-Folly (= 2021.07.22.00)
243 | - React-Core/Default
244 | - React-cxxreact (= 0.71.8)
245 | - React-hermes
246 | - React-jsi (= 0.71.8)
247 | - React-jsiexecutor (= 0.71.8)
248 | - React-perflogger (= 0.71.8)
249 | - Yoga
250 | - React-Core/RCTTextHeaders (0.71.8):
251 | - glog
252 | - hermes-engine
253 | - RCT-Folly (= 2021.07.22.00)
254 | - React-Core/Default
255 | - React-cxxreact (= 0.71.8)
256 | - React-hermes
257 | - React-jsi (= 0.71.8)
258 | - React-jsiexecutor (= 0.71.8)
259 | - React-perflogger (= 0.71.8)
260 | - Yoga
261 | - React-Core/RCTVibrationHeaders (0.71.8):
262 | - glog
263 | - hermes-engine
264 | - RCT-Folly (= 2021.07.22.00)
265 | - React-Core/Default
266 | - React-cxxreact (= 0.71.8)
267 | - React-hermes
268 | - React-jsi (= 0.71.8)
269 | - React-jsiexecutor (= 0.71.8)
270 | - React-perflogger (= 0.71.8)
271 | - Yoga
272 | - React-Core/RCTWebSocket (0.71.8):
273 | - glog
274 | - hermes-engine
275 | - RCT-Folly (= 2021.07.22.00)
276 | - React-Core/Default (= 0.71.8)
277 | - React-cxxreact (= 0.71.8)
278 | - React-hermes
279 | - React-jsi (= 0.71.8)
280 | - React-jsiexecutor (= 0.71.8)
281 | - React-perflogger (= 0.71.8)
282 | - Yoga
283 | - React-CoreModules (0.71.8):
284 | - RCT-Folly (= 2021.07.22.00)
285 | - RCTTypeSafety (= 0.71.8)
286 | - React-Codegen (= 0.71.8)
287 | - React-Core/CoreModulesHeaders (= 0.71.8)
288 | - React-jsi (= 0.71.8)
289 | - React-RCTBlob
290 | - React-RCTImage (= 0.71.8)
291 | - ReactCommon/turbomodule/core (= 0.71.8)
292 | - React-cxxreact (0.71.8):
293 | - boost (= 1.76.0)
294 | - DoubleConversion
295 | - glog
296 | - hermes-engine
297 | - RCT-Folly (= 2021.07.22.00)
298 | - React-callinvoker (= 0.71.8)
299 | - React-jsi (= 0.71.8)
300 | - React-jsinspector (= 0.71.8)
301 | - React-logger (= 0.71.8)
302 | - React-perflogger (= 0.71.8)
303 | - React-runtimeexecutor (= 0.71.8)
304 | - React-hermes (0.71.8):
305 | - DoubleConversion
306 | - glog
307 | - hermes-engine
308 | - RCT-Folly (= 2021.07.22.00)
309 | - RCT-Folly/Futures (= 2021.07.22.00)
310 | - React-cxxreact (= 0.71.8)
311 | - React-jsi
312 | - React-jsiexecutor (= 0.71.8)
313 | - React-jsinspector (= 0.71.8)
314 | - React-perflogger (= 0.71.8)
315 | - React-jsi (0.71.8):
316 | - boost (= 1.76.0)
317 | - DoubleConversion
318 | - glog
319 | - hermes-engine
320 | - RCT-Folly (= 2021.07.22.00)
321 | - React-jsiexecutor (0.71.8):
322 | - DoubleConversion
323 | - glog
324 | - hermes-engine
325 | - RCT-Folly (= 2021.07.22.00)
326 | - React-cxxreact (= 0.71.8)
327 | - React-jsi (= 0.71.8)
328 | - React-perflogger (= 0.71.8)
329 | - React-jsinspector (0.71.8)
330 | - React-logger (0.71.8):
331 | - glog
332 | - react-native-a11y-order (0.2.2):
333 | - RCT-Folly (= 2021.07.22.00)
334 | - React-Core
335 | - React-perflogger (0.71.8)
336 | - React-RCTActionSheet (0.71.8):
337 | - React-Core/RCTActionSheetHeaders (= 0.71.8)
338 | - React-RCTAnimation (0.71.8):
339 | - RCT-Folly (= 2021.07.22.00)
340 | - RCTTypeSafety (= 0.71.8)
341 | - React-Codegen (= 0.71.8)
342 | - React-Core/RCTAnimationHeaders (= 0.71.8)
343 | - React-jsi (= 0.71.8)
344 | - ReactCommon/turbomodule/core (= 0.71.8)
345 | - React-RCTAppDelegate (0.71.8):
346 | - RCT-Folly
347 | - RCTRequired
348 | - RCTTypeSafety
349 | - React-Core
350 | - ReactCommon/turbomodule/core
351 | - React-RCTBlob (0.71.8):
352 | - hermes-engine
353 | - RCT-Folly (= 2021.07.22.00)
354 | - React-Codegen (= 0.71.8)
355 | - React-Core/RCTBlobHeaders (= 0.71.8)
356 | - React-Core/RCTWebSocket (= 0.71.8)
357 | - React-jsi (= 0.71.8)
358 | - React-RCTNetwork (= 0.71.8)
359 | - ReactCommon/turbomodule/core (= 0.71.8)
360 | - React-RCTImage (0.71.8):
361 | - RCT-Folly (= 2021.07.22.00)
362 | - RCTTypeSafety (= 0.71.8)
363 | - React-Codegen (= 0.71.8)
364 | - React-Core/RCTImageHeaders (= 0.71.8)
365 | - React-jsi (= 0.71.8)
366 | - React-RCTNetwork (= 0.71.8)
367 | - ReactCommon/turbomodule/core (= 0.71.8)
368 | - React-RCTLinking (0.71.8):
369 | - React-Codegen (= 0.71.8)
370 | - React-Core/RCTLinkingHeaders (= 0.71.8)
371 | - React-jsi (= 0.71.8)
372 | - ReactCommon/turbomodule/core (= 0.71.8)
373 | - React-RCTNetwork (0.71.8):
374 | - RCT-Folly (= 2021.07.22.00)
375 | - RCTTypeSafety (= 0.71.8)
376 | - React-Codegen (= 0.71.8)
377 | - React-Core/RCTNetworkHeaders (= 0.71.8)
378 | - React-jsi (= 0.71.8)
379 | - ReactCommon/turbomodule/core (= 0.71.8)
380 | - React-RCTSettings (0.71.8):
381 | - RCT-Folly (= 2021.07.22.00)
382 | - RCTTypeSafety (= 0.71.8)
383 | - React-Codegen (= 0.71.8)
384 | - React-Core/RCTSettingsHeaders (= 0.71.8)
385 | - React-jsi (= 0.71.8)
386 | - ReactCommon/turbomodule/core (= 0.71.8)
387 | - React-RCTText (0.71.8):
388 | - React-Core/RCTTextHeaders (= 0.71.8)
389 | - React-RCTVibration (0.71.8):
390 | - RCT-Folly (= 2021.07.22.00)
391 | - React-Codegen (= 0.71.8)
392 | - React-Core/RCTVibrationHeaders (= 0.71.8)
393 | - React-jsi (= 0.71.8)
394 | - ReactCommon/turbomodule/core (= 0.71.8)
395 | - React-runtimeexecutor (0.71.8):
396 | - React-jsi (= 0.71.8)
397 | - ReactCommon/turbomodule/bridging (0.71.8):
398 | - DoubleConversion
399 | - glog
400 | - hermes-engine
401 | - RCT-Folly (= 2021.07.22.00)
402 | - React-callinvoker (= 0.71.8)
403 | - React-Core (= 0.71.8)
404 | - React-cxxreact (= 0.71.8)
405 | - React-jsi (= 0.71.8)
406 | - React-logger (= 0.71.8)
407 | - React-perflogger (= 0.71.8)
408 | - ReactCommon/turbomodule/core (0.71.8):
409 | - DoubleConversion
410 | - glog
411 | - hermes-engine
412 | - RCT-Folly (= 2021.07.22.00)
413 | - React-callinvoker (= 0.71.8)
414 | - React-Core (= 0.71.8)
415 | - React-cxxreact (= 0.71.8)
416 | - React-jsi (= 0.71.8)
417 | - React-logger (= 0.71.8)
418 | - React-perflogger (= 0.71.8)
419 | - SocketRocket (0.6.1)
420 | - Yoga (1.14.0)
421 | - YogaKit (1.18.1):
422 | - Yoga (~> 1.14)
423 |
424 | DEPENDENCIES:
425 | - boost (from `../node_modules/react-native/third-party-podspecs/boost.podspec`)
426 | - DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
427 | - FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
428 | - FBReactNativeSpec (from `../node_modules/react-native/React/FBReactNativeSpec`)
429 | - Flipper (= 0.125.0)
430 | - Flipper-Boost-iOSX (= 1.76.0.1.11)
431 | - Flipper-DoubleConversion (= 3.2.0.1)
432 | - Flipper-Fmt (= 7.1.7)
433 | - Flipper-Folly (= 2.6.10)
434 | - Flipper-Glog (= 0.5.0.5)
435 | - Flipper-PeerTalk (= 0.0.4)
436 | - Flipper-RSocket (= 1.4.3)
437 | - FlipperKit (= 0.125.0)
438 | - FlipperKit/Core (= 0.125.0)
439 | - FlipperKit/CppBridge (= 0.125.0)
440 | - FlipperKit/FBCxxFollyDynamicConvert (= 0.125.0)
441 | - FlipperKit/FBDefines (= 0.125.0)
442 | - FlipperKit/FKPortForwarding (= 0.125.0)
443 | - FlipperKit/FlipperKitHighlightOverlay (= 0.125.0)
444 | - FlipperKit/FlipperKitLayoutPlugin (= 0.125.0)
445 | - FlipperKit/FlipperKitLayoutTextSearchable (= 0.125.0)
446 | - FlipperKit/FlipperKitNetworkPlugin (= 0.125.0)
447 | - FlipperKit/FlipperKitReactPlugin (= 0.125.0)
448 | - FlipperKit/FlipperKitUserDefaultsPlugin (= 0.125.0)
449 | - FlipperKit/SKIOSNetworkPlugin (= 0.125.0)
450 | - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
451 | - hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`)
452 | - libevent (~> 2.1.12)
453 | - OpenSSL-Universal (= 1.1.1100)
454 | - RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`)
455 | - RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`)
456 | - RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`)
457 | - React (from `../node_modules/react-native/`)
458 | - React-callinvoker (from `../node_modules/react-native/ReactCommon/callinvoker`)
459 | - React-Codegen (from `build/generated/ios`)
460 | - React-Core (from `../node_modules/react-native/`)
461 | - React-Core/DevSupport (from `../node_modules/react-native/`)
462 | - React-Core/RCTWebSocket (from `../node_modules/react-native/`)
463 | - React-CoreModules (from `../node_modules/react-native/React/CoreModules`)
464 | - React-cxxreact (from `../node_modules/react-native/ReactCommon/cxxreact`)
465 | - React-hermes (from `../node_modules/react-native/ReactCommon/hermes`)
466 | - React-jsi (from `../node_modules/react-native/ReactCommon/jsi`)
467 | - React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`)
468 | - React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`)
469 | - React-logger (from `../node_modules/react-native/ReactCommon/logger`)
470 | - react-native-a11y-order (from `../..`)
471 | - React-perflogger (from `../node_modules/react-native/ReactCommon/reactperflogger`)
472 | - React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
473 | - React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`)
474 | - React-RCTAppDelegate (from `../node_modules/react-native/Libraries/AppDelegate`)
475 | - React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`)
476 | - React-RCTImage (from `../node_modules/react-native/Libraries/Image`)
477 | - React-RCTLinking (from `../node_modules/react-native/Libraries/LinkingIOS`)
478 | - React-RCTNetwork (from `../node_modules/react-native/Libraries/Network`)
479 | - React-RCTSettings (from `../node_modules/react-native/Libraries/Settings`)
480 | - React-RCTText (from `../node_modules/react-native/Libraries/Text`)
481 | - React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`)
482 | - React-runtimeexecutor (from `../node_modules/react-native/ReactCommon/runtimeexecutor`)
483 | - ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
484 | - Yoga (from `../node_modules/react-native/ReactCommon/yoga`)
485 |
486 | SPEC REPOS:
487 | trunk:
488 | - CocoaAsyncSocket
489 | - Flipper
490 | - Flipper-Boost-iOSX
491 | - Flipper-DoubleConversion
492 | - Flipper-Fmt
493 | - Flipper-Folly
494 | - Flipper-Glog
495 | - Flipper-PeerTalk
496 | - Flipper-RSocket
497 | - FlipperKit
498 | - fmt
499 | - libevent
500 | - OpenSSL-Universal
501 | - SocketRocket
502 | - YogaKit
503 |
504 | EXTERNAL SOURCES:
505 | boost:
506 | :podspec: "../node_modules/react-native/third-party-podspecs/boost.podspec"
507 | DoubleConversion:
508 | :podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
509 | FBLazyVector:
510 | :path: "../node_modules/react-native/Libraries/FBLazyVector"
511 | FBReactNativeSpec:
512 | :path: "../node_modules/react-native/React/FBReactNativeSpec"
513 | glog:
514 | :podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec"
515 | hermes-engine:
516 | :podspec: "../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec"
517 | RCT-Folly:
518 | :podspec: "../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec"
519 | RCTRequired:
520 | :path: "../node_modules/react-native/Libraries/RCTRequired"
521 | RCTTypeSafety:
522 | :path: "../node_modules/react-native/Libraries/TypeSafety"
523 | React:
524 | :path: "../node_modules/react-native/"
525 | React-callinvoker:
526 | :path: "../node_modules/react-native/ReactCommon/callinvoker"
527 | React-Codegen:
528 | :path: build/generated/ios
529 | React-Core:
530 | :path: "../node_modules/react-native/"
531 | React-CoreModules:
532 | :path: "../node_modules/react-native/React/CoreModules"
533 | React-cxxreact:
534 | :path: "../node_modules/react-native/ReactCommon/cxxreact"
535 | React-hermes:
536 | :path: "../node_modules/react-native/ReactCommon/hermes"
537 | React-jsi:
538 | :path: "../node_modules/react-native/ReactCommon/jsi"
539 | React-jsiexecutor:
540 | :path: "../node_modules/react-native/ReactCommon/jsiexecutor"
541 | React-jsinspector:
542 | :path: "../node_modules/react-native/ReactCommon/jsinspector"
543 | React-logger:
544 | :path: "../node_modules/react-native/ReactCommon/logger"
545 | react-native-a11y-order:
546 | :path: "../.."
547 | React-perflogger:
548 | :path: "../node_modules/react-native/ReactCommon/reactperflogger"
549 | React-RCTActionSheet:
550 | :path: "../node_modules/react-native/Libraries/ActionSheetIOS"
551 | React-RCTAnimation:
552 | :path: "../node_modules/react-native/Libraries/NativeAnimation"
553 | React-RCTAppDelegate:
554 | :path: "../node_modules/react-native/Libraries/AppDelegate"
555 | React-RCTBlob:
556 | :path: "../node_modules/react-native/Libraries/Blob"
557 | React-RCTImage:
558 | :path: "../node_modules/react-native/Libraries/Image"
559 | React-RCTLinking:
560 | :path: "../node_modules/react-native/Libraries/LinkingIOS"
561 | React-RCTNetwork:
562 | :path: "../node_modules/react-native/Libraries/Network"
563 | React-RCTSettings:
564 | :path: "../node_modules/react-native/Libraries/Settings"
565 | React-RCTText:
566 | :path: "../node_modules/react-native/Libraries/Text"
567 | React-RCTVibration:
568 | :path: "../node_modules/react-native/Libraries/Vibration"
569 | React-runtimeexecutor:
570 | :path: "../node_modules/react-native/ReactCommon/runtimeexecutor"
571 | ReactCommon:
572 | :path: "../node_modules/react-native/ReactCommon"
573 | Yoga:
574 | :path: "../node_modules/react-native/ReactCommon/yoga"
575 |
576 | SPEC CHECKSUMS:
577 | boost: 57d2868c099736d80fcd648bf211b4431e51a558
578 | CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
579 | DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
580 | FBLazyVector: f637f31eacba90d4fdeff3fa41608b8f361c173b
581 | FBReactNativeSpec: 0d9a4f4de7ab614c49e98c00aedfd3bfbda33d59
582 | Flipper: 26fc4b7382499f1281eb8cb921e5c3ad6de91fe0
583 | Flipper-Boost-iOSX: fd1e2b8cbef7e662a122412d7ac5f5bea715403c
584 | Flipper-DoubleConversion: 2dc99b02f658daf147069aad9dbd29d8feb06d30
585 | Flipper-Fmt: 60cbdd92fc254826e61d669a5d87ef7015396a9b
586 | Flipper-Folly: 584845625005ff068a6ebf41f857f468decd26b3
587 | Flipper-Glog: 70c50ce58ddaf67dc35180db05f191692570f446
588 | Flipper-PeerTalk: 116d8f857dc6ef55c7a5a75ea3ceaafe878aadc9
589 | Flipper-RSocket: d9d9ade67cbecf6ac10730304bf5607266dd2541
590 | FlipperKit: cbdee19bdd4e7f05472a66ce290f1b729ba3cb86
591 | fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
592 | glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b
593 | hermes-engine: 47986d26692ae75ee7a17ab049caee8864f855de
594 | libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
595 | OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c
596 | RCT-Folly: 424b8c9a7a0b9ab2886ffe9c3b041ef628fd4fb1
597 | RCTRequired: 8af6a32dfc2b65ec82193c2dee6e1011ff22ac2a
598 | RCTTypeSafety: bee9dd161c175896c680d47ef1d9eaacf2b587f4
599 | React: d850475db9ba8006a8b875d79e1e0d6ac8a0f8b6
600 | React-callinvoker: 6a0c75475ddc17c9ed54e4ff0478074a18fd7ab5
601 | React-Codegen: 786571642e87add634e7f4d299c85314ec6cc158
602 | React-Core: 1adfab153f59e4f56e09b97a153089f466d7b8aa
603 | React-CoreModules: 958d236715415d4ccdd5fa35c516cf0356637393
604 | React-cxxreact: 2e7a6283807ce8755c3d501735acd400bec3b5cd
605 | React-hermes: 8102c3112ba32207c3052619be8cfae14bf99d84
606 | React-jsi: dd29264f041a587e91f994e4be97e86c127742b2
607 | React-jsiexecutor: 747911ab5921641b4ed7e4900065896597142125
608 | React-jsinspector: c712f9e3bb9ba4122d6b82b4f906448b8a281580
609 | React-logger: 342f358b8decfbf8f272367f4eacf4b6154061be
610 | react-native-a11y-order: dbee97b1d8e5d09dadb10c8d73a69b24823ddf6a
611 | React-perflogger: d21f182895de9d1b077f8a3cd00011095c8c9100
612 | React-RCTActionSheet: 0151f83ef92d2a7139bba7dfdbc8066632a6d47b
613 | React-RCTAnimation: 5ec9c0705bb2297549c120fe6473aa3e4a01e215
614 | React-RCTAppDelegate: 9895fd1b6d1176d88c4b10ddc169b2e1300c91f0
615 | React-RCTBlob: f3634eb45b6e7480037655e1ca93d1136ac984dd
616 | React-RCTImage: 3c12cb32dec49549ae62ed6cba4018db43841ffc
617 | React-RCTLinking: 310e930ee335ef25481b4a173d9edb64b77895f9
618 | React-RCTNetwork: b6837841fe88303b0c04c1e3c01992b30f1f5498
619 | React-RCTSettings: 600d91fe25fa7c16b0ff891304082440f2904b89
620 | React-RCTText: a0a19f749088280c6def5397ed6211b811e7eef3
621 | React-RCTVibration: 43ffd976a25f6057a7cf95ea3648ba4e00287f89
622 | React-runtimeexecutor: 7c51ae9d4b3e9608a2366e39ccaa606aa551b9ed
623 | ReactCommon: 85c98ab0a509e70bf5ee5d9715cf68dbf495b84c
624 | SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
625 | Yoga: 065f0b74dba4832d6e328238de46eb72c5de9556
626 | YogaKit: f782866e155069a2cca2517aafea43200b01fd5a
627 |
628 | PODFILE CHECKSUM: 36c49471574c1a6fefb8ca761ec82000fadd8293
629 |
630 | COCOAPODS: 1.15.2
631 |
--------------------------------------------------------------------------------
/example/metro.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const escape = require('escape-string-regexp');
3 | const exclusionList = require('metro-config/src/defaults/exclusionList');
4 | const pak = require('../package.json');
5 |
6 | const root = path.resolve(__dirname, '..');
7 |
8 | const modules = Object.keys({
9 | ...pak.peerDependencies,
10 | });
11 |
12 | module.exports = {
13 | projectRoot: __dirname,
14 | watchFolders: [root],
15 |
16 | // We need to make sure that only one version is loaded for peerDependencies
17 | // So we block them at the root, and alias them to the versions in example's node_modules
18 | resolver: {
19 | blacklistRE: exclusionList(
20 | modules.map(
21 | (m) =>
22 | new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`)
23 | )
24 | ),
25 |
26 | extraNodeModules: modules.reduce((acc, name) => {
27 | acc[name] = path.join(__dirname, 'node_modules', name);
28 | return acc;
29 | }, {}),
30 | },
31 |
32 | transformer: {
33 | getTransformOptions: async () => ({
34 | transform: {
35 | experimentalImportSupport: false,
36 | inlineRequires: true,
37 | },
38 | }),
39 | },
40 | };
41 |
--------------------------------------------------------------------------------
/example/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "A11yOrderExample",
3 | "version": "0.0.1",
4 | "private": true,
5 | "scripts": {
6 | "android": "react-native run-android",
7 | "ios": "react-native run-ios",
8 | "start": "react-native start",
9 | "pods": "pod-install --quiet"
10 | },
11 | "dependencies": {
12 | "react": "18.2.0",
13 | "react-native": "0.71.8"
14 | },
15 | "devDependencies": {
16 | "@babel/core": "^7.20.0",
17 | "@babel/preset-env": "^7.20.0",
18 | "@babel/runtime": "^7.20.0",
19 | "babel-plugin-module-resolver": "^4.1.0",
20 | "metro-react-native-babel-preset": "0.73.9"
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/example/react-native.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const pak = require('../package.json');
3 |
4 | module.exports = {
5 | dependencies: {
6 | [pak.name]: {
7 | root: path.join(__dirname, '..'),
8 | },
9 | },
10 | };
11 |
--------------------------------------------------------------------------------
/example/src/App.tsx:
--------------------------------------------------------------------------------
1 | import * as React from 'react';
2 |
3 | import { StyleSheet, View } from 'react-native';
4 | import { SliderExample } from './components/SliderExample';
5 | import { CircleExample } from './components/CircleExample';
6 | import { ReorderExample } from './components/ReorderExample';
7 | import { Button } from 'react-native';
8 |
9 | enum Examples {
10 | Circle = 'circle',
11 | Slider = 'slider',
12 | Shuffle = 'shiffle',
13 | }
14 |
15 | export default function App() {
16 | const [example, setExample] = React.useState(Examples.Circle);
17 |
18 | return (
19 |
20 | {example === Examples.Circle && }
21 | {example === Examples.Slider && }
22 | {example === Examples.Shuffle && }
23 |
24 |
25 |
29 |
30 | );
31 | }
32 |
33 | const styles = StyleSheet.create({
34 | container: {
35 | flex: 1,
36 | alignItems: 'center',
37 | justifyContent: 'center',
38 | },
39 | font: { fontSize: 25 },
40 | box: {
41 | width: 60,
42 | height: 60,
43 | marginVertical: 20,
44 | },
45 | btns: { flexDirection: 'row', marginTop: 10 },
46 | });
47 |
--------------------------------------------------------------------------------
/example/src/components/CircleExample.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Button, StyleSheet, Text, View } from 'react-native';
3 | import { IndexCommands, A11y } from 'react-native-a11y-order';
4 | import { CircleNode } from './CircleNode';
5 | import { CIRCLE_RADIUS } from '../constants/circle';
6 |
7 | export const CircleExample = () => {
8 | const ref0 = React.useRef(null);
9 |
10 | return (
11 | <>
12 |
13 | Focus Order
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | ref0.current?.focus()} />
27 |
28 |
29 | >
30 | );
31 | };
32 |
33 | const styles = StyleSheet.create({
34 | titleBox: { marginBottom: 40 },
35 | title: { fontSize: 25, color: 'black' },
36 | circle: {
37 | borderWidth: 3,
38 | borderColor: 'black',
39 | width: CIRCLE_RADIUS * 2,
40 | height: CIRCLE_RADIUS * 2,
41 | borderRadius: CIRCLE_RADIUS,
42 | },
43 | buttons: { marginTop: 40 },
44 | button: { marginBottom: 10 },
45 | });
46 |
--------------------------------------------------------------------------------
/example/src/components/CircleNode.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { StyleSheet, Text } from 'react-native';
3 | import { IndexCommands, A11y } from 'react-native-a11y-order';
4 | import { getPosition } from '../constants/circle';
5 |
6 | export const CircleNode = React.forwardRef(
7 | ({ angle, index }: { angle: number; index: number }, ref) => {
8 | const position = getPosition(angle);
9 |
10 | const indexRef = React.useRef(null);
11 |
12 | React.useImperativeHandle(ref, () => ({
13 | focus: () => indexRef.current?.focus(),
14 | }));
15 |
16 | return (
17 |
28 | {angle}
29 |
30 | );
31 | }
32 | );
33 |
34 | const styles = StyleSheet.create({
35 | text: { fontSize: 15, color: 'black' },
36 | circle: {
37 | borderWidth: 3,
38 | borderColor: 'black',
39 | width: 50,
40 | height: 50,
41 | borderRadius: 25,
42 | position: 'absolute',
43 | justifyContent: 'center',
44 | alignItems: 'center',
45 | backgroundColor: 'white',
46 | },
47 | textBox: {
48 | flex: 1,
49 | justifyContent: 'center',
50 | alignItems: 'center',
51 | },
52 | });
53 |
--------------------------------------------------------------------------------
/example/src/components/ReorderExample.tsx:
--------------------------------------------------------------------------------
1 | import React, { useCallback, useState } from 'react';
2 | import { Button, StyleSheet, Text, View } from 'react-native';
3 | import { A11y } from 'react-native-a11y-order';
4 |
5 | const elements = [
6 | {
7 | index: 4,
8 | text: 'Fifth',
9 | },
10 | {
11 | index: 5,
12 | text: 'Sixth',
13 | },
14 | {
15 | index: 6,
16 | text: 'Seventh',
17 | },
18 | ];
19 |
20 | const defaultNumbers = [
21 | {
22 | index: 0,
23 | text: 'First',
24 | },
25 | {
26 | index: 1,
27 | text: 'Second',
28 | },
29 | {
30 | index: 2,
31 | text: 'Third',
32 | },
33 | {
34 | index: 3,
35 | text: 'Fourth',
36 | },
37 | ];
38 |
39 | const shuffleArray = (prevArray: T[]) => {
40 | const array = [...prevArray];
41 | for (let i = array.length - 1; i > 0; i--) {
42 | let j = Math.floor(Math.random() * (i + 1));
43 | let temp = array[i];
44 | array[i] = array[j] as T;
45 | array[j] = temp as T;
46 | }
47 | return array;
48 | };
49 |
50 | export const ReorderExample = () => {
51 | const [numbers, setNumbers] = useState(defaultNumbers);
52 | const [showAdd, setShowAdd] = useState(true);
53 |
54 | const onPressHandler = useCallback(() => {
55 | setNumbers(shuffleArray(numbers));
56 | }, [numbers]);
57 |
58 | const onAddHandler = useCallback(() => {
59 | setShowAdd(false);
60 | setNumbers([...elements, ...numbers]);
61 | }, [numbers]);
62 |
63 | return (
64 |
65 |
66 | Shuffle
67 |
68 |
69 | {numbers.map((item) => (
70 |
71 | {item.text}
72 |
73 | ))}
74 |
75 |
76 |
77 | {showAdd && }
78 |
79 |
80 | );
81 | };
82 |
83 | const styles = StyleSheet.create({
84 | title: { fontSize: 25, color: 'black' },
85 | titleBox: { marginBottom: 40 },
86 | btns: {
87 | flexDirection: 'row',
88 | marginTop: 10,
89 | },
90 | });
91 |
--------------------------------------------------------------------------------
/example/src/components/Slide.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { StyleSheet, Text, View } from 'react-native';
3 | import { A11y } from 'react-native-a11y-order';
4 |
5 | export const Slide = ({ index }: { index: string }) => {
6 | return (
7 |
8 |
9 | Title {index}
10 |
11 |
12 | Desctiption {index}
13 |
14 |
15 | );
16 | };
17 |
18 | const styles = StyleSheet.create({
19 | slide: {
20 | borderColor: 'black',
21 | borderWidth: 1,
22 | borderRadius: 20,
23 | padding: 20,
24 | marginLeft: 10,
25 | },
26 | });
27 |
--------------------------------------------------------------------------------
/example/src/components/SliderExample.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Text, View, ScrollView, StyleSheet } from 'react-native';
3 | import { Slide } from './Slide';
4 |
5 | export const SliderExample = () => {
6 | return (
7 | <>
8 | Horizontal scroll
9 |
10 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 | >
26 | );
27 | };
28 |
29 | const styles = StyleSheet.create({
30 | titleBox: {
31 | borderColor: 'black',
32 | borderWidth: 1,
33 | borderRadius: 20,
34 | padding: 20,
35 | marginLeft: 10,
36 | },
37 | sliderContainer: { alignItems: 'center' },
38 | slider: { height: 125 },
39 | title: { fontSize: 25, color: 'black' },
40 | });
41 |
--------------------------------------------------------------------------------
/example/src/constants/circle.ts:
--------------------------------------------------------------------------------
1 | export const CIRCLE_CENTER = 125 - 25;
2 | export const CIRCLE_RADIUS = 125;
3 |
4 | export const getPosition = (angle: number) => {
5 | const angleRad = ((90 + -1 * angle) * Math.PI) / 180;
6 | const x = CIRCLE_CENTER + CIRCLE_RADIUS * Math.cos(angleRad) - 5;
7 | const y = CIRCLE_CENTER + CIRCLE_RADIUS * Math.sin(angleRad) - 5;
8 |
9 | return { x, y };
10 | };
11 |
--------------------------------------------------------------------------------
/ios/A11yOrder-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | //
2 | // Use this file to import your target's public headers that you would like to expose to Swift.
3 | //
4 |
--------------------------------------------------------------------------------
/ios/A11yOrder.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 4933C16B2C42CB1E00328D4A /* RNAOA11yIndexView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4933C16A2C42CB1E00328D4A /* RNAOA11yIndexView.mm */; };
11 | 4933C16E2C42CB3500328D4A /* RNAOA11yIndexViewManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4933C16D2C42CB3500328D4A /* RNAOA11yIndexViewManager.mm */; };
12 | 4933C1732C42D38400328D4A /* RNAOA11yOrderView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4933C1722C42D38400328D4A /* RNAOA11yOrderView.mm */; };
13 | 4933C1762C42D3A700328D4A /* RNAOA11yOrderViewManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4933C1752C42D3A700328D4A /* RNAOA11yOrderViewManager.mm */; };
14 | 4933C17A2C42D45C00328D4A /* RNAOA11yDirectionViewManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4933C1792C42D45C00328D4A /* RNAOA11yDirectionViewManager.mm */; };
15 | 4933C17E2C42D4C600328D4A /* RNAOA11yDirectionView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4933C17D2C42D4C600328D4A /* RNAOA11yDirectionView.mm */; };
16 | 4933C1822C430B7000328D4A /* RNAOA11yOrderLinking.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4933C1812C430B7000328D4A /* RNAOA11yOrderLinking.mm */; };
17 | 4933C1852C430E2B00328D4A /* RNAOSortedMap.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4933C1842C430E2B00328D4A /* RNAOSortedMap.mm */; };
18 | 4933C1892C431F0900328D4A /* RNAOA11yRelashioship.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4933C1882C431F0900328D4A /* RNAOA11yRelashioship.mm */; };
19 | /* End PBXBuildFile section */
20 |
21 | /* Begin PBXCopyFilesBuildPhase section */
22 | 58B511D91A9E6C8500147676 /* CopyFiles */ = {
23 | isa = PBXCopyFilesBuildPhase;
24 | buildActionMask = 2147483647;
25 | dstPath = "include/$(PRODUCT_NAME)";
26 | dstSubfolderSpec = 16;
27 | files = (
28 | );
29 | runOnlyForDeploymentPostprocessing = 0;
30 | };
31 | /* End PBXCopyFilesBuildPhase section */
32 |
33 | /* Begin PBXFileReference section */
34 | 134814201AA4EA6300B7C361 /* libA11yOrder.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libA11yOrder.a; sourceTree = BUILT_PRODUCTS_DIR; };
35 | 4933C16A2C42CB1E00328D4A /* RNAOA11yIndexView.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = RNAOA11yIndexView.mm; sourceTree = ""; };
36 | 4933C16C2C42CB2800328D4A /* RNAOA11yIndexView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNAOA11yIndexView.h; sourceTree = ""; };
37 | 4933C16D2C42CB3500328D4A /* RNAOA11yIndexViewManager.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = RNAOA11yIndexViewManager.mm; sourceTree = ""; };
38 | 4933C16F2C42CB4900328D4A /* RNAOA11yIndexViewManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNAOA11yIndexViewManager.h; sourceTree = ""; };
39 | 4933C1712C42D37600328D4A /* RNAOA11yOrderView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNAOA11yOrderView.h; sourceTree = ""; };
40 | 4933C1722C42D38400328D4A /* RNAOA11yOrderView.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = RNAOA11yOrderView.mm; sourceTree = ""; };
41 | 4933C1742C42D39A00328D4A /* RNAOA11yOrderViewManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNAOA11yOrderViewManager.h; sourceTree = ""; };
42 | 4933C1752C42D3A700328D4A /* RNAOA11yOrderViewManager.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = RNAOA11yOrderViewManager.mm; sourceTree = ""; };
43 | 4933C1792C42D45C00328D4A /* RNAOA11yDirectionViewManager.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = RNAOA11yDirectionViewManager.mm; sourceTree = ""; };
44 | 4933C17B2C42D46C00328D4A /* RNAOA11yDirectionViewManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNAOA11yDirectionViewManager.h; sourceTree = ""; };
45 | 4933C17C2C42D4BE00328D4A /* RNAOA11yDirectionView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNAOA11yDirectionView.h; sourceTree = ""; };
46 | 4933C17D2C42D4C600328D4A /* RNAOA11yDirectionView.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = RNAOA11yDirectionView.mm; sourceTree = ""; };
47 | 4933C1812C430B7000328D4A /* RNAOA11yOrderLinking.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = RNAOA11yOrderLinking.mm; sourceTree = ""; };
48 | 4933C1832C430B7A00328D4A /* RNAOA11yOrderLinking.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNAOA11yOrderLinking.h; sourceTree = ""; };
49 | 4933C1842C430E2B00328D4A /* RNAOSortedMap.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = RNAOSortedMap.mm; sourceTree = ""; };
50 | 4933C1862C430E4500328D4A /* RNAOSortedMap.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNAOSortedMap.h; sourceTree = ""; };
51 | 4933C1872C431EFD00328D4A /* RNAOA11yRelashioship.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNAOA11yRelashioship.h; sourceTree = ""; };
52 | 4933C1882C431F0900328D4A /* RNAOA11yRelashioship.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = RNAOA11yRelashioship.mm; sourceTree = ""; };
53 | 49BCF4A12A10FE3E00AAB9D7 /* A11yOrder-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "A11yOrder-Bridging-Header.h"; sourceTree = ""; };
54 | B3E7B5881CC2AC0600A0062D /* A11yOrder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = A11yOrder.h; sourceTree = ""; };
55 | B3E7B5891CC2AC0600A0062D /* A11yOrder.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = A11yOrder.mm; sourceTree = ""; };
56 | /* End PBXFileReference section */
57 |
58 | /* Begin PBXFrameworksBuildPhase section */
59 | 58B511D81A9E6C8500147676 /* Frameworks */ = {
60 | isa = PBXFrameworksBuildPhase;
61 | buildActionMask = 2147483647;
62 | files = (
63 | );
64 | runOnlyForDeploymentPostprocessing = 0;
65 | };
66 | /* End PBXFrameworksBuildPhase section */
67 |
68 | /* Begin PBXGroup section */
69 | 134814211AA4EA7D00B7C361 /* Products */ = {
70 | isa = PBXGroup;
71 | children = (
72 | 134814201AA4EA6300B7C361 /* libA11yOrder.a */,
73 | );
74 | name = Products;
75 | sourceTree = "";
76 | };
77 | 4933C1682C42C91800328D4A /* views */ = {
78 | isa = PBXGroup;
79 | children = (
80 | 4933C1772C42D43800328D4A /* RNAOA11yDirectionView */,
81 | 4933C1702C42D35E00328D4A /* RNAOA11yOrderView */,
82 | 4933C1692C42CA8C00328D4A /* RNAOA11yIndexView */,
83 | );
84 | path = views;
85 | sourceTree = "";
86 | };
87 | 4933C1692C42CA8C00328D4A /* RNAOA11yIndexView */ = {
88 | isa = PBXGroup;
89 | children = (
90 | 4933C16C2C42CB2800328D4A /* RNAOA11yIndexView.h */,
91 | 4933C16A2C42CB1E00328D4A /* RNAOA11yIndexView.mm */,
92 | 4933C16F2C42CB4900328D4A /* RNAOA11yIndexViewManager.h */,
93 | 4933C16D2C42CB3500328D4A /* RNAOA11yIndexViewManager.mm */,
94 | );
95 | path = RNAOA11yIndexView;
96 | sourceTree = "";
97 | };
98 | 4933C1702C42D35E00328D4A /* RNAOA11yOrderView */ = {
99 | isa = PBXGroup;
100 | children = (
101 | 4933C1712C42D37600328D4A /* RNAOA11yOrderView.h */,
102 | 4933C1722C42D38400328D4A /* RNAOA11yOrderView.mm */,
103 | 4933C1742C42D39A00328D4A /* RNAOA11yOrderViewManager.h */,
104 | 4933C1752C42D3A700328D4A /* RNAOA11yOrderViewManager.mm */,
105 | );
106 | path = RNAOA11yOrderView;
107 | sourceTree = "";
108 | };
109 | 4933C1772C42D43800328D4A /* RNAOA11yDirectionView */ = {
110 | isa = PBXGroup;
111 | children = (
112 | 4933C17C2C42D4BE00328D4A /* RNAOA11yDirectionView.h */,
113 | 4933C17D2C42D4C600328D4A /* RNAOA11yDirectionView.mm */,
114 | 4933C17B2C42D46C00328D4A /* RNAOA11yDirectionViewManager.h */,
115 | 4933C1792C42D45C00328D4A /* RNAOA11yDirectionViewManager.mm */,
116 | );
117 | path = RNAOA11yDirectionView;
118 | sourceTree = "";
119 | };
120 | 4933C1802C430B6100328D4A /* services */ = {
121 | isa = PBXGroup;
122 | children = (
123 | 4933C1832C430B7A00328D4A /* RNAOA11yOrderLinking.h */,
124 | 4933C1812C430B7000328D4A /* RNAOA11yOrderLinking.mm */,
125 | 4933C1862C430E4500328D4A /* RNAOSortedMap.h */,
126 | 4933C1842C430E2B00328D4A /* RNAOSortedMap.mm */,
127 | 4933C1872C431EFD00328D4A /* RNAOA11yRelashioship.h */,
128 | 4933C1882C431F0900328D4A /* RNAOA11yRelashioship.mm */,
129 | );
130 | path = services;
131 | sourceTree = "";
132 | };
133 | 58B511D21A9E6C8500147676 = {
134 | isa = PBXGroup;
135 | children = (
136 | 4933C1802C430B6100328D4A /* services */,
137 | 4933C1682C42C91800328D4A /* views */,
138 | B3E7B5881CC2AC0600A0062D /* A11yOrder.h */,
139 | B3E7B5891CC2AC0600A0062D /* A11yOrder.mm */,
140 | 134814211AA4EA7D00B7C361 /* Products */,
141 | 49BCF4A12A10FE3E00AAB9D7 /* A11yOrder-Bridging-Header.h */,
142 | );
143 | sourceTree = "";
144 | };
145 | /* End PBXGroup section */
146 |
147 | /* Begin PBXNativeTarget section */
148 | 58B511DA1A9E6C8500147676 /* A11yOrder */ = {
149 | isa = PBXNativeTarget;
150 | buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "A11yOrder" */;
151 | buildPhases = (
152 | 58B511D71A9E6C8500147676 /* Sources */,
153 | 58B511D81A9E6C8500147676 /* Frameworks */,
154 | 58B511D91A9E6C8500147676 /* CopyFiles */,
155 | );
156 | buildRules = (
157 | );
158 | dependencies = (
159 | );
160 | name = A11yOrder;
161 | productName = RCTDataManager;
162 | productReference = 134814201AA4EA6300B7C361 /* libA11yOrder.a */;
163 | productType = "com.apple.product-type.library.static";
164 | };
165 | /* End PBXNativeTarget section */
166 |
167 | /* Begin PBXProject section */
168 | 58B511D31A9E6C8500147676 /* Project object */ = {
169 | isa = PBXProject;
170 | attributes = {
171 | LastUpgradeCheck = 0920;
172 | ORGANIZATIONNAME = Facebook;
173 | TargetAttributes = {
174 | 58B511DA1A9E6C8500147676 = {
175 | CreatedOnToolsVersion = 6.1.1;
176 | LastSwiftMigration = 1420;
177 | };
178 | };
179 | };
180 | buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "A11yOrder" */;
181 | compatibilityVersion = "Xcode 3.2";
182 | developmentRegion = English;
183 | hasScannedForEncodings = 0;
184 | knownRegions = (
185 | English,
186 | en,
187 | );
188 | mainGroup = 58B511D21A9E6C8500147676;
189 | productRefGroup = 58B511D21A9E6C8500147676;
190 | projectDirPath = "";
191 | projectRoot = "";
192 | targets = (
193 | 58B511DA1A9E6C8500147676 /* A11yOrder */,
194 | );
195 | };
196 | /* End PBXProject section */
197 |
198 | /* Begin PBXSourcesBuildPhase section */
199 | 58B511D71A9E6C8500147676 /* Sources */ = {
200 | isa = PBXSourcesBuildPhase;
201 | buildActionMask = 2147483647;
202 | files = (
203 | 4933C1892C431F0900328D4A /* RNAOA11yRelashioship.mm in Sources */,
204 | 4933C17E2C42D4C600328D4A /* RNAOA11yDirectionView.mm in Sources */,
205 | 4933C1852C430E2B00328D4A /* RNAOSortedMap.mm in Sources */,
206 | 4933C16B2C42CB1E00328D4A /* RNAOA11yIndexView.mm in Sources */,
207 | 4933C17A2C42D45C00328D4A /* RNAOA11yDirectionViewManager.mm in Sources */,
208 | 4933C1732C42D38400328D4A /* RNAOA11yOrderView.mm in Sources */,
209 | 4933C1822C430B7000328D4A /* RNAOA11yOrderLinking.mm in Sources */,
210 | 4933C16E2C42CB3500328D4A /* RNAOA11yIndexViewManager.mm in Sources */,
211 | 4933C1762C42D3A700328D4A /* RNAOA11yOrderViewManager.mm in Sources */,
212 | );
213 | runOnlyForDeploymentPostprocessing = 0;
214 | };
215 | /* End PBXSourcesBuildPhase section */
216 |
217 | /* Begin XCBuildConfiguration section */
218 | 58B511ED1A9E6C8500147676 /* Debug */ = {
219 | isa = XCBuildConfiguration;
220 | buildSettings = {
221 | ALWAYS_SEARCH_USER_PATHS = NO;
222 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
223 | CLANG_CXX_LIBRARY = "libc++";
224 | CLANG_ENABLE_MODULES = YES;
225 | CLANG_ENABLE_OBJC_ARC = YES;
226 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
227 | CLANG_WARN_BOOL_CONVERSION = YES;
228 | CLANG_WARN_COMMA = YES;
229 | CLANG_WARN_CONSTANT_CONVERSION = YES;
230 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
231 | CLANG_WARN_EMPTY_BODY = YES;
232 | CLANG_WARN_ENUM_CONVERSION = YES;
233 | CLANG_WARN_INFINITE_RECURSION = YES;
234 | CLANG_WARN_INT_CONVERSION = YES;
235 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
236 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
237 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
238 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
239 | CLANG_WARN_STRICT_PROTOTYPES = YES;
240 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
241 | CLANG_WARN_UNREACHABLE_CODE = YES;
242 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
243 | COPY_PHASE_STRIP = NO;
244 | ENABLE_STRICT_OBJC_MSGSEND = YES;
245 | ENABLE_TESTABILITY = YES;
246 | "EXCLUDED_ARCHS[sdk=*]" = arm64;
247 | GCC_C_LANGUAGE_STANDARD = gnu99;
248 | GCC_DYNAMIC_NO_PIC = NO;
249 | GCC_NO_COMMON_BLOCKS = YES;
250 | GCC_OPTIMIZATION_LEVEL = 0;
251 | GCC_PREPROCESSOR_DEFINITIONS = (
252 | "DEBUG=1",
253 | "$(inherited)",
254 | );
255 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
256 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
257 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
258 | GCC_WARN_UNDECLARED_SELECTOR = YES;
259 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
260 | GCC_WARN_UNUSED_FUNCTION = YES;
261 | GCC_WARN_UNUSED_VARIABLE = YES;
262 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
263 | MTL_ENABLE_DEBUG_INFO = YES;
264 | ONLY_ACTIVE_ARCH = YES;
265 | SDKROOT = iphoneos;
266 | };
267 | name = Debug;
268 | };
269 | 58B511EE1A9E6C8500147676 /* Release */ = {
270 | isa = XCBuildConfiguration;
271 | buildSettings = {
272 | ALWAYS_SEARCH_USER_PATHS = NO;
273 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
274 | CLANG_CXX_LIBRARY = "libc++";
275 | CLANG_ENABLE_MODULES = YES;
276 | CLANG_ENABLE_OBJC_ARC = YES;
277 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
278 | CLANG_WARN_BOOL_CONVERSION = YES;
279 | CLANG_WARN_COMMA = YES;
280 | CLANG_WARN_CONSTANT_CONVERSION = YES;
281 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
282 | CLANG_WARN_EMPTY_BODY = YES;
283 | CLANG_WARN_ENUM_CONVERSION = YES;
284 | CLANG_WARN_INFINITE_RECURSION = YES;
285 | CLANG_WARN_INT_CONVERSION = YES;
286 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
287 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
288 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
289 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
290 | CLANG_WARN_STRICT_PROTOTYPES = YES;
291 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
292 | CLANG_WARN_UNREACHABLE_CODE = YES;
293 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
294 | COPY_PHASE_STRIP = YES;
295 | ENABLE_NS_ASSERTIONS = NO;
296 | ENABLE_STRICT_OBJC_MSGSEND = YES;
297 | "EXCLUDED_ARCHS[sdk=*]" = arm64;
298 | GCC_C_LANGUAGE_STANDARD = gnu99;
299 | GCC_NO_COMMON_BLOCKS = YES;
300 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
301 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
302 | GCC_WARN_UNDECLARED_SELECTOR = YES;
303 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
304 | GCC_WARN_UNUSED_FUNCTION = YES;
305 | GCC_WARN_UNUSED_VARIABLE = YES;
306 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
307 | MTL_ENABLE_DEBUG_INFO = NO;
308 | SDKROOT = iphoneos;
309 | VALIDATE_PRODUCT = YES;
310 | };
311 | name = Release;
312 | };
313 | 58B511F01A9E6C8500147676 /* Debug */ = {
314 | isa = XCBuildConfiguration;
315 | buildSettings = {
316 | CLANG_ENABLE_MODULES = YES;
317 | HEADER_SEARCH_PATHS = (
318 | "$(inherited)",
319 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
320 | "$(SRCROOT)/../../../React/**",
321 | "$(SRCROOT)/../../react-native/React/**",
322 | );
323 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
324 | LIBRARY_SEARCH_PATHS = "$(inherited)";
325 | OTHER_LDFLAGS = "-ObjC";
326 | PRODUCT_NAME = A11yOrder;
327 | SKIP_INSTALL = YES;
328 | SWIFT_OBJC_BRIDGING_HEADER = "A11yOrder-Bridging-Header.h";
329 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
330 | SWIFT_VERSION = 5.0;
331 | };
332 | name = Debug;
333 | };
334 | 58B511F11A9E6C8500147676 /* Release */ = {
335 | isa = XCBuildConfiguration;
336 | buildSettings = {
337 | CLANG_ENABLE_MODULES = YES;
338 | HEADER_SEARCH_PATHS = (
339 | "$(inherited)",
340 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
341 | "$(SRCROOT)/../../../React/**",
342 | "$(SRCROOT)/../../react-native/React/**",
343 | );
344 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
345 | LIBRARY_SEARCH_PATHS = "$(inherited)";
346 | OTHER_LDFLAGS = "-ObjC";
347 | PRODUCT_NAME = A11yOrder;
348 | SKIP_INSTALL = YES;
349 | SWIFT_OBJC_BRIDGING_HEADER = "A11yOrder-Bridging-Header.h";
350 | SWIFT_VERSION = 5.0;
351 | };
352 | name = Release;
353 | };
354 | /* End XCBuildConfiguration section */
355 |
356 | /* Begin XCConfigurationList section */
357 | 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "A11yOrder" */ = {
358 | isa = XCConfigurationList;
359 | buildConfigurations = (
360 | 58B511ED1A9E6C8500147676 /* Debug */,
361 | 58B511EE1A9E6C8500147676 /* Release */,
362 | );
363 | defaultConfigurationIsVisible = 0;
364 | defaultConfigurationName = Release;
365 | };
366 | 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "A11yOrder" */ = {
367 | isa = XCConfigurationList;
368 | buildConfigurations = (
369 | 58B511F01A9E6C8500147676 /* Debug */,
370 | 58B511F11A9E6C8500147676 /* Release */,
371 | );
372 | defaultConfigurationIsVisible = 0;
373 | defaultConfigurationName = Release;
374 | };
375 | /* End XCConfigurationList section */
376 | };
377 | rootObject = 58B511D31A9E6C8500147676 /* Project object */;
378 | }
379 |
--------------------------------------------------------------------------------
/ios/services/RNAOA11yOrderLinking.h:
--------------------------------------------------------------------------------
1 | //
2 | // RNAOA11yOrderLinking.h
3 | // A11yOrder
4 | //
5 | // Created by Artur Kalach on 13/07/2024.
6 | // Copyright © 2024 Facebook. All rights reserved.
7 | //
8 |
9 | #ifndef RNAOA11yOrderLinking_h
10 | #define RNAOA11yOrderLinking_h
11 |
12 | @interface RNAOA11yOrderLinking : NSObject
13 |
14 | + (instancetype)sharedInstance;
15 |
16 | - (void)add:(NSNumber*)position withOrderKey:(NSString*)orderKey withObject:(NSObject*)obj;
17 | - (void)remove:(NSNumber*)position withOrderKey:(NSString*)orderKey;
18 | - (void)setContainer:(NSString*)orderKey withView:(UIView*) view;
19 | - (void)removeContainer:(NSString*)orderKey;
20 | - (void)update:(NSNumber*)position lastPosition:(NSNumber*)_position withOrderKey:(NSString*)_orderKey withView:(UIView*) view;
21 | @end
22 |
23 | #endif /* RNAOA11yOrderLinking_h */
24 |
--------------------------------------------------------------------------------
/ios/services/RNAOA11yOrderLinking.mm:
--------------------------------------------------------------------------------
1 | //
2 | // RNAOA11yOrderLinking.m
3 | // A11yOrder
4 | //
5 | // Created by Artur Kalach on 13/07/2024.
6 | // Copyright © 2024 Facebook. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "RNAOA11yOrderLinking.h"
11 | #import "RNAOA11yRelashioship.h"
12 |
13 | @implementation RNAOA11yOrderLinking {
14 | NSMutableDictionary *_relationships;
15 | }
16 |
17 | + (instancetype)sharedInstance {
18 | static RNAOA11yOrderLinking *sharedInstance = nil;
19 | static dispatch_once_t onceToken;
20 | dispatch_once(&onceToken, ^{
21 | sharedInstance = [[self alloc] init];
22 | });
23 | return sharedInstance;
24 | }
25 |
26 | - (id)init {
27 | if (self = [super init]) {
28 | _relationships = [NSMutableDictionary dictionary];
29 | }
30 |
31 | return self;
32 | }
33 |
34 | - (void)add:(NSNumber*)position withOrderKey:(NSString*)orderKey withObject:(NSObject*)obj {
35 | RNAOA11yRelashioship* relashioship = [_relationships objectForKey: orderKey];
36 | if(relashioship == nil) {
37 | relashioship = [[RNAOA11yRelashioship alloc] init];
38 | [_relationships setObject: relashioship forKey:orderKey];
39 | }
40 | [relashioship add:position withObject:obj];
41 | }
42 |
43 | -(void)remove:(NSNumber*)position withOrderKey:(NSString*)orderKey {
44 | RNAOA11yRelashioship* relashioship = [_relationships objectForKey: orderKey];
45 | if(relashioship != nil) {
46 | [relashioship remove:position];
47 | }
48 | }
49 |
50 | -(void)setContainer:(NSString*)orderKey withView:(UIView*) view {
51 | RNAOA11yRelashioship* relashioship = [_relationships objectForKey: orderKey];
52 | if(relashioship != nil) {
53 | [relashioship setContainer:view];
54 | }
55 | }
56 |
57 | - (void)update:(NSNumber*)position lastPosition:(NSNumber*)lastPosition withOrderKey:(NSString*)orderKey withView:(UIView*) view {
58 | RNAOA11yRelashioship* relashioship = [_relationships objectForKey: orderKey];
59 | if(relashioship != nil) {
60 | [relashioship update:lastPosition withPosition:position withObject:view];
61 | }
62 | }
63 |
64 | - (void)removeContainer:(NSString*)orderKey {
65 | RNAOA11yRelashioship* relashioship = [_relationships objectForKey: orderKey];
66 | if(relashioship != nil) {
67 | [_relationships removeObjectForKey:orderKey];
68 | [relashioship clear];
69 | }
70 | [self setAccessibilityElements: nil];
71 | }
72 |
73 | -(UIView*)getContainer:(NSString*)orderKey withView:(UIView*) view {
74 | RNAOA11yRelashioship* relashioship = [_relationships objectForKey: orderKey];
75 | if(relashioship != nil) {
76 | return [relashioship getContainer];
77 | }
78 |
79 | return nil;
80 | }
81 |
82 |
83 | @end
84 |
--------------------------------------------------------------------------------
/ios/services/RNAOA11yRelashioship.h:
--------------------------------------------------------------------------------
1 | //
2 | // RNAOA11yRelashioship.h
3 | // A11yOrder
4 | //
5 | // Created by Artur Kalach on 13/07/2024.
6 | // Copyright © 2024 Facebook. All rights reserved.
7 | //
8 |
9 | #ifndef RNAOA11yRelashioship_h
10 | #define RNAOA11yRelashioship_h
11 |
12 | @interface RNAOA11yRelashioship : NSObject
13 |
14 | - (void)add:(NSNumber*)position withObject:(NSObject*)obj;
15 | - (void)remove:(NSNumber*)position;
16 | - (void)update:(NSNumber*)lastPosition withPosition:(NSNumber*)position withObject:(NSObject*)obj;
17 | - (void)clear;
18 | - (void)setContainer:(UIView*)view;
19 | - (UIView*)getContainer;
20 |
21 | @end
22 |
23 |
24 | #endif /* RNAOA11yRelashioship_h */
25 |
--------------------------------------------------------------------------------
/ios/services/RNAOA11yRelashioship.mm:
--------------------------------------------------------------------------------
1 | //
2 | // RNAOA11yRelashioship.m
3 | // A11yOrder
4 | //
5 | // Created by Artur Kalach on 13/07/2024.
6 | // Copyright © 2024 Facebook. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "RNAOA11yRelashioship.h"
11 | #import "RNAOSortedMap.h"
12 |
13 | @implementation RNAOA11yRelashioship {
14 | UIView *_container;
15 | RNAOSortedMap *_positions;
16 | }
17 |
18 | - (instancetype)init {
19 | self = [super init];
20 | if (self) {
21 | _positions = [[RNAOSortedMap alloc] init];
22 | _container = nil;
23 | }
24 | return self;
25 | }
26 |
27 | - (void)add:(NSNumber*)position withObject:(NSObject*)obj {
28 | [_positions put:position withObject:obj];
29 | }
30 |
31 | -(void)remove:(NSNumber*)position {
32 | [_positions remove:position];
33 | }
34 |
35 | -(void)setContainer:(UIView*)view {
36 | _container = view;
37 | [view setAccessibilityElements: [_positions getValues]];
38 | }
39 |
40 | - (void)update:(NSNumber*)lastPosition withPosition:(NSNumber*)position withObject:(NSObject*)obj {
41 | [_positions update:lastPosition withPosition:position withObject:obj];
42 | if(_container != nil) {
43 | [_container setAccessibilityElements: [_positions getValues]];
44 | }
45 | }
46 |
47 | -(void)clear {
48 | [_positions clear];
49 | }
50 |
51 | -(UIView*)getContainer {
52 | return _container;
53 | }
54 |
55 |
56 | @end
57 |
--------------------------------------------------------------------------------
/ios/services/RNAOSortedMap.h:
--------------------------------------------------------------------------------
1 | //
2 | // RNAOSortedMap.h
3 | // A11yOrder
4 | //
5 | // Created by Artur Kalach on 13/07/2024.
6 | // Copyright © 2024 Facebook. All rights reserved.
7 | //
8 |
9 | #ifndef RNAOSortedMap_h
10 | #define RNAOSortedMap_h
11 |
12 | @interface RNAOSortedMap : NSObject
13 |
14 | - (void)put:(NSNumber*)position withObject:(NSObject*)obj;
15 | - (void)remove:(NSNumber*)position;
16 | - (void)update:(NSNumber*)position withPosition:(NSNumber*)position withObject:(NSObject*)obj;
17 | - (void)clear;
18 | - (NSArray*)getValues;
19 |
20 | @end
21 |
22 | #endif /* RNAOSortedMap_h */
23 |
--------------------------------------------------------------------------------
/ios/services/RNAOSortedMap.mm:
--------------------------------------------------------------------------------
1 | //
2 | // RNAOSortedMap.m
3 | // A11yOrder
4 | //
5 | // Created by Artur Kalach on 13/07/2024.
6 | // Copyright © 2024 Facebook. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "RNAOSortedMap.h"
11 |
12 | @implementation RNAOSortedMap {
13 | NSMutableDictionary *_dirctionary;
14 | NSMutableArray *_sortedKeys;
15 | NSMutableArray *_cachedResult;
16 | BOOL _hasBeenChanged;
17 | }
18 |
19 | - (instancetype)init {
20 | self = [super init];
21 | if (self) {
22 | _dirctionary = [NSMutableDictionary dictionary];
23 | _sortedKeys = [NSMutableArray array];
24 | _cachedResult = [NSMutableArray array];
25 | _hasBeenChanged = YES;
26 | }
27 | return self;
28 | }
29 |
30 | - (void)updateSortedKey:(NSNumber*)position {
31 | if([_sortedKeys count] == 0) {
32 | [_sortedKeys addObject: position];
33 | } else {
34 | NSInteger indexOfFirstLarger = -1;
35 |
36 | for (NSInteger i = 0; i < _sortedKeys.count; i++) {
37 | NSNumber *number = _sortedKeys[i];
38 | if ([number integerValue] > [position integerValue]) {
39 | indexOfFirstLarger = i;
40 | break;
41 | }
42 | }
43 |
44 |
45 | if(indexOfFirstLarger == -1) {
46 | [_sortedKeys addObject: position];
47 | } else {
48 | [_sortedKeys insertObject:position atIndex:indexOfFirstLarger];
49 | }
50 | }
51 | }
52 |
53 | - (void)put:(NSNumber*)position withObject:(NSObject*)obj {
54 | _hasBeenChanged = YES;
55 | if([_dirctionary objectForKey:position] == nil) {
56 | [self updateSortedKey: position];
57 | }
58 | [_dirctionary setObject: obj forKey:position];
59 | }
60 |
61 | - (void)remove:(NSNumber*)position {
62 | _hasBeenChanged = YES;
63 | NSUInteger positionIndex = [_sortedKeys indexOfObject:position];
64 | if (positionIndex != NSNotFound) {
65 | [_sortedKeys removeObjectAtIndex:positionIndex];
66 | }
67 | [_dirctionary removeObjectForKey:position];
68 | }
69 |
70 |
71 | - (void)remove:(NSNumber*)position withObject:(NSObject*)obj {
72 | if([_dirctionary objectForKey:position] == obj) {
73 | NSUInteger positionIndex = [_sortedKeys indexOfObject:position];
74 | if (positionIndex != NSNotFound) {
75 | [_sortedKeys removeObjectAtIndex:positionIndex];
76 | }
77 | [_dirctionary removeObjectForKey:position];
78 | }
79 | }
80 |
81 | - (void)clear {
82 | [_dirctionary removeAllObjects];
83 | [_sortedKeys removeAllObjects];
84 | [_cachedResult removeAllObjects];
85 | }
86 |
87 | - (void)update:(NSNumber*)lastPosition withPosition:(NSNumber*)position withObject:(NSObject*)obj {
88 | _hasBeenChanged = YES;
89 | [self remove:lastPosition withObject: obj];
90 | [self put:position withObject:obj];
91 | }
92 |
93 | - (NSArray*)getValues {
94 | if(_hasBeenChanged) {
95 | [_cachedResult removeAllObjects];
96 | for (NSNumber *itemPosition in _sortedKeys) {
97 | NSObject *item = [_dirctionary objectForKey:itemPosition];
98 | if(item != nil) {
99 | [_cachedResult addObject:item];
100 | }
101 | }
102 | return _cachedResult;
103 | } else {
104 | return _cachedResult;
105 | }
106 | }
107 |
108 | @end
109 |
--------------------------------------------------------------------------------
/ios/views/RNAOA11yGroupView/RNAOA11yGroupView.h:
--------------------------------------------------------------------------------
1 | //
2 | // RNAOA11yGroupView.h
3 | // A11yOrder
4 | //
5 | // Created by Artur Kalach on 13/07/2024.
6 | // Copyright © 2024 Facebook. All rights reserved.
7 | //
8 |
9 | #ifndef RNAOA11yGroupView_h
10 | #define RNAOA11yGroupView_h
11 |
12 |
13 | #import
14 | #import
15 |
16 | #ifdef RCT_NEW_ARCH_ENABLED
17 | #import
18 |
19 |
20 | NS_ASSUME_NONNULL_BEGIN
21 |
22 | @interface RNAOA11yGroupView : RCTViewComponentView
23 | @end
24 |
25 | NS_ASSUME_NONNULL_END
26 |
27 |
28 | #else /* RCT_NEW_ARCH_ENABLED */
29 |
30 |
31 | #import
32 | @interface RNAOA11yGroupView : RCTView
33 | @end
34 |
35 | #endif
36 |
37 | #endif /* RNAOA11yGroupView_h */
38 |
--------------------------------------------------------------------------------
/ios/views/RNAOA11yGroupView/RNAOA11yGroupView.mm:
--------------------------------------------------------------------------------
1 | //
2 | // RNAOA11yGroupView.m
3 | // A11yOrder
4 | //
5 | // Created by Artur Kalach on 13/07/2024.
6 | // Copyright © 2024 Facebook. All rights reserved.
7 | //
8 |
9 |
10 | #import
11 |
12 | #import "RNAOA11yGroupView.h"
13 | #import
14 | #import
15 |
16 | #ifdef RCT_NEW_ARCH_ENABLED
17 |
18 | #include
19 | #import
20 | #import
21 | #import
22 | #import
23 |
24 | #import "RCTFabricComponentsPlugins.h"
25 |
26 | using namespace facebook::react;
27 |
28 | @interface RNAOA11yGroupView ()
29 |
30 | @end
31 |
32 | #endif
33 |
34 |
35 |
36 | @implementation RNAOA11yGroupView
37 |
38 | - (BOOL)shouldGroupAccessibilityChildren
39 | {
40 | return YES;
41 | }
42 |
43 | #ifdef RCT_NEW_ARCH_ENABLED
44 | + (ComponentDescriptorProvider)componentDescriptorProvider
45 | {
46 | return concreteComponentDescriptorProvider();
47 | }
48 |
49 | - (instancetype)initWithFrame:(CGRect)frame
50 | {
51 | if (self = [super initWithFrame:frame]) {
52 | static const auto defaultProps = std::make_shared();
53 | _props = defaultProps;
54 | }
55 |
56 | return self;
57 | }
58 |
59 |
60 | Class A11yGroupViewCls(void)
61 | {
62 | return RNAOA11yGroupView.class;
63 | }
64 |
65 | #endif
66 |
67 | @end
68 |
--------------------------------------------------------------------------------
/ios/views/RNAOA11yGroupView/RNAOA11yGroupViewManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // RNAOA11yGroupViewManager.h
3 | // A11yOrder
4 | //
5 | // Created by Artur Kalach on 13/07/2024.
6 | // Copyright © 2024 Facebook. All rights reserved.
7 | //
8 |
9 | #ifndef RNAOA11yGroupViewManager_h
10 | #define RNAOA11yGroupViewManager_h
11 |
12 | #import
13 | @interface RNAOA11yGroupViewManager : RCTViewManager
14 | @end
15 |
16 |
17 | #endif /* RNAOA11yGroupViewManager_h */
18 |
--------------------------------------------------------------------------------
/ios/views/RNAOA11yGroupView/RNAOA11yGroupViewManager.mm:
--------------------------------------------------------------------------------
1 | //
2 | // RNAOA11yGroupViewManager.m
3 | // A11yOrder
4 | //
5 | // Created by Artur Kalach on 13/07/2024.
6 | // Copyright © 2024 Facebook. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import
12 | #import
13 | #import "RNAOA11yGroupViewManager.h"
14 | #import "RNAOA11yGroupView.h"
15 |
16 | @implementation RNAOA11yGroupViewManager
17 |
18 | RCT_EXPORT_MODULE(A11yGroupView)
19 |
20 | - (UIView *)view
21 | {
22 | return [[RNAOA11yGroupView alloc] init];
23 | }
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/ios/views/RNAOA11yIndexView/RNAOA11yIndexView.h:
--------------------------------------------------------------------------------
1 | //
2 | // RNAOA11yIndexView.h
3 | // A11yOrder
4 | //
5 | // Created by Artur Kalach on 13/07/2024.
6 | // Copyright © 2024 Facebook. All rights reserved.
7 | //
8 |
9 | #ifndef RNAOA11yIndexView_h
10 | #define RNAOA11yIndexView_h
11 |
12 | #import
13 | #import
14 |
15 | #ifdef RCT_NEW_ARCH_ENABLED
16 | #import
17 |
18 |
19 | NS_ASSUME_NONNULL_BEGIN
20 |
21 | @interface RNAOA11yIndexView : RCTViewComponentView
22 |
23 | @property NSNumber* position;
24 | @property NSString* orderKey;
25 |
26 | - (void)updatePosition:(NSNumber *)position;
27 |
28 | @end
29 |
30 | NS_ASSUME_NONNULL_END
31 |
32 |
33 | #else /* RCT_NEW_ARCH_ENABLED */
34 |
35 |
36 | #import
37 | @interface RNAOA11yIndexView : RCTView
38 |
39 | @property NSNumber* position;
40 | @property NSString* orderKey;
41 |
42 | - (void)updatePosition:(NSNumber *)position;
43 |
44 | @end
45 |
46 |
47 | #endif /* RCT_NEW_ARCH_ENABLED */
48 | #endif /* RNAOA11yIndexView_h */
49 |
--------------------------------------------------------------------------------
/ios/views/RNAOA11yIndexView/RNAOA11yIndexView.mm:
--------------------------------------------------------------------------------
1 | //
2 | // RNAOA11yIndexView.m
3 | // A11yOrder
4 | //
5 | // Created by Artur Kalach on 13/07/2024.
6 | // Copyright © 2024 Facebook. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import "RNAOA11yIndexView.h"
12 | #import
13 | #import
14 | #import "RNAOA11yOrderLinking.h"
15 |
16 | #ifdef RCT_NEW_ARCH_ENABLED
17 |
18 | #include
19 | #import
20 | #import
21 | #import
22 | #import
23 |
24 | #import "RCTFabricComponentsPlugins.h"
25 |
26 | using namespace facebook::react;
27 |
28 | @interface RNAOA11yIndexView ()
29 |
30 | @end
31 |
32 | #endif
33 |
34 |
35 |
36 | @implementation RNAOA11yIndexView {
37 | BOOL isLinked;
38 | }
39 |
40 | - (void)linkIndex:(UIView *)subview {
41 | if(_position != nil && _orderKey != nil && !isLinked) {
42 | [[RNAOA11yOrderLinking sharedInstance] add: _position withOrderKey:_orderKey withObject:subview];
43 | isLinked = YES;
44 | }
45 | }
46 |
47 | - (void)didAddSubview:(UIView *)subview {
48 | [super didAddSubview:subview];
49 | [self linkIndex:subview];
50 | }
51 |
52 |
53 | - (void)willRemoveSubview:(UIView *)subview {
54 | [super willRemoveSubview:subview];
55 | if(_position != nil && _orderKey != nil) {
56 | [[RNAOA11yOrderLinking sharedInstance] remove:_position withOrderKey:_orderKey];
57 | }
58 | }
59 |
60 | - (void)updatePosition:(NSNumber *)position {
61 | if(_position != nil || _position != position) {
62 | if(_orderKey != nil && self.subviews.count > 0 && isLinked) {
63 | [[RNAOA11yOrderLinking sharedInstance] update:position lastPosition:_position withOrderKey: _orderKey withView: self.subviews[0]];
64 | }
65 | _position = position;
66 | }
67 |
68 | if(_position == nil && _position != position) {
69 | _position = position;
70 | }
71 | }
72 |
73 | #ifdef RCT_NEW_ARCH_ENABLED
74 | - (instancetype)initWithFrame:(CGRect)frame
75 | {
76 | if (self = [super initWithFrame:frame]) {
77 | static const auto defaultProps = std::make_shared();
78 | _props = defaultProps;
79 | isLinked = NO;
80 | }
81 |
82 | return self;
83 | }
84 | #else
85 | - (instancetype)initWithFrame:(CGRect)frame
86 | {
87 | if (self = [super initWithFrame:frame]) {
88 | isLinked = NO;
89 | }
90 |
91 | return self;
92 | }
93 | #endif
94 |
95 | #ifdef RCT_NEW_ARCH_ENABLED
96 | + (ComponentDescriptorProvider)componentDescriptorProvider
97 | {
98 | return concreteComponentDescriptorProvider();
99 | }
100 |
101 |
102 | - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
103 | {
104 | const auto &oldViewProps = *std::static_pointer_cast(_props);
105 | const auto &newViewProps = *std::static_pointer_cast(props);
106 | [super updateProps
107 | :props oldProps:oldProps];
108 |
109 | BOOL isIndexChanged = oldViewProps.orderIndex != newViewProps.orderIndex || _position == nil;
110 | if(isIndexChanged) {
111 | [self updatePosition: @(newViewProps.orderIndex)];
112 | }
113 |
114 | BOOL isOrderChanged = oldViewProps.orderKey != newViewProps.orderKey || _orderKey == nil;
115 | if(isOrderChanged) {
116 | [self setOrderKey: [NSString stringWithUTF8String:newViewProps.orderKey.c_str()]];
117 | }
118 | }
119 |
120 | - (void)finalizeUpdates:(RNComponentViewUpdateMask)updateMask {
121 | if(self.subviews.count > 0) {
122 | [self linkIndex: self.subviews[0]];
123 | }
124 | [super finalizeUpdates:updateMask];
125 | }
126 |
127 | - (void)focusView {
128 | UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, self);
129 | }
130 |
131 | - (void)handleCommand:(const NSString *)commandName args:(const NSArray *)args {
132 | NSString *FOCUS = @"focus";
133 | if([commandName isEqual:FOCUS]) {
134 | [self focusView];
135 | }
136 | }
137 |
138 | - (void)prepareForRecycle
139 | {
140 | isLinked = NO;
141 | _position = nil;
142 | _orderKey = nil;
143 | [super prepareForRecycle];
144 | }
145 |
146 | Class A11yIndexViewCls(void)
147 | {
148 | return RNAOA11yIndexView.class;
149 | }
150 |
151 | #endif
152 |
153 | @end
154 |
--------------------------------------------------------------------------------
/ios/views/RNAOA11yIndexView/RNAOA11yIndexViewManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // RNAOA11yIndexViewManager.h
3 | // A11yOrder
4 | //
5 | // Created by Artur Kalach on 13/07/2024.
6 | // Copyright © 2024 Facebook. All rights reserved.
7 | //
8 |
9 | #ifndef RNAOA11yIndexViewManager_h
10 | #define RNAOA11yIndexViewManager_h
11 |
12 | #import
13 | #import
14 |
15 | @interface RNAOA11yIndexViewManager : RCTViewManager
16 | @end
17 |
18 |
19 | #endif /* RNAOA11yIndexViewManager_h */
20 |
--------------------------------------------------------------------------------
/ios/views/RNAOA11yIndexView/RNAOA11yIndexViewManager.mm:
--------------------------------------------------------------------------------
1 | //
2 | // RNAOA11yIndexViewManager.m
3 | // A11yOrder
4 | //
5 | // Created by Artur Kalach on 13/07/2024.
6 | // Copyright © 2024 Facebook. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | #import "RNAOA11yIndexView.h"
12 | #import "RNAOA11yIndexViewManager.h"
13 |
14 | @implementation RNAOA11yIndexViewManager
15 |
16 | RCT_EXPORT_MODULE(A11yIndexView)
17 |
18 | - (UIView *)view
19 | {
20 | return [[RNAOA11yIndexView alloc] init];
21 | }
22 |
23 | RCT_CUSTOM_VIEW_PROPERTY(orderIndex, int, RNAOA11yIndexView)
24 | {
25 | int value = json ? [RCTConvert int:json] : 0;
26 | [view updatePosition: @(value)];
27 | }
28 |
29 | RCT_CUSTOM_VIEW_PROPERTY(orderKey, NSString, RNAOA11yIndexView)
30 | {
31 | NSString *value = json ? [RCTConvert NSString:json] : @"";
32 | [view setOrderKey: value];
33 | }
34 |
35 | RCT_EXPORT_METHOD(focus:(nonnull NSNumber *)reactTag)
36 | {
37 | [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry) {
38 | UIView *view = viewRegistry[reactTag];
39 | if (!view || ![view isKindOfClass:[UIView class]]) {
40 | return;
41 | }
42 | UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, view);
43 | }];
44 | }
45 |
46 | @end
47 |
--------------------------------------------------------------------------------
/ios/views/RNAOA11yOrderView/RNAOA11yOrderView.h:
--------------------------------------------------------------------------------
1 | //
2 | // RNAOA11yOrderView.h
3 | // A11yOrder
4 | //
5 | // Created by Artur Kalach on 13/07/2024.
6 | // Copyright © 2024 Facebook. All rights reserved.
7 | //
8 |
9 | #ifndef RNAOA11yOrderView_h
10 | #define RNAOA11yOrderView_h
11 |
12 |
13 | #import
14 | #import
15 |
16 | #ifdef RCT_NEW_ARCH_ENABLED
17 | #import
18 |
19 |
20 | NS_ASSUME_NONNULL_BEGIN
21 |
22 | @interface RNAOA11yOrderView : RCTViewComponentView
23 |
24 | @property NSString* orderKey;
25 |
26 | @end
27 |
28 | NS_ASSUME_NONNULL_END
29 |
30 |
31 | #else /* RCT_NEW_ARCH_ENABLED */
32 |
33 |
34 | #import
35 | @interface RNAOA11yOrderView : RCTView
36 |
37 | @property NSString* orderKey;
38 |
39 | @end
40 |
41 |
42 | #endif /* RCT_NEW_ARCH_ENABLED */
43 | #endif /* RNAOA11yOrderView_h */
44 |
--------------------------------------------------------------------------------
/ios/views/RNAOA11yOrderView/RNAOA11yOrderView.mm:
--------------------------------------------------------------------------------
1 | //
2 | // RNAOA11yOrderView.m
3 | // A11yOrder
4 | //
5 | // Created by Artur Kalach on 13/07/2024.
6 | // Copyright © 2024 Facebook. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import "RNAOA11yOrderView.h"
12 | #import
13 | #import
14 | #import "RNAOA11yOrderLinking.h"
15 |
16 | #ifdef RCT_NEW_ARCH_ENABLED
17 |
18 | #include
19 | #import
20 | #import
21 | #import
22 | #import
23 |
24 | #import "RCTFabricComponentsPlugins.h"
25 |
26 | using namespace facebook::react;
27 |
28 | @interface RNAOA11yOrderView ()
29 |
30 | @end
31 |
32 | #endif
33 |
34 |
35 |
36 | @implementation RNAOA11yOrderView
37 |
38 | - (void)layoutSubviews {
39 | [super layoutSubviews];
40 | if(_orderKey != nil) {
41 | [[RNAOA11yOrderLinking sharedInstance] setContainer:_orderKey withView:self];
42 | }
43 | }
44 |
45 | #ifdef RCT_NEW_ARCH_ENABLED
46 | - (void)prepareForRecycle
47 | {
48 | [self setAccessibilityElements: nil];
49 | [super prepareForRecycle];
50 | [[RNAOA11yOrderLinking sharedInstance] removeContainer:_orderKey];
51 | }
52 | #else
53 | - (void)willMoveToSuperview:(UIView *)newSuperview {
54 | [super willMoveToSuperview:newSuperview];
55 | if (newSuperview == nil) {
56 | [[RNAOA11yOrderLinking sharedInstance] removeContainer:_orderKey];
57 | }
58 | }
59 | #endif
60 |
61 |
62 | #ifdef RCT_NEW_ARCH_ENABLED
63 | + (ComponentDescriptorProvider)componentDescriptorProvider
64 | {
65 | return concreteComponentDescriptorProvider();
66 | }
67 |
68 | - (instancetype)initWithFrame:(CGRect)frame
69 | {
70 | if (self = [super initWithFrame:frame]) {
71 | static const auto defaultProps = std::make_shared();
72 | _props = defaultProps;
73 | }
74 |
75 | return self;
76 | }
77 |
78 | - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
79 | {
80 | const auto &oldViewProps = *std::static_pointer_cast(_props);
81 | const auto &newViewProps = *std::static_pointer_cast(props);
82 | [super updateProps
83 | :props oldProps:oldProps];
84 |
85 | if(oldViewProps.orderKey != newViewProps.orderKey) {
86 | [self setOrderKey: [NSString stringWithUTF8String:newViewProps.orderKey.c_str()]];
87 | }
88 | }
89 |
90 | Class A11yOrderViewCls(void)
91 | {
92 | return RNAOA11yOrderView.class;
93 | }
94 |
95 | #endif
96 |
97 | @end
98 |
--------------------------------------------------------------------------------
/ios/views/RNAOA11yOrderView/RNAOA11yOrderViewManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // RNAOA11yOrderViewManager.h
3 | // A11yOrder
4 | //
5 | // Created by Artur Kalach on 13/07/2024.
6 | // Copyright © 2024 Facebook. All rights reserved.
7 | //
8 |
9 | #ifndef RNAOA11yOrderViewManager_h
10 | #define RNAOA11yOrderViewManager_h
11 |
12 | #import
13 |
14 | @interface RNAOA11yOrderViewManager : RCTViewManager
15 | @end
16 |
17 |
18 | #endif /* RNAOA11yOrderViewManager_h */
19 |
--------------------------------------------------------------------------------
/ios/views/RNAOA11yOrderView/RNAOA11yOrderViewManager.mm:
--------------------------------------------------------------------------------
1 | //
2 | // RNAOA11yOrderViewManager.m
3 | // A11yOrder
4 | //
5 | // Created by Artur Kalach on 13/07/2024.
6 | // Copyright © 2024 Facebook. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 |
12 | #import
13 | #import
14 | #import "RNAOA11yOrderView.h"
15 | #import "RNAOA11yOrderViewManager.h"
16 |
17 | @implementation RNAOA11yOrderViewManager
18 |
19 | RCT_EXPORT_MODULE(A11yOrderView)
20 |
21 | - (UIView *)view
22 | {
23 | return [[RNAOA11yOrderView alloc] init];
24 | }
25 |
26 | RCT_CUSTOM_VIEW_PROPERTY(orderKey, NSString, RNAOA11yOrderView)
27 | {
28 | NSString *value = json ? [RCTConvert NSString:json] : @"";
29 | [view setOrderKey:value];
30 | }
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/lefthook.yml:
--------------------------------------------------------------------------------
1 | pre-commit:
2 | parallel: true
3 | commands:
4 | lint:
5 | files: git diff --name-only @{push}
6 | glob: "*.{js,ts,jsx,tsx}"
7 | run: npx eslint {files}
8 | types:
9 | files: git diff --name-only @{push}
10 | glob: "*.{js,ts, jsx, tsx}"
11 | run: npx tsc --noEmit
12 | commit-msg:
13 | parallel: true
14 | commands:
15 | commitlint:
16 | run: npx commitlint --edit
17 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-native-a11y-order",
3 | "version": "0.2.3",
4 | "description": "ReactNative library for managing screen reader focus ordering",
5 | "main": "lib/commonjs/index",
6 | "module": "lib/module/index",
7 | "types": "lib/typescript/index.d.ts",
8 | "react-native": "src/index",
9 | "source": "src/index",
10 | "files": [
11 | "src",
12 | "lib",
13 | "android",
14 | "ios",
15 | "cpp",
16 | "*.podspec",
17 | "!lib/typescript/example",
18 | "!ios/build",
19 | "!android/build",
20 | "!android/gradle",
21 | "!android/gradlew",
22 | "!android/gradlew.bat",
23 | "!android/local.properties",
24 | "!**/__tests__",
25 | "!**/__fixtures__",
26 | "!**/__mocks__",
27 | "!**/.*"
28 | ],
29 | "scripts": {
30 | "test": "jest",
31 | "typecheck": "tsc --noEmit",
32 | "lint": "eslint \"**/*.{js,ts,tsx}\"",
33 | "prepack": "bob build",
34 | "release": "release-it",
35 | "release-no-increment": "release-it --no-increment",
36 | "example": "yarn --cwd example",
37 | "bootstrap": "yarn example && yarn install && yarn example pods",
38 | "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build"
39 | },
40 | "keywords": [
41 | "react-native",
42 | "accessibility",
43 | "screen reader",
44 | "focus order",
45 | "VoiceOver",
46 | "TalkBack",
47 | "ios",
48 | "android",
49 | "WCAG",
50 | "a11y"
51 | ],
52 | "repository": "https://github.com/ArturKalach/react-native-a11y-order",
53 | "author": "Artur Kalach (https://github.com/ArturKalach)",
54 | "license": "MIT",
55 | "bugs": {
56 | "url": "https://github.com/ArturKalach/react-native-a11y-order/issues"
57 | },
58 | "homepage": "https://github.com/ArturKalach/react-native-a11y-order#readme",
59 | "publishConfig": {
60 | "registry": "https://registry.npmjs.org/"
61 | },
62 | "devDependencies": {
63 | "@commitlint/config-conventional": "^17.0.2",
64 | "@evilmartians/lefthook": "^1.2.2",
65 | "@react-native-community/eslint-config": "^3.0.2",
66 | "@release-it/conventional-changelog": "^5.0.0",
67 | "@types/jest": "^28.1.2",
68 | "@types/react": "~17.0.21",
69 | "@types/react-native": "0.70.0",
70 | "commitlint": "^17.0.2",
71 | "del-cli": "^5.0.0",
72 | "eslint": "^8.4.1",
73 | "eslint-config-prettier": "^8.5.0",
74 | "eslint-plugin-prettier": "^4.0.0",
75 | "jest": "^28.1.1",
76 | "pod-install": "^0.1.0",
77 | "prettier": "^2.0.5",
78 | "react": "18.2.0",
79 | "react-native": "0.71.8",
80 | "react-native-builder-bob": "^0.20.0",
81 | "release-it": "^15.0.0",
82 | "typescript": "^4.5.2"
83 | },
84 | "resolutions": {
85 | "@types/react": "17.0.21"
86 | },
87 | "peerDependencies": {
88 | "react": "*",
89 | "react-native": "*"
90 | },
91 | "engines": {
92 | "node": ">= 16.0.0"
93 | },
94 | "jest": {
95 | "preset": "react-native",
96 | "modulePathIgnorePatterns": [
97 | "/example/node_modules",
98 | "/lib/"
99 | ]
100 | },
101 | "commitlint": {
102 | "extends": [
103 | "@commitlint/config-conventional"
104 | ]
105 | },
106 | "release-it": {
107 | "git": {
108 | "commitMessage": "chore: release ${version}",
109 | "tagName": "v${version}"
110 | },
111 | "npm": {
112 | "publish": true
113 | },
114 | "github": {
115 | "release": true
116 | },
117 | "plugins": {
118 | "@release-it/conventional-changelog": {
119 | "preset": "angular"
120 | }
121 | }
122 | },
123 | "eslintConfig": {
124 | "root": true,
125 | "extends": [
126 | "@react-native-community",
127 | "prettier"
128 | ],
129 | "rules": {
130 | "prettier/prettier": [
131 | "error",
132 | {
133 | "quoteProps": "consistent",
134 | "singleQuote": true,
135 | "tabWidth": 2,
136 | "trailingComma": "es5",
137 | "useTabs": false
138 | }
139 | ]
140 | }
141 | },
142 | "eslintIgnore": [
143 | "node_modules/",
144 | "lib/"
145 | ],
146 | "prettier": {
147 | "quoteProps": "consistent",
148 | "singleQuote": true,
149 | "tabWidth": 2,
150 | "trailingComma": "es5",
151 | "useTabs": false
152 | },
153 | "react-native-builder-bob": {
154 | "source": "src",
155 | "output": "lib",
156 | "targets": [
157 | "commonjs",
158 | "module",
159 | [
160 | "typescript",
161 | {
162 | "project": "tsconfig.build.json"
163 | }
164 | ]
165 | ]
166 | },
167 | "codegenConfig": {
168 | "name": "RNA11yOrderSpec",
169 | "type": "all",
170 | "jsSrcsDir": "src/nativeSpecs"
171 | }
172 | }
173 |
--------------------------------------------------------------------------------
/react-native-a11y-order.podspec:
--------------------------------------------------------------------------------
1 | require "json"
2 |
3 | package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4 | folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
5 |
6 | Pod::Spec.new do |s|
7 | s.name = "react-native-a11y-order"
8 | s.version = package["version"]
9 | s.summary = package["description"]
10 | s.homepage = package["homepage"]
11 | s.license = package["license"]
12 | s.authors = package["author"]
13 |
14 | s.platforms = { :ios => "11.0" }
15 | s.source = { :git => "https://github.com/ArturKalach/react-native-a11y-order.git", :tag => "#{s.version}" }
16 |
17 | s.source_files = "ios/**/*.{h,m,mm}"
18 |
19 | s.dependency "React-Core"
20 |
21 | # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
22 | # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
23 | if respond_to?(:install_modules_dependencies, true)
24 | install_modules_dependencies(s)
25 | else
26 | s.dependency "React-Core"
27 |
28 | # Don't install the dependencies when we run `pod install` in the old architecture.
29 | if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
30 | s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
31 | s.pod_target_xcconfig = {
32 | "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
33 | "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
34 | "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
35 | }
36 | s.dependency "React-RCTFabric"
37 | s.dependency "React-Codegen"
38 | s.dependency "RCT-Folly"
39 | s.dependency "RCTRequired"
40 | s.dependency "RCTTypeSafety"
41 | s.dependency "ReactCommon/turbomodule/core"
42 | end
43 | end
44 | end
45 |
--------------------------------------------------------------------------------
/scripts/bootstrap.js:
--------------------------------------------------------------------------------
1 | const os = require('os');
2 | const path = require('path');
3 | const child_process = require('child_process');
4 |
5 | const root = path.resolve(__dirname, '..');
6 | const args = process.argv.slice(2);
7 | const options = {
8 | cwd: process.cwd(),
9 | env: process.env,
10 | stdio: 'inherit',
11 | encoding: 'utf-8',
12 | };
13 |
14 | if (os.type() === 'Windows_NT') {
15 | options.shell = true;
16 | }
17 |
18 | let result;
19 |
20 | if (process.cwd() !== root || args.length) {
21 | // We're not in the root of the project, or additional arguments were passed
22 | // In this case, forward the command to `yarn`
23 | result = child_process.spawnSync('yarn', args, options);
24 | } else {
25 | // If `yarn` is run without arguments, perform bootstrap
26 | result = child_process.spawnSync('yarn', ['bootstrap'], options);
27 | }
28 |
29 | process.exitCode = result.status;
30 |
--------------------------------------------------------------------------------
/src/__tests__/index.test.tsx:
--------------------------------------------------------------------------------
1 | it.todo('write a test');
2 |
--------------------------------------------------------------------------------
/src/components/A11yGroup/A11yGroup.android.tsx:
--------------------------------------------------------------------------------
1 | import React, { useId } from 'react';
2 | import { View } from 'react-native';
3 |
4 | import { A11yGroupProps } from '../../types/A11yGroup.types';
5 |
6 | export const A11yGroup = (props: A11yGroupProps) => {
7 | const id = useId();
8 | return ;
9 | };
10 |
--------------------------------------------------------------------------------
/src/components/A11yGroup/A11yGroup.ios.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import A11yDirectionView from '../../nativeSpecs/A11yGroupNativeComponent';
3 | import { A11yGroupProps } from '../../types/A11yGroup.types';
4 |
5 | export const A11yGroup = (props: A11yGroupProps) => (
6 |
7 | );
8 |
--------------------------------------------------------------------------------
/src/components/A11yGroup/A11yGroup.tsx:
--------------------------------------------------------------------------------
1 | import { View } from 'react-native';
2 |
3 | export const A11yGroup = View;
4 |
--------------------------------------------------------------------------------
/src/components/A11yIndex/A11yIndex.tsx:
--------------------------------------------------------------------------------
1 | import React, { useImperativeHandle, useRef } from 'react';
2 | import { View } from 'react-native';
3 | import { A11ySequenceOrderContext } from '../../context/A11ySequenceOrderContext';
4 | import A11yIndexView, {
5 | Commands,
6 | } from '../../nativeSpecs/A11yIndexNativeComponent';
7 | import { A11yIndexProps, IndexCommands } from '../../types/A11yIndex.types';
8 |
9 | export const A11yIndex = React.memo(
10 | React.forwardRef(
11 | ({ children, index, ...props }, ref) => {
12 | const orderKey = React.useContext(A11ySequenceOrderContext);
13 | if (!orderKey) {
14 | throw new Error(
15 | 'A11ySequence.Index should be used inside of A11ySequence.Container'
16 | );
17 | }
18 |
19 | const indexRef = useRef>(null);
20 |
21 | useImperativeHandle(ref, () => ({
22 | focus: () => {
23 | if (indexRef.current) {
24 | Commands.focus(indexRef.current);
25 | }
26 | },
27 | }));
28 |
29 | const isSingleChild = React.Children.count(children) === 1;
30 |
31 | return (
32 |
38 | {isSingleChild && children}
39 | {!isSingleChild && {children}}
40 |
41 | );
42 | }
43 | )
44 | );
45 |
--------------------------------------------------------------------------------
/src/components/A11yIndex/A11yIndex.web.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { forwardRef, useImperativeHandle, useRef } from 'react';
3 | import { IndexCommands, A11yIndexProps } from '../../types/A11yIndex.types';
4 | import { UIManager } from 'react-native';
5 | import { View } from 'react-native';
6 |
7 | const WebUiMeneger = UIManager as unknown as {
8 | focus: (v: View) => void;
9 | };
10 |
11 | export const A11yIndex = forwardRef(
12 | (props, ref) => {
13 | const viewRef = useRef(null);
14 | useImperativeHandle(ref, () => ({
15 | focus: () => {
16 | if (viewRef.current) {
17 | WebUiMeneger.focus(viewRef.current);
18 | }
19 | },
20 | }));
21 |
22 | return ;
23 | }
24 | );
25 |
--------------------------------------------------------------------------------
/src/components/A11yOrder/A11yOrder.tsx:
--------------------------------------------------------------------------------
1 | import React, { useCallback, useId } from 'react';
2 | import { View, LayoutChangeEvent } from 'react-native';
3 | import type { A11yOrderProps } from '../../types/A11yOrder.types';
4 |
5 | /**
6 | * @deprecated The method should not be used
7 | * This API is going to be removed in future releases, you can find migration instruction here: https://github.com/ArturKalach/react-native-a11y-order?tab=readme-ov-file#migration
8 | */
9 | export const A11yOrder: React.FC = ({
10 | a11yOrder,
11 | onLayout,
12 | ignoreWarn,
13 | ...props
14 | }) => {
15 | if (!ignoreWarn) {
16 | console.warn(
17 | 'A11yOrder: This API is going to be removed in future releases, you can find migration instruction here: https://github.com/ArturKalach/react-native-a11y-order?tab=readme-ov-file#migration'
18 | );
19 | }
20 | const onLayoutHandler = useCallback(
21 | (e: LayoutChangeEvent) => {
22 | onLayout?.(e);
23 | a11yOrder.onLayout();
24 | },
25 | [a11yOrder, onLayout]
26 | );
27 |
28 | const id = useId?.() || 'mock_id'; // ToDo: use native component with tag to nativeTag
29 |
30 | return (
31 |
37 | );
38 | };
39 |
--------------------------------------------------------------------------------
/src/components/A11ySequence/A11ySequence.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { ViewProps } from 'react-native';
3 | import { A11ySequenceOrderContext } from '../../context/A11ySequenceOrderContext';
4 | import A11yOrderNativeComponent from '../../nativeSpecs/A11yOrderNativeComponent';
5 |
6 | export const A11yIndexSequence = React.memo((props) => {
7 | const orderKey = React.useId();
8 | return (
9 |
10 |
11 |
12 | );
13 | });
14 |
--------------------------------------------------------------------------------
/src/context/A11ySequenceOrderContext.ts:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export const A11ySequenceOrderContext = React.createContext(
4 | undefined
5 | );
6 |
--------------------------------------------------------------------------------
/src/index.ts:
--------------------------------------------------------------------------------
1 | import { A11yIndex } from './components/A11yIndex/A11yIndex';
2 | import { A11yIndexSequence } from './components/A11ySequence/A11ySequence';
3 | import { A11yGroup } from './components/A11yGroup/A11yGroup';
4 |
5 | export { A11yOrder } from './components/A11yOrder/A11yOrder';
6 | export type { A11yOrderProps } from './types/A11yOrder.types';
7 | export type { IndexCommands } from './types/A11yIndex.types';
8 |
9 | export const A11y = {
10 | Order: A11yIndexSequence,
11 | Index: A11yIndex,
12 | Group: A11yGroup,
13 | };
14 |
--------------------------------------------------------------------------------
/src/index.web.ts:
--------------------------------------------------------------------------------
1 | import { createRef } from 'react';
2 | import { View } from 'react-native';
3 | import { A11yIndex } from './components/A11yIndex/A11yIndex.web';
4 |
5 | /**
6 | * @deprecated The method should not be used
7 | * This API is going to be removed in future releases, you can find migration instruction here: https://github.com/ArturKalach/react-native-a11y-order?tab=readme-ov-file#migration
8 | */
9 | export const useFocusOrder = () => ({
10 | a11yOrder: {
11 | ref: createRef(),
12 | onLayout: () => {},
13 | },
14 | refs: [],
15 | reset: () => {},
16 | setOrder: () => {},
17 | });
18 |
19 | /**
20 | * @deprecated The method should not be used
21 | * This API is going to be removed in future releases, you can find migration instruction here: https://github.com/ArturKalach/react-native-a11y-order?tab=readme-ov-file#migration
22 | */
23 | export const useDynamicFocusOrder = () => ({
24 | a11yOrder: {
25 | ref: createRef(),
26 | onLayout: () => {},
27 | },
28 | registerOrder: () => createRef,
29 | reset: () => {},
30 | setOrder: () => {},
31 | });
32 |
33 | export const useA11yOrderManager = () => ({
34 | registerOrderRef: () => () => {},
35 | updateRefList: () => {},
36 | reset: () => {},
37 | setOrder: () => {},
38 | });
39 |
40 | export type { A11yOrderProps } from './types/A11yOrder.types';
41 | export type { IndexCommands } from './types/A11yIndex.types';
42 |
43 | /**
44 | * @deprecated The method should not be used
45 | * This API is going to be removed in future releases, you can find migration instruction here: https://github.com/ArturKalach/react-native-a11y-order?tab=readme-ov-file#migration
46 | */
47 | export const A11yOrder = View;
48 |
49 | export const A11y = {
50 | Order: View,
51 | Group: View,
52 | Index: A11yIndex,
53 | };
54 |
--------------------------------------------------------------------------------
/src/nativeSpecs/A11yGroupNativeComponent.ts:
--------------------------------------------------------------------------------
1 | import type { ViewProps } from 'react-native';
2 | import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
3 |
4 | export interface A11yGroupNativeComponentProps extends ViewProps {}
5 |
6 | export default codegenNativeComponent(
7 | 'A11yGroupView'
8 | );
9 |
--------------------------------------------------------------------------------
/src/nativeSpecs/A11yIndexNativeComponent.ts:
--------------------------------------------------------------------------------
1 | import { ComponentType } from 'react';
2 | import type { ViewProps } from 'react-native';
3 | import { Int32 } from 'react-native/Libraries/Types/CodegenTypes';
4 | import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
5 | import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
6 |
7 | export interface A11yIndexNativeComponentProps extends ViewProps {
8 | orderIndex: Int32;
9 | orderKey: string;
10 | }
11 |
12 | export interface NativeCommands {
13 | focus: (viewRef: React.ElementRef) => void;
14 | }
15 |
16 | export const Commands: NativeCommands = codegenNativeCommands({
17 | supportedCommands: ['focus'],
18 | });
19 |
20 | export default codegenNativeComponent(
21 | 'A11yIndexView'
22 | );
23 |
--------------------------------------------------------------------------------
/src/nativeSpecs/A11yOrderNativeComponent.ts:
--------------------------------------------------------------------------------
1 | import type { ViewProps } from 'react-native';
2 | import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
3 |
4 | export interface A11yOrderNativeComponentProps extends ViewProps {
5 | orderKey: string;
6 | }
7 |
8 | export default codegenNativeComponent(
9 | 'A11yOrderView'
10 | );
11 |
--------------------------------------------------------------------------------
/src/types/A11yGroup.types.ts:
--------------------------------------------------------------------------------
1 | import { ViewProps } from 'react-native';
2 |
3 | export type A11yGroupProps = React.PropsWithChildren;
4 |
--------------------------------------------------------------------------------
/src/types/A11yIndex.types.ts:
--------------------------------------------------------------------------------
1 | import { ViewProps } from 'react-native';
2 |
3 | export type IndexCommands = { focus: () => void };
4 |
5 | export type A11yIndexProps = {
6 | children: React.ReactNode;
7 | index: number;
8 | } & ViewProps;
9 |
--------------------------------------------------------------------------------
/src/types/A11yModule.types.ts:
--------------------------------------------------------------------------------
1 | import { RefObject } from 'react';
2 | import { View } from 'react-native';
3 |
4 | export type A11yOrderInfo = {
5 | tag?: RefObject;
6 | views: (T | null)[];
7 | };
8 |
--------------------------------------------------------------------------------
/src/types/A11yOrder.types.ts:
--------------------------------------------------------------------------------
1 | import type { ViewProps, View } from 'react-native';
2 |
3 | export type A11yOrderProps = {
4 | a11yOrder: {
5 | ref: React.RefObject;
6 | onLayout: () => void;
7 | };
8 | ignoreWarn?: boolean;
9 | } & ViewProps;
10 |
--------------------------------------------------------------------------------
/tsconfig.build.json:
--------------------------------------------------------------------------------
1 |
2 | {
3 | "extends": "./tsconfig",
4 | "exclude": ["example"]
5 | }
6 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "baseUrl": "./",
4 | "paths": {
5 | "react-native-a11y-order": ["./src/index"]
6 | },
7 | "allowUnreachableCode": false,
8 | "allowUnusedLabels": false,
9 | "esModuleInterop": true,
10 | "forceConsistentCasingInFileNames": true,
11 | "jsx": "react",
12 | "lib": ["esnext"],
13 | "module": "esnext",
14 | "moduleResolution": "node",
15 | "noFallthroughCasesInSwitch": true,
16 | "noImplicitReturns": true,
17 | "noImplicitUseStrict": false,
18 | "noStrictGenericChecks": false,
19 | "noUncheckedIndexedAccess": true,
20 | "noUnusedLocals": true,
21 | "noUnusedParameters": true,
22 | "resolveJsonModule": true,
23 | "skipLibCheck": true,
24 | "strict": true,
25 | "target": "esnext"
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/types/index.d.ts:
--------------------------------------------------------------------------------
1 | export {};
2 |
3 | declare module 'react' {
4 | function useId(): string;
5 | declare const useId: useId | undefined;
6 | }
7 |
--------------------------------------------------------------------------------