react-native-external-keyboard 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/README.md +113 -0
- package/android/Android.mk +45 -0
- package/android/build.gradle +139 -0
- package/android/gradle.properties +5 -0
- package/android/registration.cpp +18 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/com/externalkeyboard/A11yKeyboardModule.java +46 -0
- package/android/src/main/java/com/externalkeyboard/ExternalKeyboardViewPackage.java +63 -0
- package/android/src/main/java/com/externalkeyboard/events/FocusChangeEvent.java +39 -0
- package/android/src/main/java/com/externalkeyboard/events/KeyPressDownEvent.java +49 -0
- package/android/src/main/java/com/externalkeyboard/events/KeyPressUpEvent.java +49 -0
- package/android/src/main/java/com/externalkeyboard/services/KeyboardKeyPressHandler.java +56 -0
- package/android/src/main/java/com/externalkeyboard/services/KeyboardService.java +52 -0
- package/android/src/main/java/com/externalkeyboard/views/ExternalKeyboardView/ExternalKeyboardView.java +28 -0
- package/android/src/main/java/com/externalkeyboard/views/ExternalKeyboardView/ExternalKeyboardViewManager.java +101 -0
- package/android/src/newarch/A11yKeyboardModuleSpec.java +9 -0
- package/android/src/newarch/ExternalKeyboardViewManagerSpec.java +31 -0
- package/android/src/oldarch/A11yKeyboardModuleSpec.java +15 -0
- package/android/src/oldarch/ExternalKeyboardViewManagerSpec.java +9 -0
- package/ios/ExternalKeyboard.xcodeproj/project.pbxproj +384 -0
- package/ios/ExternalKeyboard.xcodeproj/project.xcworkspace/contents.xcworkspacedata +4 -0
- package/ios/ExternalKeyboard.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/ExternalKeyboard.xcodeproj/project.xcworkspace/xcuserdata/Artur_Kalach.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/ExternalKeyboard.xcodeproj/xcuserdata/Artur_Kalach.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +24 -0
- package/ios/ExternalKeyboard.xcodeproj/xcuserdata/Artur_Kalach.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/ios/ExternalKeyboardView/ExternalKeyboardView.h +41 -0
- package/ios/ExternalKeyboardView/ExternalKeyboardView.mm +186 -0
- package/ios/Helpers/FocusWrapper/FocusWrapper.h +32 -0
- package/ios/Helpers/FocusWrapper/FocusWrapper.mm +63 -0
- package/ios/Helpers/KeyboardKeyPressHandler/KeyboardKeyPressHandler.h +27 -0
- package/ios/Helpers/KeyboardKeyPressHandler/KeyboardKeyPressHandler.mm +73 -0
- package/ios/Modules/A11yKeyboardModule/A11yKeyboardModule.h +20 -0
- package/ios/Modules/A11yKeyboardModule/A11yKeyboardModule.mm +86 -0
- package/ios/ViewManagers/ExternalKeyboardViewManager/ExternalKeyboardViewManager.h +16 -0
- package/ios/ViewManagers/ExternalKeyboardViewManager/ExternalKeyboardViewManager.mm +29 -0
- package/lib/commonjs/NativeModules/A11yKeyboardModule/A11yKeyboardModule.js +33 -0
- package/lib/commonjs/NativeModules/A11yKeyboardModule/A11yKeyboardModule.js.map +1 -0
- package/lib/commonjs/NativeModules/A11yKeyboardModule/index.js +13 -0
- package/lib/commonjs/NativeModules/A11yKeyboardModule/index.js.map +1 -0
- package/lib/commonjs/NativeModules/index.js +13 -0
- package/lib/commonjs/NativeModules/index.js.map +1 -0
- package/lib/commonjs/components/KeyboardFocusView/KeyboardFocusView.android.js +41 -0
- package/lib/commonjs/components/KeyboardFocusView/KeyboardFocusView.android.js.map +1 -0
- package/lib/commonjs/components/KeyboardFocusView/KeyboardFocusView.d.js +6 -0
- package/lib/commonjs/components/KeyboardFocusView/KeyboardFocusView.d.js.map +1 -0
- package/lib/commonjs/components/KeyboardFocusView/KeyboardFocusView.ios.js +46 -0
- package/lib/commonjs/components/KeyboardFocusView/KeyboardFocusView.ios.js.map +1 -0
- package/lib/commonjs/components/KeyboardFocusView/hooks/index.js +13 -0
- package/lib/commonjs/components/KeyboardFocusView/hooks/index.js.map +1 -0
- package/lib/commonjs/components/KeyboardFocusView/hooks/useFocusStyle/index.js +13 -0
- package/lib/commonjs/components/KeyboardFocusView/hooks/useFocusStyle/index.js.map +1 -0
- package/lib/commonjs/components/KeyboardFocusView/hooks/useFocusStyle/useFocusStyle.js +33 -0
- package/lib/commonjs/components/KeyboardFocusView/hooks/useFocusStyle/useFocusStyle.js.map +1 -0
- package/lib/commonjs/components/KeyboardFocusView/index.js +13 -0
- package/lib/commonjs/components/KeyboardFocusView/index.js.map +1 -0
- package/lib/commonjs/components/Pressable/Pressable.android.js +76 -0
- package/lib/commonjs/components/Pressable/Pressable.android.js.map +1 -0
- package/lib/commonjs/components/Pressable/Pressable.d.js +6 -0
- package/lib/commonjs/components/Pressable/Pressable.d.js.map +1 -0
- package/lib/commonjs/components/Pressable/Pressable.ios.js +157 -0
- package/lib/commonjs/components/Pressable/Pressable.ios.js.map +1 -0
- package/lib/commonjs/components/Pressable/index.js +13 -0
- package/lib/commonjs/components/Pressable/index.js.map +1 -0
- package/lib/commonjs/components/index.js +20 -0
- package/lib/commonjs/components/index.js.map +1 -0
- package/lib/commonjs/index.js +46 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/nativeSpec/ExternalKeyboardViewNativeComponent.js +11 -0
- package/lib/commonjs/nativeSpec/ExternalKeyboardViewNativeComponent.js.map +1 -0
- package/lib/commonjs/nativeSpec/NativeKeyboardModule.js +10 -0
- package/lib/commonjs/nativeSpec/NativeKeyboardModule.js.map +1 -0
- package/lib/commonjs/nativeSpec/index.js +21 -0
- package/lib/commonjs/nativeSpec/index.js.map +1 -0
- package/lib/commonjs/services/A11yModule/A11yModule.android.js +22 -0
- package/lib/commonjs/services/A11yModule/A11yModule.android.js.map +1 -0
- package/lib/commonjs/services/A11yModule/A11yModule.d.js +6 -0
- package/lib/commonjs/services/A11yModule/A11yModule.d.js.map +1 -0
- package/lib/commonjs/services/A11yModule/A11yModule.ios.js +28 -0
- package/lib/commonjs/services/A11yModule/A11yModule.ios.js.map +1 -0
- package/lib/commonjs/services/A11yModule/A11yModule.types.js +6 -0
- package/lib/commonjs/services/A11yModule/A11yModule.types.js.map +1 -0
- package/lib/commonjs/services/A11yModule/index.js +13 -0
- package/lib/commonjs/services/A11yModule/index.js.map +1 -0
- package/lib/commonjs/services/index.js +13 -0
- package/lib/commonjs/services/index.js.map +1 -0
- package/lib/commonjs/types/FocusStyle.js +6 -0
- package/lib/commonjs/types/FocusStyle.js.map +1 -0
- package/lib/commonjs/types/KeyboardFocusView.types.js +6 -0
- package/lib/commonjs/types/KeyboardFocusView.types.js.map +1 -0
- package/lib/commonjs/types/index.js +38 -0
- package/lib/commonjs/types/index.js.map +1 -0
- package/lib/module/NativeModules/A11yKeyboardModule/A11yKeyboardModule.js +26 -0
- package/lib/module/NativeModules/A11yKeyboardModule/A11yKeyboardModule.js.map +1 -0
- package/lib/module/NativeModules/A11yKeyboardModule/index.js +2 -0
- package/lib/module/NativeModules/A11yKeyboardModule/index.js.map +1 -0
- package/lib/module/NativeModules/index.js +2 -0
- package/lib/module/NativeModules/index.js.map +1 -0
- package/lib/module/components/KeyboardFocusView/KeyboardFocusView.android.js +33 -0
- package/lib/module/components/KeyboardFocusView/KeyboardFocusView.android.js.map +1 -0
- package/lib/module/components/KeyboardFocusView/KeyboardFocusView.d.js +2 -0
- package/lib/module/components/KeyboardFocusView/KeyboardFocusView.d.js.map +1 -0
- package/lib/module/components/KeyboardFocusView/KeyboardFocusView.ios.js +37 -0
- package/lib/module/components/KeyboardFocusView/KeyboardFocusView.ios.js.map +1 -0
- package/lib/module/components/KeyboardFocusView/hooks/index.js +2 -0
- package/lib/module/components/KeyboardFocusView/hooks/index.js.map +1 -0
- package/lib/module/components/KeyboardFocusView/hooks/useFocusStyle/index.js +2 -0
- package/lib/module/components/KeyboardFocusView/hooks/useFocusStyle/index.js.map +1 -0
- package/lib/module/components/KeyboardFocusView/hooks/useFocusStyle/useFocusStyle.js +26 -0
- package/lib/module/components/KeyboardFocusView/hooks/useFocusStyle/useFocusStyle.js.map +1 -0
- package/lib/module/components/KeyboardFocusView/index.js +2 -0
- package/lib/module/components/KeyboardFocusView/index.js.map +1 -0
- package/lib/module/components/Pressable/Pressable.android.js +70 -0
- package/lib/module/components/Pressable/Pressable.android.js.map +1 -0
- package/lib/module/components/Pressable/Pressable.d.js +2 -0
- package/lib/module/components/Pressable/Pressable.d.js.map +1 -0
- package/lib/module/components/Pressable/Pressable.ios.js +148 -0
- package/lib/module/components/Pressable/Pressable.ios.js.map +1 -0
- package/lib/module/components/Pressable/index.js +2 -0
- package/lib/module/components/Pressable/index.js.map +1 -0
- package/lib/module/components/index.js +3 -0
- package/lib/module/components/index.js.map +1 -0
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/nativeSpec/ExternalKeyboardViewNativeComponent.js +3 -0
- package/lib/module/nativeSpec/ExternalKeyboardViewNativeComponent.js.map +1 -0
- package/lib/module/nativeSpec/NativeKeyboardModule.js +3 -0
- package/lib/module/nativeSpec/NativeKeyboardModule.js.map +1 -0
- package/lib/module/nativeSpec/index.js +4 -0
- package/lib/module/nativeSpec/index.js.map +1 -0
- package/lib/module/services/A11yModule/A11yModule.android.js +15 -0
- package/lib/module/services/A11yModule/A11yModule.android.js.map +1 -0
- package/lib/module/services/A11yModule/A11yModule.d.js +2 -0
- package/lib/module/services/A11yModule/A11yModule.d.js.map +1 -0
- package/lib/module/services/A11yModule/A11yModule.ios.js +21 -0
- package/lib/module/services/A11yModule/A11yModule.ios.js.map +1 -0
- package/lib/module/services/A11yModule/A11yModule.types.js +2 -0
- package/lib/module/services/A11yModule/A11yModule.types.js.map +1 -0
- package/lib/module/services/A11yModule/index.js +2 -0
- package/lib/module/services/A11yModule/index.js.map +1 -0
- package/lib/module/services/index.js +2 -0
- package/lib/module/services/index.js.map +1 -0
- package/lib/module/types/FocusStyle.js +2 -0
- package/lib/module/types/FocusStyle.js.map +1 -0
- package/lib/module/types/KeyboardFocusView.types.js +2 -0
- package/lib/module/types/KeyboardFocusView.types.js.map +1 -0
- package/lib/module/types/index.js +3 -0
- package/lib/module/types/index.js.map +1 -0
- package/lib/typescript/NativeModules/A11yKeyboardModule/A11yKeyboardModule.d.ts +5 -0
- package/lib/typescript/NativeModules/A11yKeyboardModule/A11yKeyboardModule.d.ts.map +1 -0
- package/lib/typescript/NativeModules/A11yKeyboardModule/index.d.ts +2 -0
- package/lib/typescript/NativeModules/A11yKeyboardModule/index.d.ts.map +1 -0
- package/lib/typescript/NativeModules/index.d.ts +2 -0
- package/lib/typescript/NativeModules/index.d.ts.map +1 -0
- package/lib/typescript/components/KeyboardFocusView/KeyboardFocusView.android.d.ts +14 -0
- package/lib/typescript/components/KeyboardFocusView/KeyboardFocusView.android.d.ts.map +1 -0
- package/lib/typescript/components/KeyboardFocusView/KeyboardFocusView.ios.d.ts +14 -0
- package/lib/typescript/components/KeyboardFocusView/KeyboardFocusView.ios.d.ts.map +1 -0
- package/lib/typescript/components/KeyboardFocusView/hooks/index.d.ts +2 -0
- package/lib/typescript/components/KeyboardFocusView/hooks/index.d.ts.map +1 -0
- package/lib/typescript/components/KeyboardFocusView/hooks/useFocusStyle/index.d.ts +2 -0
- package/lib/typescript/components/KeyboardFocusView/hooks/useFocusStyle/index.d.ts.map +1 -0
- package/lib/typescript/components/KeyboardFocusView/hooks/useFocusStyle/useFocusStyle.d.ts +8 -0
- package/lib/typescript/components/KeyboardFocusView/hooks/useFocusStyle/useFocusStyle.d.ts.map +1 -0
- package/lib/typescript/components/KeyboardFocusView/index.d.ts +2 -0
- package/lib/typescript/components/KeyboardFocusView/index.d.ts.map +1 -0
- package/lib/typescript/components/Pressable/Pressable.android.d.ts +24 -0
- package/lib/typescript/components/Pressable/Pressable.android.d.ts.map +1 -0
- package/lib/typescript/components/Pressable/Pressable.ios.d.ts +88 -0
- package/lib/typescript/components/Pressable/Pressable.ios.d.ts.map +1 -0
- package/lib/typescript/components/Pressable/index.d.ts +2 -0
- package/lib/typescript/components/Pressable/index.d.ts.map +1 -0
- package/lib/typescript/components/index.d.ts +3 -0
- package/lib/typescript/components/index.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +5 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/nativeSpec/ExternalKeyboardViewNativeComponent.d.ts +30 -0
- package/lib/typescript/nativeSpec/ExternalKeyboardViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/nativeSpec/NativeKeyboardModule.d.ts +8 -0
- package/lib/typescript/nativeSpec/NativeKeyboardModule.d.ts.map +1 -0
- package/lib/typescript/nativeSpec/index.d.ts +5 -0
- package/lib/typescript/nativeSpec/index.d.ts.map +1 -0
- package/lib/typescript/services/A11yModule/A11yModule.android.d.ts +9 -0
- package/lib/typescript/services/A11yModule/A11yModule.android.d.ts.map +1 -0
- package/lib/typescript/services/A11yModule/A11yModule.ios.d.ts +10 -0
- package/lib/typescript/services/A11yModule/A11yModule.ios.d.ts.map +1 -0
- package/lib/typescript/services/A11yModule/A11yModule.types.d.ts +12 -0
- package/lib/typescript/services/A11yModule/A11yModule.types.d.ts.map +1 -0
- package/lib/typescript/services/A11yModule/index.d.ts +2 -0
- package/lib/typescript/services/A11yModule/index.d.ts.map +1 -0
- package/lib/typescript/services/index.d.ts +2 -0
- package/lib/typescript/services/index.d.ts.map +1 -0
- package/lib/typescript/types/FocusStyle.d.ts +6 -0
- package/lib/typescript/types/FocusStyle.d.ts.map +1 -0
- package/lib/typescript/types/KeyboardFocusView.types.d.ts +36 -0
- package/lib/typescript/types/KeyboardFocusView.types.d.ts.map +1 -0
- package/lib/typescript/types/index.d.ts +3 -0
- package/lib/typescript/types/index.d.ts.map +1 -0
- package/package.json +165 -0
- package/react-native-external-keyboard.podspec +36 -0
- package/src/NativeModules/A11yKeyboardModule/A11yKeyboardModule.ts +37 -0
- package/src/NativeModules/A11yKeyboardModule/index.ts +1 -0
- package/src/NativeModules/index.ts +1 -0
- package/src/components/KeyboardFocusView/KeyboardFocusView.android.tsx +41 -0
- package/src/components/KeyboardFocusView/KeyboardFocusView.d.ts +7 -0
- package/src/components/KeyboardFocusView/KeyboardFocusView.ios.tsx +51 -0
- package/src/components/KeyboardFocusView/hooks/index.ts +1 -0
- package/src/components/KeyboardFocusView/hooks/useFocusStyle/index.ts +1 -0
- package/src/components/KeyboardFocusView/hooks/useFocusStyle/useFocusStyle.ts +31 -0
- package/src/components/KeyboardFocusView/index.ts +1 -0
- package/src/components/Pressable/Pressable.android.tsx +95 -0
- package/src/components/Pressable/Pressable.d.ts +7 -0
- package/src/components/Pressable/Pressable.ios.tsx +282 -0
- package/src/components/Pressable/index.ts +1 -0
- package/src/components/index.ts +2 -0
- package/src/index.tsx +5 -0
- package/src/nativeSpec/ExternalKeyboardViewNativeComponent.ts +37 -0
- package/src/nativeSpec/NativeKeyboardModule.ts +9 -0
- package/src/nativeSpec/index.ts +6 -0
- package/src/services/A11yModule/A11yModule.android.ts +20 -0
- package/src/services/A11yModule/A11yModule.d.ts +3 -0
- package/src/services/A11yModule/A11yModule.ios.ts +33 -0
- package/src/services/A11yModule/A11yModule.types.ts +15 -0
- package/src/services/A11yModule/index.ts +1 -0
- package/src/services/index.ts +1 -0
- package/src/types/FocusStyle.ts +10 -0
- package/src/types/KeyboardFocusView.types.ts +43 -0
- package/src/types/index.ts +6 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExternalKeyboardViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/nativeSpec/ExternalKeyboardViewNativeComponent.ts"],"names":[],"mappings":";;AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EACV,oBAAoB,EACpB,KAAK,EACN,MAAM,2CAA2C,CAAC;AAEnD,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;IACjC,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,QAAQ,CAAC;IAC9B,OAAO,EAAE,KAAK,CAAC;IACf,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,cAAc,EAAE,OAAO,CAAC;IACxB,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY,EAAE,OAAO,CAAC;IACtB,cAAc,EAAE,OAAO,CAAC;CACzB,CAAC,CAAC;AAEH,MAAM,WAAW,2BAA4B,SAAQ,SAAS;IAC5D,aAAa,CAAC,EAAE,oBAAoB,CAAC,WAAW,CAAC,CAAC;IAClD,YAAY,CAAC,EAAE,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IAC9C,cAAc,CAAC,EAAE,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IAChD,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;;AAED,wBAEE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
export interface Spec extends TurboModule {
|
|
3
|
+
setKeyboardFocus: (nativeTag: number, nextTag: number) => void;
|
|
4
|
+
setPreferredKeyboardFocus: (nativeTag: number, nextTag: number) => void;
|
|
5
|
+
}
|
|
6
|
+
declare const _default: Spec | null;
|
|
7
|
+
export default _default;
|
|
8
|
+
//# sourceMappingURL=NativeKeyboardModule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeKeyboardModule.d.ts","sourceRoot":"","sources":["../../../src/nativeSpec/NativeKeyboardModule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,gBAAgB,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/D,yBAAyB,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACzE;;AAED,wBAAmE"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import ExternalKeyboardView from './ExternalKeyboardViewNativeComponent';
|
|
2
|
+
import NativeKeyboardModule from './NativeKeyboardModule';
|
|
3
|
+
import type { KeyPress } from './ExternalKeyboardViewNativeComponent';
|
|
4
|
+
export { ExternalKeyboardView, NativeKeyboardModule, KeyPress };
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/nativeSpec/index.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,MAAM,uCAAuC,CAAC;AACzE,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAE1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AAEtE,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { IA11yModule } from './A11yModule.types';
|
|
3
|
+
declare class A11yAndroidImpl implements IA11yModule {
|
|
4
|
+
setKeyboardFocus(ref: React.RefObject<React.Component>): void;
|
|
5
|
+
setPreferredKeyboardFocus: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const A11yModule: A11yAndroidImpl;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=A11yModule.android.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A11yModule.android.d.ts","sourceRoot":"","sources":["../../../../src/services/A11yModule/A11yModule.android.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAItD,cAAM,eAAgB,YAAW,WAAW;IAC1C,gBAAgB,CAAC,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,CAAC;IAStD,yBAAyB,aAAY;CACtC;AAED,eAAO,MAAM,UAAU,iBAAwB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IA11yModule, RefObjType } from './A11yModule.types';
|
|
2
|
+
declare class A11yModuleIOSImpl implements IA11yModule {
|
|
3
|
+
private _currentFocusedTag;
|
|
4
|
+
set currentFocusedTag(value: number);
|
|
5
|
+
setPreferredKeyboardFocus: (tag: number, targetTag: number) => void;
|
|
6
|
+
setKeyboardFocus: (ref: RefObjType) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const A11yModule: A11yModuleIOSImpl;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=A11yModule.ios.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A11yModule.ios.d.ts","sourceRoot":"","sources":["../../../../src/services/A11yModule/A11yModule.ios.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGlE,cAAM,iBAAkB,YAAW,WAAW;IAC5C,OAAO,CAAC,kBAAkB,CAAuB;IAEjD,IAAI,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAElC;IAED,yBAAyB,QAAS,MAAM,aAAa,MAAM,UAIzD;IAEF,gBAAgB,4BAWd;CACH;AAED,eAAO,MAAM,UAAU,mBAA0B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
export type A11yNativeModule = {
|
|
3
|
+
setKeyboardFocus: (nativeTag: number, nextTag?: number) => void;
|
|
4
|
+
setPreferredKeyboardFocus: (nativeTag: number, nextTag: number) => void;
|
|
5
|
+
};
|
|
6
|
+
export type RefObjType = RefObject<React.Component<{}, {}, unknown>>;
|
|
7
|
+
export interface IA11yModule {
|
|
8
|
+
currentFocusedTag?: number;
|
|
9
|
+
setPreferredKeyboardFocus: (nativeTag: number, nextTag: number) => void;
|
|
10
|
+
setKeyboardFocus: (ref: RefObjType) => void;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=A11yModule.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A11yModule.types.d.ts","sourceRoot":"","sources":["../../../../src/services/A11yModule/A11yModule.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,gBAAgB,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAChE,yBAAyB,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACzE,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,SAAS,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC;AAErE,MAAM,WAAW,WAAW;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,yBAAyB,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACxE,gBAAgB,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,IAAI,CAAC;CAC7C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/A11yModule/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
export type FocusStateCallbackType = {
|
|
3
|
+
readonly focused: boolean;
|
|
4
|
+
};
|
|
5
|
+
export type FocusStyle = StyleProp<ViewStyle> | ((state: FocusStateCallbackType) => StyleProp<ViewStyle>) | undefined;
|
|
6
|
+
//# sourceMappingURL=FocusStyle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FocusStyle.d.ts","sourceRoot":"","sources":["../../../src/types/FocusStyle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,UAAU,GAClB,SAAS,CAAC,SAAS,CAAC,GACpB,CAAC,CAAC,KAAK,EAAE,sBAAsB,KAAK,SAAS,CAAC,SAAS,CAAC,CAAC,GACzD,SAAS,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { GestureResponderEvent } from 'react-native';
|
|
2
|
+
import type { NativeSyntheticEvent, ViewProps } from 'react-native';
|
|
3
|
+
import type { FocusStyle } from './FocusStyle';
|
|
4
|
+
export type KeyboardFocusEvent = NativeSyntheticEvent<{
|
|
5
|
+
isFocused: boolean;
|
|
6
|
+
}>;
|
|
7
|
+
export type OnKeyPress = NativeSyntheticEvent<{
|
|
8
|
+
keyCode: number;
|
|
9
|
+
isLongPress: boolean;
|
|
10
|
+
isAltPressed: boolean;
|
|
11
|
+
isShiftPressed: boolean;
|
|
12
|
+
isCtrlPressed: boolean;
|
|
13
|
+
isCapsLockOn: boolean;
|
|
14
|
+
hasNoModifiers: boolean;
|
|
15
|
+
}>;
|
|
16
|
+
export type OnKeyPressFn = (e: OnKeyPress) => void;
|
|
17
|
+
export type OnFocusChangeFn = (e: KeyboardFocusEvent) => void;
|
|
18
|
+
export type FocusWrapperProps = ViewProps & {
|
|
19
|
+
onFocusChange?: OnFocusChangeFn;
|
|
20
|
+
onKeyUpPress?: OnKeyPressFn;
|
|
21
|
+
onKeyDownPress?: OnKeyPressFn;
|
|
22
|
+
canBeFocused?: boolean;
|
|
23
|
+
};
|
|
24
|
+
export type FocusStateCallbackType = {
|
|
25
|
+
readonly focused: boolean;
|
|
26
|
+
};
|
|
27
|
+
export type KeyboardFocusViewProps = FocusWrapperProps & {
|
|
28
|
+
focusStyle?: FocusStyle;
|
|
29
|
+
onPress?: (e: GestureResponderEvent | OnKeyPress) => void;
|
|
30
|
+
onLongPress?: (e: GestureResponderEvent | OnKeyPress) => void;
|
|
31
|
+
/**
|
|
32
|
+
* @platform android
|
|
33
|
+
*/
|
|
34
|
+
withView?: boolean;
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=KeyboardFocusView.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KeyboardFocusView.types.d.ts","sourceRoot":"","sources":["../../../src/types/KeyboardFocusView.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;IACpD,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,oBAAoB,CAAC;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,cAAc,EAAE,OAAO,CAAC;IACxB,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY,EAAE,OAAO,CAAC;IACtB,cAAc,EAAE,OAAO,CAAC;CACzB,CAAC,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;AACnD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,EAAE,kBAAkB,KAAK,IAAI,CAAC;AAE9D,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG;IAC1C,aAAa,CAAC,EAAE,eAAe,CAAC;IAChC,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,cAAc,CAAC,EAAE,YAAY,CAAC;IAC9B,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,iBAAiB,GAAG;IACvD,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,qBAAqB,GAAG,UAAU,KAAK,IAAI,CAAC;IAC1D,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,qBAAqB,GAAG,UAAU,KAAK,IAAI,CAAC;IAE9D;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,YAAY,GACb,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-native-external-keyboard",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "test",
|
|
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
|
+
"example": "yarn --cwd example",
|
|
36
|
+
"bootstrap": "yarn example && yarn install && yarn example pods",
|
|
37
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build"
|
|
38
|
+
},
|
|
39
|
+
"keywords": [
|
|
40
|
+
"react-native",
|
|
41
|
+
"ios",
|
|
42
|
+
"android"
|
|
43
|
+
],
|
|
44
|
+
"repository": "https://github.com/ArturKalach/react-native-external-keyboard",
|
|
45
|
+
"author": "Artur Kalach <artur.kalach.andreevich@gmail.com> (https://github.com/ArturKalach)",
|
|
46
|
+
"license": "MIT",
|
|
47
|
+
"bugs": {
|
|
48
|
+
"url": "https://github.com/ArturKalach/react-native-external-keyboard/issues"
|
|
49
|
+
},
|
|
50
|
+
"homepage": "https://github.com/ArturKalach/react-native-external-keyboard#readme",
|
|
51
|
+
"publishConfig": {
|
|
52
|
+
"registry": "https://registry.npmjs.org/"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@evilmartians/lefthook": "^1.2.2",
|
|
56
|
+
"@commitlint/config-conventional": "^17.0.2",
|
|
57
|
+
"@react-native-community/eslint-config": "^3.0.2",
|
|
58
|
+
"@release-it/conventional-changelog": "^5.0.0",
|
|
59
|
+
"@types/jest": "^28.1.2",
|
|
60
|
+
"@types/react": "~17.0.21",
|
|
61
|
+
"@types/react-native": "0.70.0",
|
|
62
|
+
"commitlint": "^17.0.2",
|
|
63
|
+
"del-cli": "^5.0.0",
|
|
64
|
+
"eslint": "^8.4.1",
|
|
65
|
+
"eslint-config-prettier": "^8.5.0",
|
|
66
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
67
|
+
"jest": "^28.1.1",
|
|
68
|
+
"pod-install": "^0.1.0",
|
|
69
|
+
"prettier": "^2.0.5",
|
|
70
|
+
"react": "18.2.0",
|
|
71
|
+
"react-native": "0.71.11",
|
|
72
|
+
"react-native-builder-bob": "^0.20.4",
|
|
73
|
+
"release-it": "^15.0.0",
|
|
74
|
+
"typescript": "^4.5.2"
|
|
75
|
+
},
|
|
76
|
+
"resolutions": {
|
|
77
|
+
"@types/react": "17.0.21"
|
|
78
|
+
},
|
|
79
|
+
"peerDependencies": {
|
|
80
|
+
"react": "*",
|
|
81
|
+
"react-native": "*"
|
|
82
|
+
},
|
|
83
|
+
"engines": {
|
|
84
|
+
"node": ">= 16.0.0"
|
|
85
|
+
},
|
|
86
|
+
"packageManager": "^yarn@1.22.15",
|
|
87
|
+
"jest": {
|
|
88
|
+
"preset": "react-native",
|
|
89
|
+
"modulePathIgnorePatterns": [
|
|
90
|
+
"<rootDir>/example/node_modules",
|
|
91
|
+
"<rootDir>/lib/"
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
"commitlint": {
|
|
95
|
+
"extends": [
|
|
96
|
+
"@commitlint/config-conventional"
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
"release-it": {
|
|
100
|
+
"git": {
|
|
101
|
+
"commitMessage": "chore: release ${version}",
|
|
102
|
+
"tagName": "v${version}"
|
|
103
|
+
},
|
|
104
|
+
"npm": {
|
|
105
|
+
"publish": true
|
|
106
|
+
},
|
|
107
|
+
"github": {
|
|
108
|
+
"release": true
|
|
109
|
+
},
|
|
110
|
+
"plugins": {
|
|
111
|
+
"@release-it/conventional-changelog": {
|
|
112
|
+
"preset": "angular"
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"eslintConfig": {
|
|
117
|
+
"root": true,
|
|
118
|
+
"extends": [
|
|
119
|
+
"@react-native-community",
|
|
120
|
+
"prettier"
|
|
121
|
+
],
|
|
122
|
+
"rules": {
|
|
123
|
+
"prettier/prettier": [
|
|
124
|
+
"error",
|
|
125
|
+
{
|
|
126
|
+
"quoteProps": "consistent",
|
|
127
|
+
"singleQuote": true,
|
|
128
|
+
"tabWidth": 2,
|
|
129
|
+
"trailingComma": "es5",
|
|
130
|
+
"useTabs": false
|
|
131
|
+
}
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
"eslintIgnore": [
|
|
136
|
+
"node_modules/",
|
|
137
|
+
"lib/"
|
|
138
|
+
],
|
|
139
|
+
"prettier": {
|
|
140
|
+
"quoteProps": "consistent",
|
|
141
|
+
"singleQuote": true,
|
|
142
|
+
"tabWidth": 2,
|
|
143
|
+
"trailingComma": "es5",
|
|
144
|
+
"useTabs": false
|
|
145
|
+
},
|
|
146
|
+
"react-native-builder-bob": {
|
|
147
|
+
"source": "src",
|
|
148
|
+
"output": "lib",
|
|
149
|
+
"targets": [
|
|
150
|
+
"commonjs",
|
|
151
|
+
"module",
|
|
152
|
+
[
|
|
153
|
+
"typescript",
|
|
154
|
+
{
|
|
155
|
+
"project": "tsconfig.build.json"
|
|
156
|
+
}
|
|
157
|
+
]
|
|
158
|
+
]
|
|
159
|
+
},
|
|
160
|
+
"codegenConfig": {
|
|
161
|
+
"name": "RNExternalKeyboardViewSpec",
|
|
162
|
+
"type": "all",
|
|
163
|
+
"jsSrcsDir": "src/nativeSpec"
|
|
164
|
+
}
|
|
165
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
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-external-keyboard"
|
|
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-external-keyboard.git", :tag => "#{s.version}" }
|
|
16
|
+
|
|
17
|
+
s.source_files = "ios/**/*.{h,m,mm}"
|
|
18
|
+
|
|
19
|
+
s.dependency "React-Core"
|
|
20
|
+
|
|
21
|
+
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
22
|
+
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
|
23
|
+
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
|
24
|
+
s.pod_target_xcconfig = {
|
|
25
|
+
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
|
26
|
+
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
|
|
27
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
|
28
|
+
}
|
|
29
|
+
s.dependency "React-RCTFabric"
|
|
30
|
+
s.dependency "React-Codegen"
|
|
31
|
+
s.dependency "RCT-Folly"
|
|
32
|
+
s.dependency "RCTRequired"
|
|
33
|
+
s.dependency "RCTTypeSafety"
|
|
34
|
+
s.dependency "ReactCommon/turbomodule/core"
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { NativeModules, Platform } from 'react-native';
|
|
2
|
+
const LINKING_ERROR =
|
|
3
|
+
`The package 'react-native-external-keyboard' doesn't seem to be linked. Make sure: \n\n${Platform.select(
|
|
4
|
+
{ ios: "- You have run 'pod install'\n", default: '' }
|
|
5
|
+
)}- You rebuilt the app after installing the package\n` +
|
|
6
|
+
`- You are not using Expo Go\n`;
|
|
7
|
+
|
|
8
|
+
// @ts-expect-error
|
|
9
|
+
const isTurboModuleEnabled = global.__turboModuleProxy != null;
|
|
10
|
+
|
|
11
|
+
const A11yModule = isTurboModuleEnabled
|
|
12
|
+
? require('../../nativeSpec/NativeKeyboardModule').default
|
|
13
|
+
: NativeModules.A11yKeyboardModule;
|
|
14
|
+
|
|
15
|
+
const RCA11y =
|
|
16
|
+
A11yModule ||
|
|
17
|
+
new Proxy(
|
|
18
|
+
{},
|
|
19
|
+
{
|
|
20
|
+
get() {
|
|
21
|
+
throw new Error(LINKING_ERROR);
|
|
22
|
+
},
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
const setKeyboardFocus = (nativeTag: number, _nextTag = 0) => {
|
|
27
|
+
RCA11y.setKeyboardFocus(nativeTag, _nextTag);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const setPreferredKeyboardFocus = (nativeTag: number, nextTag: number) => {
|
|
31
|
+
RCA11y.setAccessibilityFocus(nativeTag, nextTag);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const A11yKeyboardModule = {
|
|
35
|
+
setKeyboardFocus,
|
|
36
|
+
setPreferredKeyboardFocus,
|
|
37
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { A11yKeyboardModule } from './A11yKeyboardModule';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { A11yKeyboardModule } from './A11yKeyboardModule';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { useFocusStyle } from './hooks/useFocusStyle';
|
|
4
|
+
import { ExternalKeyboardView } from '../../nativeSpec';
|
|
5
|
+
import type { KeyboardFocusViewProps } from '../../types';
|
|
6
|
+
|
|
7
|
+
export const KeyboardFocusView = React.forwardRef<View, KeyboardFocusViewProps>(
|
|
8
|
+
(
|
|
9
|
+
{
|
|
10
|
+
canBeFocused = true,
|
|
11
|
+
onFocusChange,
|
|
12
|
+
focusStyle,
|
|
13
|
+
children,
|
|
14
|
+
style,
|
|
15
|
+
withView = true,
|
|
16
|
+
onKeyUpPress,
|
|
17
|
+
onKeyDownPress,
|
|
18
|
+
...props
|
|
19
|
+
},
|
|
20
|
+
ref
|
|
21
|
+
) => {
|
|
22
|
+
const { fStyle, onFocusChangeHandler } = useFocusStyle(
|
|
23
|
+
focusStyle,
|
|
24
|
+
onFocusChange
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<ExternalKeyboardView
|
|
29
|
+
onFocusChange={onFocusChangeHandler}
|
|
30
|
+
style={[style, fStyle]}
|
|
31
|
+
canBeFocused={canBeFocused}
|
|
32
|
+
ref={ref}
|
|
33
|
+
onKeyUpPress={onKeyUpPress}
|
|
34
|
+
onKeyDownPress={onKeyDownPress}
|
|
35
|
+
{...props}
|
|
36
|
+
>
|
|
37
|
+
{withView ? <View accessible>{children}</View> : children}
|
|
38
|
+
</ExternalKeyboardView>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
);
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import type { View } from 'react-native';
|
|
3
|
+
import { ExternalKeyboardView } from '../../nativeSpec';
|
|
4
|
+
import type { KeyboardFocusViewProps } from '../../types';
|
|
5
|
+
import { A11yModule } from '../../services';
|
|
6
|
+
|
|
7
|
+
import { useFocusStyle } from './hooks';
|
|
8
|
+
|
|
9
|
+
export const KeyboardFocusView = React.forwardRef<View, KeyboardFocusViewProps>(
|
|
10
|
+
(
|
|
11
|
+
{
|
|
12
|
+
onFocusChange,
|
|
13
|
+
style,
|
|
14
|
+
focusStyle,
|
|
15
|
+
canBeFocused = true,
|
|
16
|
+
onKeyUpPress,
|
|
17
|
+
onKeyDownPress,
|
|
18
|
+
...props
|
|
19
|
+
},
|
|
20
|
+
ref
|
|
21
|
+
) => {
|
|
22
|
+
const setCurrentFocusTag = useCallback(
|
|
23
|
+
(e: { nativeEvent: { target: number } }) => {
|
|
24
|
+
A11yModule.currentFocusedTag = e?.nativeEvent?.target || undefined;
|
|
25
|
+
},
|
|
26
|
+
[]
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const onFocus = useCallback(
|
|
30
|
+
(e) => {
|
|
31
|
+
setCurrentFocusTag(e);
|
|
32
|
+
onFocusChange?.(e);
|
|
33
|
+
},
|
|
34
|
+
[onFocusChange, setCurrentFocusTag]
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const { fStyle, onFocusChangeHandler } = useFocusStyle(focusStyle, onFocus);
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<ExternalKeyboardView
|
|
41
|
+
ref={ref}
|
|
42
|
+
style={[style, fStyle]}
|
|
43
|
+
canBeFocused={canBeFocused}
|
|
44
|
+
onKeyUpPress={onKeyUpPress}
|
|
45
|
+
onKeyDownPress={onKeyDownPress}
|
|
46
|
+
onFocusChange={onFocusChangeHandler}
|
|
47
|
+
{...props}
|
|
48
|
+
/>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useFocusStyle } from './useFocusStyle';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useFocusStyle } from './useFocusStyle';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useState, useMemo } from 'react';
|
|
2
|
+
import { StyleSheet } from 'react-native';
|
|
3
|
+
import type { FocusStyle, OnFocusChangeFn } from 'src/types';
|
|
4
|
+
|
|
5
|
+
export const useFocusStyle = (
|
|
6
|
+
focusStyle?: FocusStyle,
|
|
7
|
+
onFocusChange?: OnFocusChangeFn
|
|
8
|
+
) => {
|
|
9
|
+
const [focused, setFocusStatus] = useState(false);
|
|
10
|
+
|
|
11
|
+
const onFocusChangeHandler: OnFocusChangeFn = (event) => {
|
|
12
|
+
setFocusStatus(event.nativeEvent.isFocused);
|
|
13
|
+
onFocusChange?.(event);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const fStyle = useMemo(() => {
|
|
17
|
+
if (!focusStyle) return focused ? styles.defaultHighlight : undefined;
|
|
18
|
+
const specificStyle =
|
|
19
|
+
typeof focusStyle === 'function' ? focusStyle({ focused }) : focusStyle;
|
|
20
|
+
return focused ? specificStyle : undefined;
|
|
21
|
+
}, [focused, focusStyle]);
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
onFocusChangeHandler,
|
|
25
|
+
fStyle,
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const styles = StyleSheet.create({
|
|
30
|
+
defaultHighlight: { backgroundColor: '#d8e2d9' },
|
|
31
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { KeyboardFocusView } from './KeyboardFocusView';
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow strict-local
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import {
|
|
13
|
+
GestureResponderEvent,
|
|
14
|
+
Pressable as RNPressable,
|
|
15
|
+
View,
|
|
16
|
+
PressableProps,
|
|
17
|
+
} from 'react-native';
|
|
18
|
+
import type { KeyboardFocusViewProps, OnKeyPressFn } from '../../types';
|
|
19
|
+
import { KeyboardFocusView } from '../KeyboardFocusView';
|
|
20
|
+
|
|
21
|
+
const ANDROID_SPACE_KEY_CODE = 62;
|
|
22
|
+
|
|
23
|
+
export const Pressable = React.forwardRef<
|
|
24
|
+
View,
|
|
25
|
+
PressableProps & KeyboardFocusViewProps
|
|
26
|
+
>(
|
|
27
|
+
(
|
|
28
|
+
{
|
|
29
|
+
canBeFocused,
|
|
30
|
+
focusStyle,
|
|
31
|
+
style,
|
|
32
|
+
onFocusChange,
|
|
33
|
+
onPress,
|
|
34
|
+
onLongPress,
|
|
35
|
+
onKeyDownPress,
|
|
36
|
+
onPressOut,
|
|
37
|
+
onPressIn,
|
|
38
|
+
...props
|
|
39
|
+
},
|
|
40
|
+
ref
|
|
41
|
+
) => {
|
|
42
|
+
const onKeyUpPressHandler = React.useCallback<OnKeyPressFn>(
|
|
43
|
+
(e) => {
|
|
44
|
+
const {
|
|
45
|
+
nativeEvent: { keyCode, isLongPress },
|
|
46
|
+
} = e;
|
|
47
|
+
|
|
48
|
+
if (keyCode === ANDROID_SPACE_KEY_CODE) {
|
|
49
|
+
onPressOut?.(e as unknown as GestureResponderEvent);
|
|
50
|
+
if (isLongPress) {
|
|
51
|
+
onLongPress?.(e);
|
|
52
|
+
} else {
|
|
53
|
+
onPress?.(e);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
[onLongPress, onPress, onPressOut]
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
const onPressablePressHandler = (event: GestureResponderEvent) => {
|
|
61
|
+
if (event.nativeEvent.identifier !== undefined) {
|
|
62
|
+
onPress?.(event);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const onKeyDownHandler = React.useCallback<OnKeyPressFn>(
|
|
67
|
+
(e) => {
|
|
68
|
+
onKeyDownPress?.(e);
|
|
69
|
+
onPressIn?.(e as unknown as GestureResponderEvent);
|
|
70
|
+
},
|
|
71
|
+
[onKeyDownPress, onPressIn]
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<KeyboardFocusView
|
|
76
|
+
style={style}
|
|
77
|
+
focusStyle={focusStyle}
|
|
78
|
+
ref={ref}
|
|
79
|
+
withView={false}
|
|
80
|
+
onKeyUpPress={onKeyUpPressHandler}
|
|
81
|
+
onKeyDownPress={onKeyDownHandler}
|
|
82
|
+
canBeFocused={canBeFocused}
|
|
83
|
+
onFocusChange={onFocusChange}
|
|
84
|
+
>
|
|
85
|
+
<RNPressable
|
|
86
|
+
onPressOut={onPressOut}
|
|
87
|
+
onPressIn={onPressIn}
|
|
88
|
+
onPress={onPressablePressHandler}
|
|
89
|
+
onLongPress={onLongPress}
|
|
90
|
+
{...props}
|
|
91
|
+
/>
|
|
92
|
+
</KeyboardFocusView>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
);
|