ArturKalach / react-native-a11y

A11y Library for RN
MIT License
41 stars 5 forks source link

.d.ts files in src/ are not being copied into lib/typescript/ #44

Closed ckknight closed 8 months ago

ckknight commented 10 months ago

It appears that 3 .d.ts files are missing from the built package that are causing some of the types to resolve as any.

I suspect this something to do with the build process. Other files in lib/typescript/ seem fine, and the only files with problems are those that are .d.ts files in the src/ folder.

Here is the patch (created via patch-package) that solves the problem for my local project:

diff --git a/node_modules/react-native-a11y/lib/typescript/components/KeyboardFocusView/KeyboardFocusView.d.ts b/node_modules/react-native-a11y/lib/typescript/components/KeyboardFocusView/KeyboardFocusView.d.ts
new file mode 100644
index 0000000..faa4c96
--- /dev/null
+++ b/node_modules/react-native-a11y/lib/typescript/components/KeyboardFocusView/KeyboardFocusView.d.ts
@@ -0,0 +1,7 @@
+import { View } from "react-native";
+
+import { KeyboardFocusViewProps } from "./KeyboardFocusView.types";
+
+declare const KeyboardFocusView: React.ForwardRefExoticComponent<
+  KeyboardFocusViewProps & React.RefAttributes<View>
+>;
diff --git a/node_modules/react-native-a11y/lib/typescript/components/Pressable/Pressable.d.ts b/node_modules/react-native-a11y/lib/typescript/components/Pressable/Pressable.d.ts
new file mode 100644
index 0000000..991cd04
--- /dev/null
+++ b/node_modules/react-native-a11y/lib/typescript/components/Pressable/Pressable.d.ts
@@ -0,0 +1,7 @@
+import { View, PressableProps } from "react-native";
+
+import { KeyboardFocusViewProps } from "../KeyboardFocusView";
+
+declare const Pressable: React.ForwardRefExoticComponent<
+  PressableProps & KeyboardFocusViewProps & React.RefAttributes<View>
+>;
diff --git a/node_modules/react-native-a11y/lib/typescript/modules/A11yModule/A11yModule.d.ts b/node_modules/react-native-a11y/lib/typescript/modules/A11yModule/A11yModule.d.ts
new file mode 100644
index 0000000..b8f396c
--- /dev/null
+++ b/node_modules/react-native-a11y/lib/typescript/modules/A11yModule/A11yModule.d.ts
@@ -0,0 +1,3 @@
+import { IA11yModule } from "./A11yModule.types";
+
+declare const A11yModule: IA11yModule;
ArturKalach commented 10 months ago

Hello @ckknight Thank you a lot for your comment, I am going to update this with next patch. I don't really like how this lib works, and thinking about decomposition a lot, but I am not sure how to combine libs with native code, additionaly, I am amazed why the lib have 1.1 MB unpacked size. The lib building and publishing is difficult 😥

Many thanks for the support and help

ArturKalach commented 10 months ago

Hello @ckknight, I fixed this issue and added some additional changes. I created release candidate: https://www.npmjs.com/package/react-native-a11y/v/0.4.3-rc and want to check it with different platforms and architecture. It can take some time, but I hope it will be finished this month.

Thank you for a help. Artur Kalach

ArturKalach commented 8 months ago

Has been resolved in v.0.4.3.