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,14 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>SchemeUserState</key>
|
|
6
|
+
<dict>
|
|
7
|
+
<key>ExternalKeyboard.xcscheme_^#shared#^_</key>
|
|
8
|
+
<dict>
|
|
9
|
+
<key>orderHint</key>
|
|
10
|
+
<integer>0</integer>
|
|
11
|
+
</dict>
|
|
12
|
+
</dict>
|
|
13
|
+
</dict>
|
|
14
|
+
</plist>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#ifndef ExternalKeyboardViewNativeComponent_h
|
|
2
|
+
#define ExternalKeyboardViewNativeComponent_h
|
|
3
|
+
|
|
4
|
+
#import "KeyboardKeyPressHandler.h"
|
|
5
|
+
#import <UIKit/UIKit.h>
|
|
6
|
+
|
|
7
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
8
|
+
#import <React/RCTViewComponentView.h>
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
12
|
+
|
|
13
|
+
@interface ExternalKeyboardView : RCTViewComponentView{
|
|
14
|
+
KeyboardKeyPressHandler* _keyboardKeyPressHandler;
|
|
15
|
+
}
|
|
16
|
+
@property BOOL canBeFocused;
|
|
17
|
+
@property UIView* myPreferredFocusedView;
|
|
18
|
+
@end
|
|
19
|
+
|
|
20
|
+
NS_ASSUME_NONNULL_END
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
#else /* RCT_NEW_ARCH_ENABLED */
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
#import <React/RCTView.h>
|
|
27
|
+
@interface ExternalKeyboardView : RCTView {
|
|
28
|
+
KeyboardKeyPressHandler* _keyboardKeyPressHandler;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@property BOOL canBeFocused;
|
|
32
|
+
@property UIView* myPreferredFocusedView;
|
|
33
|
+
@property (nonatomic, copy) RCTBubblingEventBlock onFocusChange;
|
|
34
|
+
@property (nonatomic, copy) RCTBubblingEventBlock onKeyUpPress;
|
|
35
|
+
@property (nonatomic, copy) RCTBubblingEventBlock onKeyDownPress;
|
|
36
|
+
|
|
37
|
+
@end
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
#endif /* RCT_NEW_ARCH_ENABLED */
|
|
41
|
+
#endif /* ExternalKeyboardViewNativeComponent_h */
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
#import "ExternalKeyboardView.h"
|
|
2
|
+
#import <UIKit/UIKit.h>
|
|
3
|
+
#import <React/RCTViewManager.h>
|
|
4
|
+
#import <React/RCTLog.h>
|
|
5
|
+
#import "KeyboardKeyPressHandler.h"
|
|
6
|
+
|
|
7
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
8
|
+
|
|
9
|
+
#import "FocusWrapper.h"
|
|
10
|
+
#import <react/renderer/components/RNExternalKeyboardViewSpec/ComponentDescriptors.h>
|
|
11
|
+
#import <react/renderer/components/RNExternalKeyboardViewSpec/EventEmitters.h>
|
|
12
|
+
#import <react/renderer/components/RNExternalKeyboardViewSpec/Props.h>
|
|
13
|
+
#import <react/renderer/components/RNExternalKeyboardViewSpec/RCTComponentViewHelpers.h>
|
|
14
|
+
|
|
15
|
+
#import "RCTFabricComponentsPlugins.h"
|
|
16
|
+
|
|
17
|
+
using namespace facebook::react;
|
|
18
|
+
|
|
19
|
+
@interface ExternalKeyboardView () <RCTExternalKeyboardViewViewProtocol>
|
|
20
|
+
|
|
21
|
+
@end
|
|
22
|
+
|
|
23
|
+
@implementation ExternalKeyboardView {
|
|
24
|
+
FocusWrapper * _view;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
28
|
+
{
|
|
29
|
+
return concreteComponentDescriptorProvider<ExternalKeyboardViewComponentDescriptor>();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
- (instancetype)initWithFrame:(CGRect)frame
|
|
33
|
+
{
|
|
34
|
+
|
|
35
|
+
if (self = [super initWithFrame:frame]) {
|
|
36
|
+
static const auto defaultProps = std::make_shared<const ExternalKeyboardViewProps>();
|
|
37
|
+
_props = defaultProps;
|
|
38
|
+
|
|
39
|
+
_view = [[FocusWrapper alloc] init];
|
|
40
|
+
_view.onFocusChange = [self](NSDictionary* dictionary) {
|
|
41
|
+
if (_eventEmitter) {
|
|
42
|
+
auto viewEventEmitter = std::static_pointer_cast<ExternalKeyboardViewEventEmitter const>(_eventEmitter);
|
|
43
|
+
facebook::react::ExternalKeyboardViewEventEmitter::OnFocusChange data = {
|
|
44
|
+
.isFocused = [[dictionary valueForKey:@"isFocused"] boolValue],
|
|
45
|
+
};
|
|
46
|
+
viewEventEmitter->onFocusChange(data);
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
_view.onKeyDownPress = [self](NSDictionary* dictionary) {
|
|
51
|
+
if (_eventEmitter) {
|
|
52
|
+
auto viewEventEmitter = std::static_pointer_cast<ExternalKeyboardViewEventEmitter const>(_eventEmitter);
|
|
53
|
+
facebook::react::ExternalKeyboardViewEventEmitter::OnKeyDownPress data = {
|
|
54
|
+
.keyCode = [[dictionary valueForKey:@"keyCode"] intValue],
|
|
55
|
+
.isLongPress = [[dictionary valueForKey:@"isLongPress"] boolValue],
|
|
56
|
+
.isAltPressed = [[dictionary valueForKey:@"isAltPressed"] boolValue],
|
|
57
|
+
.isShiftPressed = [[dictionary valueForKey:@"isShiftPressed"] boolValue],
|
|
58
|
+
.isCtrlPressed = [[dictionary valueForKey:@"isCtrlPressed"] boolValue],
|
|
59
|
+
.isCapsLockOn = [[dictionary valueForKey:@"isCapsLockOn"] boolValue],
|
|
60
|
+
.hasNoModifiers = [[dictionary valueForKey:@"hasNoModifiers"] boolValue],
|
|
61
|
+
};
|
|
62
|
+
viewEventEmitter->onKeyDownPress(data);
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
_view.onKeyUpPress = [self](NSDictionary* dictionary) {
|
|
68
|
+
if (_eventEmitter) {
|
|
69
|
+
auto viewEventEmitter = std::static_pointer_cast<ExternalKeyboardViewEventEmitter const>(_eventEmitter);
|
|
70
|
+
facebook::react::ExternalKeyboardViewEventEmitter::OnKeyUpPress data = {
|
|
71
|
+
.keyCode = [[dictionary valueForKey:@"keyCode"] intValue],
|
|
72
|
+
.isLongPress = [[dictionary valueForKey:@"isLongPress"] boolValue],
|
|
73
|
+
.isAltPressed = [[dictionary valueForKey:@"isAltPressed"] boolValue],
|
|
74
|
+
.isShiftPressed = [[dictionary valueForKey:@"isShiftPressed"] boolValue],
|
|
75
|
+
.isCtrlPressed = [[dictionary valueForKey:@"isCtrlPressed"] boolValue],
|
|
76
|
+
.isCapsLockOn = [[dictionary valueForKey:@"isCapsLockOn"] boolValue],
|
|
77
|
+
.hasNoModifiers = [[dictionary valueForKey:@"hasNoModifiers"] boolValue],
|
|
78
|
+
};
|
|
79
|
+
viewEventEmitter->onKeyUpPress(data);
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
self.contentView = _view;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return self;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
- (NSArray<id<UIFocusEnvironment>> *)preferredFocusEnvironments {
|
|
90
|
+
if (self.myPreferredFocusedView == nil) {
|
|
91
|
+
return @[];
|
|
92
|
+
}
|
|
93
|
+
return @[self.myPreferredFocusedView];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
|
|
97
|
+
{
|
|
98
|
+
const auto &oldViewProps = *std::static_pointer_cast<ExternalKeyboardViewProps const>(_props);
|
|
99
|
+
const auto &newViewProps = *std::static_pointer_cast<ExternalKeyboardViewProps const>(props);
|
|
100
|
+
|
|
101
|
+
if (@available(iOS 14.0, *)) {
|
|
102
|
+
if(_view.focusGroupIdentifier == nil) {
|
|
103
|
+
_view.focusGroupIdentifier = [NSString stringWithFormat:@"app.group.%ld", self.tag];
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
[super updateProps:props oldProps:oldProps];
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
if(oldViewProps.canBeFocused != newViewProps.canBeFocused) {
|
|
111
|
+
[_view setCanBeFocused: newViewProps.canBeFocused];
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
Class<RCTComponentViewProtocol> ExternalKeyboardViewCls(void)
|
|
117
|
+
{
|
|
118
|
+
return ExternalKeyboardView.class;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
@end
|
|
122
|
+
#else
|
|
123
|
+
|
|
124
|
+
@implementation ExternalKeyboardView
|
|
125
|
+
|
|
126
|
+
- (instancetype)initWithFrame:(CGRect)frame
|
|
127
|
+
{
|
|
128
|
+
if (self = [super initWithFrame:frame]) {
|
|
129
|
+
_keyboardKeyPressHandler = [[KeyboardKeyPressHandler alloc] init];
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return self;
|
|
133
|
+
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
- (void)pressesBegan:(NSSet<UIPress *> *)presses
|
|
137
|
+
withEvent:(UIPressesEvent *)event {
|
|
138
|
+
NSDictionary *eventInfo = [_keyboardKeyPressHandler actionDownHandler:presses withEvent:event];
|
|
139
|
+
if(self.onKeyDownPress) {
|
|
140
|
+
self.onKeyDownPress(eventInfo);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
- (void)pressesEnded:(NSSet<UIPress *> *)presses
|
|
145
|
+
withEvent:(UIPressesEvent *)event {
|
|
146
|
+
NSDictionary *eventInfo = [_keyboardKeyPressHandler actionUpHandler:presses withEvent:event];
|
|
147
|
+
if(self.onKeyUpPress) {
|
|
148
|
+
self.onKeyUpPress(eventInfo);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
- (NSArray<id<UIFocusEnvironment>> *)preferredFocusEnvironments {
|
|
153
|
+
if (self.myPreferredFocusedView == nil) {
|
|
154
|
+
return @[];
|
|
155
|
+
}
|
|
156
|
+
return @[self.myPreferredFocusedView];
|
|
157
|
+
}
|
|
158
|
+
- (BOOL)canBecomeFocused {
|
|
159
|
+
return self.canBeFocused;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
- (void)didUpdateFocusInContext:(UIFocusUpdateContext *)context
|
|
163
|
+
withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator {
|
|
164
|
+
if(!self.onFocusChange) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if(context.nextFocusedView == self) {
|
|
169
|
+
self.onFocusChange(@{ @"isFocused": @(YES) });
|
|
170
|
+
} else if (context.previouslyFocusedView == self) {
|
|
171
|
+
self.onFocusChange(@{ @"isFocused": @(NO) });
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
- (void)didUpdateReactSubviews
|
|
176
|
+
{
|
|
177
|
+
[super didUpdateReactSubviews];
|
|
178
|
+
if (@available(iOS 14.0, *)) {
|
|
179
|
+
self.focusGroupIdentifier = [NSString stringWithFormat:@"app.group.%@", self.reactTag];
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
@end
|
|
184
|
+
|
|
185
|
+
#endif
|
|
186
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//
|
|
2
|
+
// FocusWrapper.h
|
|
3
|
+
// ExternalKeyboard
|
|
4
|
+
//
|
|
5
|
+
// Created by Artur Kalach on 21.06.2023.
|
|
6
|
+
// Copyright © 2023 Facebook. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#ifndef FocusWrapper_h
|
|
10
|
+
#define FocusWrapper_h
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
#import <UIKit/UIKit.h>
|
|
14
|
+
#import <UIKit/UIAccessibilityContainer.h>
|
|
15
|
+
#import <React/RCTView.h>
|
|
16
|
+
|
|
17
|
+
#import "KeyboardKeyPressHandler.h"
|
|
18
|
+
|
|
19
|
+
@interface FocusWrapper : RCTView {
|
|
20
|
+
KeyboardKeyPressHandler* _keyboardKeyPressHandler;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@property BOOL canBeFocused;
|
|
24
|
+
@property UIView* myPreferredFocusedView;
|
|
25
|
+
@property (nonatomic, copy) RCTBubblingEventBlock onFocusChange;
|
|
26
|
+
@property (nonatomic, copy) RCTBubblingEventBlock onKeyDownPress;
|
|
27
|
+
@property (nonatomic, copy) RCTBubblingEventBlock onKeyUpPress;
|
|
28
|
+
|
|
29
|
+
@end
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
#endif /* FocusWrapper_h */
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
//
|
|
2
|
+
// FocusWrapper.m
|
|
3
|
+
// ExternalKeyboard
|
|
4
|
+
//
|
|
5
|
+
// Created by Artur Kalach on 21.06.2023.
|
|
6
|
+
// Copyright © 2023 Facebook. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import "FocusWrapper.h"
|
|
10
|
+
|
|
11
|
+
@implementation FocusWrapper
|
|
12
|
+
|
|
13
|
+
- (instancetype)init {
|
|
14
|
+
self = [super init];
|
|
15
|
+
if (self) {
|
|
16
|
+
_keyboardKeyPressHandler = [[KeyboardKeyPressHandler alloc] init];
|
|
17
|
+
}
|
|
18
|
+
return self;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
- (NSArray<id<UIFocusEnvironment>> *)preferredFocusEnvironments {
|
|
23
|
+
if (self.myPreferredFocusedView == nil) {
|
|
24
|
+
return @[];
|
|
25
|
+
}
|
|
26
|
+
return @[self.myPreferredFocusedView];
|
|
27
|
+
}
|
|
28
|
+
- (BOOL)canBecomeFocused {
|
|
29
|
+
return self.canBeFocused;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
- (void)didUpdateFocusInContext:(UIFocusUpdateContext *)context
|
|
33
|
+
withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator {
|
|
34
|
+
if(!self.onFocusChange) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if(context.nextFocusedView == self) {
|
|
39
|
+
self.onFocusChange(@{ @"isFocused": @(YES) });
|
|
40
|
+
} else if (context.previouslyFocusedView == self) {
|
|
41
|
+
self.onFocusChange(@{ @"isFocused": @(NO) });
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
- (void)pressesBegan:(NSSet<UIPress *> *)presses
|
|
47
|
+
withEvent:(UIPressesEvent *)event {
|
|
48
|
+
NSDictionary *eventInfo = [_keyboardKeyPressHandler actionDownHandler:presses withEvent:event];
|
|
49
|
+
if(self.onKeyDownPress) {
|
|
50
|
+
self.onKeyDownPress(eventInfo);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
- (void)pressesEnded:(NSSet<UIPress *> *)presses
|
|
55
|
+
withEvent:(UIPressesEvent *)event {
|
|
56
|
+
NSDictionary *eventInfo = [_keyboardKeyPressHandler actionUpHandler:presses withEvent:event];
|
|
57
|
+
if(self.onKeyUpPress) {
|
|
58
|
+
self.onKeyUpPress(eventInfo);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
@end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//
|
|
2
|
+
// KeyboardKeyPressHandler.h
|
|
3
|
+
// ExternalKeyboard
|
|
4
|
+
//
|
|
5
|
+
// Created by Artur Kalach on 21.06.2023.
|
|
6
|
+
// Copyright © 2023 Facebook. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#ifndef KeyboardKeyPressHandler_h
|
|
10
|
+
#define KeyboardKeyPressHandler_h
|
|
11
|
+
|
|
12
|
+
@interface KeyboardKeyPressHandler:NSObject {
|
|
13
|
+
NSMutableDictionary* _keyPressedTimestamps;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
-(NSDictionary*) getKeyPressEventInfo:(NSSet<UIPress *> *)presses
|
|
17
|
+
withEvent:(UIPressesEvent *)event;
|
|
18
|
+
|
|
19
|
+
-(NSDictionary*) actionDownHandler:(NSSet<UIPress *> *)presses
|
|
20
|
+
withEvent:(UIPressesEvent *)event;
|
|
21
|
+
|
|
22
|
+
-(NSDictionary*) actionUpHandler:(NSSet<UIPress *> *)presses
|
|
23
|
+
withEvent:(UIPressesEvent *)event;
|
|
24
|
+
|
|
25
|
+
@end
|
|
26
|
+
|
|
27
|
+
#endif /* KeyboardKeyPressHandler_h */
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
//
|
|
2
|
+
// KeyboardKeyPressHandler.m
|
|
3
|
+
// ExternalKeyboard
|
|
4
|
+
//
|
|
5
|
+
// Created by Artur Kalach on 21.06.2023.
|
|
6
|
+
// Copyright © 2023 Facebook. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import <Foundation/Foundation.h>
|
|
10
|
+
#import "UIKit/UIResponder.h"
|
|
11
|
+
#import "KeyboardKeyPressHandler.h"
|
|
12
|
+
#import <UIKit/UIKit.h>
|
|
13
|
+
|
|
14
|
+
@implementation KeyboardKeyPressHandler
|
|
15
|
+
|
|
16
|
+
static const float LONG_PRESS_DURATION = 0.5;
|
|
17
|
+
|
|
18
|
+
- (instancetype)init {
|
|
19
|
+
self = [super init];
|
|
20
|
+
if (self) {
|
|
21
|
+
_keyPressedTimestamps = [[NSMutableDictionary alloc] init];
|
|
22
|
+
}
|
|
23
|
+
return self;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
-(NSDictionary*) getKeyPressEventInfo:(NSSet<UIPress *> *)presses
|
|
27
|
+
withEvent:(UIPressesEvent *)event {
|
|
28
|
+
UIKey *key = presses.allObjects[0].key;
|
|
29
|
+
NSNumber *keyCode = @(key.keyCode);
|
|
30
|
+
NSNumber *isAltPressed = @((key.modifierFlags & UIKeyModifierAlternate) > 0);
|
|
31
|
+
NSNumber *isShiftPressed = @((key.modifierFlags & UIKeyModifierShift) > 0);
|
|
32
|
+
NSNumber *isCtrlPressed = @((key.modifierFlags & UIKeyModifierControl) > 0);
|
|
33
|
+
NSNumber *isCapsLockOn = @((key.modifierFlags & UIKeyModifierAlphaShift) > 0);
|
|
34
|
+
NSNumber *hasNoModifiers = @(key.modifierFlags == 0);
|
|
35
|
+
|
|
36
|
+
return @{
|
|
37
|
+
@"keyCode": keyCode,
|
|
38
|
+
@"isLongPress": @NO,
|
|
39
|
+
@"isAltPressed": isAltPressed,
|
|
40
|
+
@"isShiftPressed": isShiftPressed,
|
|
41
|
+
@"isCtrlPressed": isCtrlPressed,
|
|
42
|
+
@"isCapsLockOn": isCapsLockOn,
|
|
43
|
+
@"hasNoModifiers": hasNoModifiers,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
-(NSDictionary*) actionDownHandler:(NSSet<UIPress *> *)presses
|
|
48
|
+
withEvent:(UIPressesEvent *)event{
|
|
49
|
+
UIKey *key = presses.allObjects[0].key;
|
|
50
|
+
NSNumber *keyCode = @(key.keyCode);
|
|
51
|
+
[_keyPressedTimestamps setObject: @(event.timestamp) forKey: keyCode];
|
|
52
|
+
NSDictionary *info = [self getKeyPressEventInfo:presses withEvent:event];
|
|
53
|
+
return info;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
-(NSDictionary*) actionUpHandler:(NSSet<UIPress *> *)presses
|
|
57
|
+
withEvent:(UIPressesEvent *)event {
|
|
58
|
+
UIKey *key = presses.allObjects[0].key;
|
|
59
|
+
NSNumber *keyCode = @(key.keyCode);
|
|
60
|
+
NSNumber *begunPressTimestamp = [_keyPressedTimestamps objectForKey:keyCode];
|
|
61
|
+
NSNumber *pressDuration = @([@(event.timestamp) doubleValue] - [begunPressTimestamp doubleValue]);
|
|
62
|
+
NSNumber *isLognPress = @([pressDuration doubleValue] >= LONG_PRESS_DURATION);
|
|
63
|
+
|
|
64
|
+
NSDictionary *info = [self getKeyPressEventInfo:presses withEvent:event];
|
|
65
|
+
NSMutableDictionary *result = [NSMutableDictionary dictionaryWithDictionary:info];
|
|
66
|
+
[result addEntriesFromDictionary: @{
|
|
67
|
+
@"isLongPress": isLognPress,
|
|
68
|
+
}];
|
|
69
|
+
|
|
70
|
+
return result;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//
|
|
2
|
+
// A11yKeyboardModule.h
|
|
3
|
+
// ExternalKeyboard
|
|
4
|
+
//
|
|
5
|
+
// Created by Artur Kalach on 16.07.2023.
|
|
6
|
+
// Copyright © 2023 Facebook. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#ifndef A11yKeyboardModule_h
|
|
10
|
+
#define A11yKeyboardModule_h
|
|
11
|
+
|
|
12
|
+
#import <React/RCTBridgeModule.h>
|
|
13
|
+
#import <React/RCTEventEmitter.h>
|
|
14
|
+
|
|
15
|
+
@interface A11yKeyboardModule : RCTEventEmitter <RCTBridgeModule>
|
|
16
|
+
|
|
17
|
+
@end
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
#endif /* A11yKeyboardModule_h */
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
//
|
|
2
|
+
// A11yKeyboardModule.m
|
|
3
|
+
// ExternalKeyboard
|
|
4
|
+
//
|
|
5
|
+
// Created by Artur Kalach on 16.07.2023.
|
|
6
|
+
// Copyright © 2023 Facebook. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
#import <React/RCTLog.h>
|
|
12
|
+
#import <UIKit/UIKit.h>
|
|
13
|
+
|
|
14
|
+
#import <React/RCTUIManager.h>
|
|
15
|
+
#import "A11yKeyboardModule.h"
|
|
16
|
+
#import "ExternalKeyboardView.h"
|
|
17
|
+
#import <React/RCTUIManager.h>
|
|
18
|
+
|
|
19
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
20
|
+
#import "RNExternalKeyboardViewSpec/RNExternalKeyboardViewSpec.h"
|
|
21
|
+
using namespace facebook::react;
|
|
22
|
+
|
|
23
|
+
#endif
|
|
24
|
+
|
|
25
|
+
@implementation A11yKeyboardModule
|
|
26
|
+
|
|
27
|
+
- (NSArray<NSString *> *)supportedEvents
|
|
28
|
+
{
|
|
29
|
+
return @[];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
- (instancetype)init
|
|
33
|
+
{
|
|
34
|
+
return self;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
+ (BOOL)requiresMainQueueSetup
|
|
38
|
+
{
|
|
39
|
+
return YES;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
RCT_EXPORT_MODULE(A11yKeyboardModule);
|
|
44
|
+
|
|
45
|
+
RCT_EXPORT_METHOD(
|
|
46
|
+
setPreferredKeyboardFocus:(nonnull NSNumber *)itemId
|
|
47
|
+
nextElementId:(nonnull NSNumber *)nextElementId
|
|
48
|
+
) {
|
|
49
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
50
|
+
UIView *field = [self.bridge.uiManager viewForReactTag:itemId];
|
|
51
|
+
UIView *nextFocusElement = [self.bridge.uiManager viewForReactTag:nextElementId];
|
|
52
|
+
if(field != nil && nextFocusElement != nil && [field isKindOfClass: [ExternalKeyboardView class]]) {
|
|
53
|
+
ExternalKeyboardView *v = (ExternalKeyboardView *)field;
|
|
54
|
+
v.myPreferredFocusedView = nextFocusElement;
|
|
55
|
+
[v setNeedsFocusUpdate];
|
|
56
|
+
[v updateFocusIfNeeded];
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
RCT_EXPORT_METHOD(
|
|
62
|
+
setKeyboardFocus:(nonnull NSNumber *)itemId
|
|
63
|
+
nextElementId:(nonnull NSNumber *)nextElementId
|
|
64
|
+
) {
|
|
65
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
66
|
+
UIView *field = [self.bridge.uiManager viewForReactTag:itemId];
|
|
67
|
+
UIView *nextFocusElement = [self.bridge.uiManager viewForReactTag:nextElementId];
|
|
68
|
+
if(field != nil && nextFocusElement != nil && [field isKindOfClass: [ExternalKeyboardView class]]) {
|
|
69
|
+
ExternalKeyboardView *v = (ExternalKeyboardView *)field;
|
|
70
|
+
v.myPreferredFocusedView = nextFocusElement;
|
|
71
|
+
[v setNeedsFocusUpdate];
|
|
72
|
+
[v updateFocusIfNeeded];
|
|
73
|
+
v.myPreferredFocusedView = v;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
79
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
80
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params
|
|
81
|
+
{
|
|
82
|
+
return std::make_shared<facebook::react::NativeKeyboardModuleSpecJSI>(params);
|
|
83
|
+
}
|
|
84
|
+
#endif
|
|
85
|
+
|
|
86
|
+
@end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//
|
|
2
|
+
// ExternalKeyboardViewManager.h
|
|
3
|
+
// ExternalKeyboard
|
|
4
|
+
//
|
|
5
|
+
// Created by Artur Kalach on 17.07.2023.
|
|
6
|
+
// Copyright © 2023 Facebook. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#ifndef ExternalKeyboardViewManager_h
|
|
10
|
+
#define ExternalKeyboardViewManager_h
|
|
11
|
+
|
|
12
|
+
#import <React/RCTViewManager.h>
|
|
13
|
+
@interface ExternalKeyboardViewManager : RCTViewManager
|
|
14
|
+
@end
|
|
15
|
+
|
|
16
|
+
#endif /* ExternalKeyboardViewManager_h */
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#import <React/RCTViewManager.h>
|
|
2
|
+
#import <React/RCTUIManager.h>
|
|
3
|
+
#import "ExternalKeyboardViewManager.h"
|
|
4
|
+
#import "ExternalKeyboardView.h"
|
|
5
|
+
#import "RCTBridge.h"
|
|
6
|
+
#import "Utils.h"
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@implementation ExternalKeyboardViewManager
|
|
10
|
+
|
|
11
|
+
RCT_EXPORT_MODULE(ExternalKeyboardView)
|
|
12
|
+
|
|
13
|
+
- (UIView *)view
|
|
14
|
+
{
|
|
15
|
+
return [[ExternalKeyboardView alloc] init];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
RCT_EXPORT_VIEW_PROPERTY(onFocusChange, RCTBubblingEventBlock)
|
|
19
|
+
RCT_EXPORT_VIEW_PROPERTY(onKeyUpPress, RCTBubblingEventBlock)
|
|
20
|
+
RCT_EXPORT_VIEW_PROPERTY(onKeyDownPress, RCTBubblingEventBlock)
|
|
21
|
+
RCT_EXPORT_VIEW_PROPERTY(myPreferredFocusedView, UIView)
|
|
22
|
+
|
|
23
|
+
RCT_CUSTOM_VIEW_PROPERTY(canBeFocused, BOOL, ExternalKeyboardView)
|
|
24
|
+
{
|
|
25
|
+
BOOL value = json ? [RCTConvert BOOL:json] : YES;
|
|
26
|
+
[view setCanBeFocused: value];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.A11yKeyboardModule = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
const LINKING_ERROR = `The package 'react-native-external-keyboard' doesn't seem to be linked. Make sure: \n\n${_reactNative.Platform.select({
|
|
9
|
+
ios: "- You have run 'pod install'\n",
|
|
10
|
+
default: ''
|
|
11
|
+
})}- You rebuilt the app after installing the package\n` + `- You are not using Expo Go\n`;
|
|
12
|
+
|
|
13
|
+
// @ts-expect-error
|
|
14
|
+
const isTurboModuleEnabled = global.__turboModuleProxy != null;
|
|
15
|
+
const A11yModule = isTurboModuleEnabled ? require('../../nativeSpec/NativeKeyboardModule').default : _reactNative.NativeModules.A11yKeyboardModule;
|
|
16
|
+
const RCA11y = A11yModule || new Proxy({}, {
|
|
17
|
+
get() {
|
|
18
|
+
throw new Error(LINKING_ERROR);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
const setKeyboardFocus = function (nativeTag) {
|
|
22
|
+
let _nextTag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
23
|
+
RCA11y.setKeyboardFocus(nativeTag, _nextTag);
|
|
24
|
+
};
|
|
25
|
+
const setPreferredKeyboardFocus = (nativeTag, nextTag) => {
|
|
26
|
+
RCA11y.setAccessibilityFocus(nativeTag, nextTag);
|
|
27
|
+
};
|
|
28
|
+
const A11yKeyboardModule = {
|
|
29
|
+
setKeyboardFocus,
|
|
30
|
+
setPreferredKeyboardFocus
|
|
31
|
+
};
|
|
32
|
+
exports.A11yKeyboardModule = A11yKeyboardModule;
|
|
33
|
+
//# sourceMappingURL=A11yKeyboardModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","isTurboModuleEnabled","global","__turboModuleProxy","A11yModule","NativeModules","A11yKeyboardModule","RCA11y","Proxy","get","Error","setKeyboardFocus","nativeTag","_nextTag","arguments","length","undefined","setPreferredKeyboardFocus","nextTag","setAccessibilityFocus","exports"],"sourceRoot":"../../../../src","sources":["NativeModules/A11yKeyboardModule/A11yKeyboardModule.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,MAAMC,aAAa,GAChB,0FAAyFC,qBAAQ,CAACC,MAAM,CACvG;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CACvD,CAAE,sDAAqD,GACtD,+BAA8B;;AAEjC;AACA,MAAMC,oBAAoB,GAAGC,MAAM,CAACC,kBAAkB,IAAI,IAAI;AAE9D,MAAMC,UAAU,GAAGH,oBAAoB,GACnCN,OAAO,CAAC,uCAAuC,CAAC,CAACK,OAAO,GACxDK,0BAAa,CAACC,kBAAkB;AAEpC,MAAMC,MAAM,GACVH,UAAU,IACV,IAAII,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACd,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEH,MAAMe,gBAAgB,GAAG,SAAAA,CAACC,SAAiB,EAAmB;EAAA,IAAjBC,QAAQ,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;EACvDP,MAAM,CAACI,gBAAgB,CAACC,SAAS,EAAEC,QAAQ,CAAC;AAC9C,CAAC;AAED,MAAMI,yBAAyB,GAAGA,CAACL,SAAiB,EAAEM,OAAe,KAAK;EACxEX,MAAM,CAACY,qBAAqB,CAACP,SAAS,EAAEM,OAAO,CAAC;AAClD,CAAC;AAEM,MAAMZ,kBAAkB,GAAG;EAChCK,gBAAgB;EAChBM;AACF,CAAC;AAACG,OAAA,CAAAd,kBAAA,GAAAA,kBAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "A11yKeyboardModule", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _A11yKeyboardModule.A11yKeyboardModule;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _A11yKeyboardModule = require("./A11yKeyboardModule");
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_A11yKeyboardModule","require"],"sourceRoot":"../../../../src","sources":["NativeModules/A11yKeyboardModule/index.ts"],"mappings":";;;;;;;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "A11yKeyboardModule", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _A11yKeyboardModule.A11yKeyboardModule;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _A11yKeyboardModule = require("./A11yKeyboardModule");
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_A11yKeyboardModule","require"],"sourceRoot":"../../../src","sources":["NativeModules/index.ts"],"mappings":";;;;;;;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA"}
|