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,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "ExternalKeyboardView", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _ExternalKeyboardViewNativeComponent.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "NativeKeyboardModule", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _NativeKeyboardModule.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _ExternalKeyboardViewNativeComponent = _interopRequireDefault(require("./ExternalKeyboardViewNativeComponent"));
|
|
19
|
+
var _NativeKeyboardModule = _interopRequireDefault(require("./NativeKeyboardModule"));
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_ExternalKeyboardViewNativeComponent","_interopRequireDefault","require","_NativeKeyboardModule","obj","__esModule","default"],"sourceRoot":"../../../src","sources":["nativeSpec/index.ts"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,oCAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAA0D,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.A11yModule = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _NativeModules = require("../../NativeModules");
|
|
9
|
+
class A11yAndroidImpl {
|
|
10
|
+
setKeyboardFocus(ref) {
|
|
11
|
+
const tag = (0, _reactNative.findNodeHandle)(ref.current);
|
|
12
|
+
if (tag) {
|
|
13
|
+
_reactNative.InteractionManager.runAfterInteractions(() => {
|
|
14
|
+
_NativeModules.A11yKeyboardModule.setKeyboardFocus(tag);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
setPreferredKeyboardFocus = () => {};
|
|
19
|
+
}
|
|
20
|
+
const A11yModule = new A11yAndroidImpl();
|
|
21
|
+
exports.A11yModule = A11yModule;
|
|
22
|
+
//# sourceMappingURL=A11yModule.android.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_NativeModules","A11yAndroidImpl","setKeyboardFocus","ref","tag","findNodeHandle","current","InteractionManager","runAfterInteractions","A11yKeyboardModule","setPreferredKeyboardFocus","A11yModule","exports"],"sourceRoot":"../../../../src","sources":["services/A11yModule/A11yModule.android.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAGA,IAAAC,cAAA,GAAAD,OAAA;AAEA,MAAME,eAAe,CAAwB;EAC3CC,gBAAgBA,CAACC,GAAqC,EAAE;IACtD,MAAMC,GAAG,GAAG,IAAAC,2BAAc,EAACF,GAAG,CAACG,OAAO,CAAC;IACvC,IAAIF,GAAG,EAAE;MACPG,+BAAkB,CAACC,oBAAoB,CAAC,MAAM;QAC5CC,iCAAkB,CAACP,gBAAgB,CAACE,GAAG,CAAC;MAC1C,CAAC,CAAC;IACJ;EACF;EAEAM,yBAAyB,GAAGA,CAAA,KAAM,CAAC,CAAC;AACtC;AAEO,MAAMC,UAAU,GAAG,IAAIV,eAAe,CAAC,CAAC;AAACW,OAAA,CAAAD,UAAA,GAAAA,UAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["services/A11yModule/A11yModule.d.ts"],"mappings":""}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.A11yModule = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _NativeModules = require("../../NativeModules");
|
|
9
|
+
class A11yModuleIOSImpl {
|
|
10
|
+
_currentFocusedTag = null;
|
|
11
|
+
set currentFocusedTag(value) {
|
|
12
|
+
this._currentFocusedTag = value;
|
|
13
|
+
}
|
|
14
|
+
setPreferredKeyboardFocus = (tag, targetTag) => {
|
|
15
|
+
if (Number.isInteger(tag) && Number.isInteger(targetTag)) {
|
|
16
|
+
_NativeModules.A11yKeyboardModule.setPreferredKeyboardFocus(tag, targetTag);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
setKeyboardFocus = ref => {
|
|
20
|
+
const tag = (0, _reactNative.findNodeHandle)(ref.current);
|
|
21
|
+
if (this._currentFocusedTag && tag && Number.isInteger(this._currentFocusedTag) && Number.isInteger(tag)) {
|
|
22
|
+
_NativeModules.A11yKeyboardModule.setKeyboardFocus(this._currentFocusedTag, tag);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
const A11yModule = new A11yModuleIOSImpl();
|
|
27
|
+
exports.A11yModule = A11yModule;
|
|
28
|
+
//# sourceMappingURL=A11yModule.ios.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_NativeModules","A11yModuleIOSImpl","_currentFocusedTag","currentFocusedTag","value","setPreferredKeyboardFocus","tag","targetTag","Number","isInteger","A11yKeyboardModule","setKeyboardFocus","ref","findNodeHandle","current","A11yModule","exports"],"sourceRoot":"../../../../src","sources":["services/A11yModule/A11yModule.ios.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAGA,IAAAC,cAAA,GAAAD,OAAA;AAEA,MAAME,iBAAiB,CAAwB;EACrCC,kBAAkB,GAAkB,IAAI;EAEhD,IAAIC,iBAAiBA,CAACC,KAAa,EAAE;IACnC,IAAI,CAACF,kBAAkB,GAAGE,KAAK;EACjC;EAEAC,yBAAyB,GAAGA,CAACC,GAAW,EAAEC,SAAiB,KAAK;IAC9D,IAAIC,MAAM,CAACC,SAAS,CAACH,GAAG,CAAC,IAAIE,MAAM,CAACC,SAAS,CAACF,SAAS,CAAC,EAAE;MACxDG,iCAAkB,CAACL,yBAAyB,CAACC,GAAG,EAAEC,SAAS,CAAC;IAC9D;EACF,CAAC;EAEDI,gBAAgB,GAAIC,GAAe,IAAK;IACtC,MAAMN,GAAG,GAAG,IAAAO,2BAAc,EAACD,GAAG,CAACE,OAAO,CAAC;IAEvC,IACE,IAAI,CAACZ,kBAAkB,IACvBI,GAAG,IACHE,MAAM,CAACC,SAAS,CAAC,IAAI,CAACP,kBAAkB,CAAC,IACzCM,MAAM,CAACC,SAAS,CAACH,GAAG,CAAC,EACrB;MACAI,iCAAkB,CAACC,gBAAgB,CAAC,IAAI,CAACT,kBAAkB,EAAEI,GAAG,CAAC;IACnE;EACF,CAAC;AACH;AAEO,MAAMS,UAAU,GAAG,IAAId,iBAAiB,CAAC,CAAC;AAACe,OAAA,CAAAD,UAAA,GAAAA,UAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["services/A11yModule/A11yModule.types.ts"],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "A11yModule", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _A11yModule.A11yModule;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _A11yModule = require("./A11yModule");
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_A11yModule","require"],"sourceRoot":"../../../../src","sources":["services/A11yModule/index.ts"],"mappings":";;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "A11yModule", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _A11yModule.A11yModule;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _A11yModule = require("./A11yModule");
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_A11yModule","require"],"sourceRoot":"../../../src","sources":["services/index.ts"],"mappings":";;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/FocusStyle.ts"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/KeyboardFocusView.types.ts"],"mappings":""}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "FocusStateCallbackType", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _FocusStyle.FocusStateCallbackType;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "FocusStyle", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _FocusStyle.FocusStyle;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "KeyboardFocusViewProps", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _KeyboardFocusView.KeyboardFocusViewProps;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "OnFocusChangeFn", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _KeyboardFocusView.OnFocusChangeFn;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "OnKeyPressFn", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _KeyboardFocusView.OnKeyPressFn;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
var _KeyboardFocusView = require("./KeyboardFocusView.types");
|
|
37
|
+
var _FocusStyle = require("./FocusStyle");
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_KeyboardFocusView","require","_FocusStyle"],"sourceRoot":"../../../src","sources":["types/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { NativeModules, Platform } from 'react-native';
|
|
2
|
+
const LINKING_ERROR = `The package 'react-native-external-keyboard' doesn't seem to be linked. Make sure: \n\n${Platform.select({
|
|
3
|
+
ios: "- You have run 'pod install'\n",
|
|
4
|
+
default: ''
|
|
5
|
+
})}- You rebuilt the app after installing the package\n` + `- You are not using Expo Go\n`;
|
|
6
|
+
|
|
7
|
+
// @ts-expect-error
|
|
8
|
+
const isTurboModuleEnabled = global.__turboModuleProxy != null;
|
|
9
|
+
const A11yModule = isTurboModuleEnabled ? require('../../nativeSpec/NativeKeyboardModule').default : NativeModules.A11yKeyboardModule;
|
|
10
|
+
const RCA11y = A11yModule || new Proxy({}, {
|
|
11
|
+
get() {
|
|
12
|
+
throw new Error(LINKING_ERROR);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
const setKeyboardFocus = function (nativeTag) {
|
|
16
|
+
let _nextTag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
17
|
+
RCA11y.setKeyboardFocus(nativeTag, _nextTag);
|
|
18
|
+
};
|
|
19
|
+
const setPreferredKeyboardFocus = (nativeTag, nextTag) => {
|
|
20
|
+
RCA11y.setAccessibilityFocus(nativeTag, nextTag);
|
|
21
|
+
};
|
|
22
|
+
export const A11yKeyboardModule = {
|
|
23
|
+
setKeyboardFocus,
|
|
24
|
+
setPreferredKeyboardFocus
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=A11yKeyboardModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","isTurboModuleEnabled","global","__turboModuleProxy","A11yModule","require","A11yKeyboardModule","RCA11y","Proxy","get","Error","setKeyboardFocus","nativeTag","_nextTag","arguments","length","undefined","setPreferredKeyboardFocus","nextTag","setAccessibilityFocus"],"sourceRoot":"../../../../src","sources":["NativeModules/A11yKeyboardModule/A11yKeyboardModule.ts"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AACtD,MAAMC,aAAa,GAChB,0FAAyFD,QAAQ,CAACE,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,GACnCI,OAAO,CAAC,uCAAuC,CAAC,CAACL,OAAO,GACxDL,aAAa,CAACW,kBAAkB;AAEpC,MAAMC,MAAM,GACVH,UAAU,IACV,IAAII,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACb,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEH,MAAMc,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;AAED,OAAO,MAAMZ,kBAAkB,GAAG;EAChCK,gBAAgB;EAChBM;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["A11yKeyboardModule"],"sourceRoot":"../../../../src","sources":["NativeModules/A11yKeyboardModule/index.ts"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,sBAAsB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["A11yKeyboardModule"],"sourceRoot":"../../../src","sources":["NativeModules/index.ts"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,sBAAsB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
import { useFocusStyle } from './hooks/useFocusStyle';
|
|
5
|
+
import { ExternalKeyboardView } from '../../nativeSpec';
|
|
6
|
+
export const KeyboardFocusView = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
7
|
+
let {
|
|
8
|
+
canBeFocused = true,
|
|
9
|
+
onFocusChange,
|
|
10
|
+
focusStyle,
|
|
11
|
+
children,
|
|
12
|
+
style,
|
|
13
|
+
withView = true,
|
|
14
|
+
onKeyUpPress,
|
|
15
|
+
onKeyDownPress,
|
|
16
|
+
...props
|
|
17
|
+
} = _ref;
|
|
18
|
+
const {
|
|
19
|
+
fStyle,
|
|
20
|
+
onFocusChangeHandler
|
|
21
|
+
} = useFocusStyle(focusStyle, onFocusChange);
|
|
22
|
+
return /*#__PURE__*/React.createElement(ExternalKeyboardView, _extends({
|
|
23
|
+
onFocusChange: onFocusChangeHandler,
|
|
24
|
+
style: [style, fStyle],
|
|
25
|
+
canBeFocused: canBeFocused,
|
|
26
|
+
ref: ref,
|
|
27
|
+
onKeyUpPress: onKeyUpPress,
|
|
28
|
+
onKeyDownPress: onKeyDownPress
|
|
29
|
+
}, props), withView ? /*#__PURE__*/React.createElement(View, {
|
|
30
|
+
accessible: true
|
|
31
|
+
}, children) : children);
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=KeyboardFocusView.android.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","View","useFocusStyle","ExternalKeyboardView","KeyboardFocusView","forwardRef","_ref","ref","canBeFocused","onFocusChange","focusStyle","children","style","withView","onKeyUpPress","onKeyDownPress","props","fStyle","onFocusChangeHandler","createElement","_extends","accessible"],"sourceRoot":"../../../../src","sources":["components/KeyboardFocusView/KeyboardFocusView.android.tsx"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAQ,cAAc;AACnC,SAASC,aAAa,QAAQ,uBAAuB;AACrD,SAASC,oBAAoB,QAAQ,kBAAkB;AAGvD,OAAO,MAAMC,iBAAiB,gBAAGJ,KAAK,CAACK,UAAU,CAC/C,CAAAC,IAAA,EAYEC,GAAG,KACA;EAAA,IAZH;IACEC,YAAY,GAAG,IAAI;IACnBC,aAAa;IACbC,UAAU;IACVC,QAAQ;IACRC,KAAK;IACLC,QAAQ,GAAG,IAAI;IACfC,YAAY;IACZC,cAAc;IACd,GAAGC;EACL,CAAC,GAAAV,IAAA;EAGD,MAAM;IAAEW,MAAM;IAAEC;EAAqB,CAAC,GAAGhB,aAAa,CACpDQ,UAAU,EACVD,aACF,CAAC;EAED,oBACET,KAAA,CAAAmB,aAAA,CAAChB,oBAAoB,EAAAiB,QAAA;IACnBX,aAAa,EAAES,oBAAqB;IACpCN,KAAK,EAAE,CAACA,KAAK,EAAEK,MAAM,CAAE;IACvBT,YAAY,EAAEA,YAAa;IAC3BD,GAAG,EAAEA,GAAI;IACTO,YAAY,EAAEA,YAAa;IAC3BC,cAAc,EAAEA;EAAe,GAC3BC,KAAK,GAERH,QAAQ,gBAAGb,KAAA,CAAAmB,aAAA,CAAClB,IAAI;IAACoB,UAAU;EAAA,GAAEV,QAAe,CAAC,GAAGA,QAC7B,CAAC;AAE3B,CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["components/KeyboardFocusView/KeyboardFocusView.d.ts"],"mappings":""}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
import React, { useCallback } from 'react';
|
|
3
|
+
import { ExternalKeyboardView } from '../../nativeSpec';
|
|
4
|
+
import { A11yModule } from '../../services';
|
|
5
|
+
import { useFocusStyle } from './hooks';
|
|
6
|
+
export const KeyboardFocusView = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
7
|
+
let {
|
|
8
|
+
onFocusChange,
|
|
9
|
+
style,
|
|
10
|
+
focusStyle,
|
|
11
|
+
canBeFocused = true,
|
|
12
|
+
onKeyUpPress,
|
|
13
|
+
onKeyDownPress,
|
|
14
|
+
...props
|
|
15
|
+
} = _ref;
|
|
16
|
+
const setCurrentFocusTag = useCallback(e => {
|
|
17
|
+
var _e$nativeEvent;
|
|
18
|
+
A11yModule.currentFocusedTag = (e === null || e === void 0 ? void 0 : (_e$nativeEvent = e.nativeEvent) === null || _e$nativeEvent === void 0 ? void 0 : _e$nativeEvent.target) || undefined;
|
|
19
|
+
}, []);
|
|
20
|
+
const onFocus = useCallback(e => {
|
|
21
|
+
setCurrentFocusTag(e);
|
|
22
|
+
onFocusChange === null || onFocusChange === void 0 ? void 0 : onFocusChange(e);
|
|
23
|
+
}, [onFocusChange, setCurrentFocusTag]);
|
|
24
|
+
const {
|
|
25
|
+
fStyle,
|
|
26
|
+
onFocusChangeHandler
|
|
27
|
+
} = useFocusStyle(focusStyle, onFocus);
|
|
28
|
+
return /*#__PURE__*/React.createElement(ExternalKeyboardView, _extends({
|
|
29
|
+
ref: ref,
|
|
30
|
+
style: [style, fStyle],
|
|
31
|
+
canBeFocused: canBeFocused,
|
|
32
|
+
onKeyUpPress: onKeyUpPress,
|
|
33
|
+
onKeyDownPress: onKeyDownPress,
|
|
34
|
+
onFocusChange: onFocusChangeHandler
|
|
35
|
+
}, props));
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=KeyboardFocusView.ios.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useCallback","ExternalKeyboardView","A11yModule","useFocusStyle","KeyboardFocusView","forwardRef","_ref","ref","onFocusChange","style","focusStyle","canBeFocused","onKeyUpPress","onKeyDownPress","props","setCurrentFocusTag","e","_e$nativeEvent","currentFocusedTag","nativeEvent","target","undefined","onFocus","fStyle","onFocusChangeHandler","createElement","_extends"],"sourceRoot":"../../../../src","sources":["components/KeyboardFocusView/KeyboardFocusView.ios.tsx"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,WAAW,QAAQ,OAAO;AAE1C,SAASC,oBAAoB,QAAQ,kBAAkB;AAEvD,SAASC,UAAU,QAAQ,gBAAgB;AAE3C,SAASC,aAAa,QAAQ,SAAS;AAEvC,OAAO,MAAMC,iBAAiB,gBAAGL,KAAK,CAACM,UAAU,CAC/C,CAAAC,IAAA,EAUEC,GAAG,KACA;EAAA,IAVH;IACEC,aAAa;IACbC,KAAK;IACLC,UAAU;IACVC,YAAY,GAAG,IAAI;IACnBC,YAAY;IACZC,cAAc;IACd,GAAGC;EACL,CAAC,GAAAR,IAAA;EAGD,MAAMS,kBAAkB,GAAGf,WAAW,CACnCgB,CAAsC,IAAK;IAAA,IAAAC,cAAA;IAC1Cf,UAAU,CAACgB,iBAAiB,GAAG,CAAAF,CAAC,aAADA,CAAC,wBAAAC,cAAA,GAADD,CAAC,CAAEG,WAAW,cAAAF,cAAA,uBAAdA,cAAA,CAAgBG,MAAM,KAAIC,SAAS;EACpE,CAAC,EACD,EACF,CAAC;EAED,MAAMC,OAAO,GAAGtB,WAAW,CACxBgB,CAAC,IAAK;IACLD,kBAAkB,CAACC,CAAC,CAAC;IACrBR,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAGQ,CAAC,CAAC;EACpB,CAAC,EACD,CAACR,aAAa,EAAEO,kBAAkB,CACpC,CAAC;EAED,MAAM;IAAEQ,MAAM;IAAEC;EAAqB,CAAC,GAAGrB,aAAa,CAACO,UAAU,EAAEY,OAAO,CAAC;EAE3E,oBACEvB,KAAA,CAAA0B,aAAA,CAACxB,oBAAoB,EAAAyB,QAAA;IACnBnB,GAAG,EAAEA,GAAI;IACTE,KAAK,EAAE,CAACA,KAAK,EAAEc,MAAM,CAAE;IACvBZ,YAAY,EAAEA,YAAa;IAC3BC,YAAY,EAAEA,YAAa;IAC3BC,cAAc,EAAEA,cAAe;IAC/BL,aAAa,EAAEgB;EAAqB,GAChCV,KAAK,CACV,CAAC;AAEN,CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useFocusStyle"],"sourceRoot":"../../../../../src","sources":["components/KeyboardFocusView/hooks/index.ts"],"mappings":"AAAA,SAASA,aAAa,QAAQ,iBAAiB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useFocusStyle"],"sourceRoot":"../../../../../../src","sources":["components/KeyboardFocusView/hooks/useFocusStyle/index.ts"],"mappings":"AAAA,SAASA,aAAa,QAAQ,iBAAiB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useState, useMemo } from 'react';
|
|
2
|
+
import { StyleSheet } from 'react-native';
|
|
3
|
+
export const useFocusStyle = (focusStyle, onFocusChange) => {
|
|
4
|
+
const [focused, setFocusStatus] = useState(false);
|
|
5
|
+
const onFocusChangeHandler = event => {
|
|
6
|
+
setFocusStatus(event.nativeEvent.isFocused);
|
|
7
|
+
onFocusChange === null || onFocusChange === void 0 ? void 0 : onFocusChange(event);
|
|
8
|
+
};
|
|
9
|
+
const fStyle = useMemo(() => {
|
|
10
|
+
if (!focusStyle) return focused ? styles.defaultHighlight : undefined;
|
|
11
|
+
const specificStyle = typeof focusStyle === 'function' ? focusStyle({
|
|
12
|
+
focused
|
|
13
|
+
}) : focusStyle;
|
|
14
|
+
return focused ? specificStyle : undefined;
|
|
15
|
+
}, [focused, focusStyle]);
|
|
16
|
+
return {
|
|
17
|
+
onFocusChangeHandler,
|
|
18
|
+
fStyle
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
const styles = StyleSheet.create({
|
|
22
|
+
defaultHighlight: {
|
|
23
|
+
backgroundColor: '#d8e2d9'
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=useFocusStyle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useState","useMemo","StyleSheet","useFocusStyle","focusStyle","onFocusChange","focused","setFocusStatus","onFocusChangeHandler","event","nativeEvent","isFocused","fStyle","styles","defaultHighlight","undefined","specificStyle","create","backgroundColor"],"sourceRoot":"../../../../../../src","sources":["components/KeyboardFocusView/hooks/useFocusStyle/useFocusStyle.ts"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,OAAO,QAAQ,OAAO;AACzC,SAASC,UAAU,QAAQ,cAAc;AAGzC,OAAO,MAAMC,aAAa,GAAGA,CAC3BC,UAAuB,EACvBC,aAA+B,KAC5B;EACH,MAAM,CAACC,OAAO,EAAEC,cAAc,CAAC,GAAGP,QAAQ,CAAC,KAAK,CAAC;EAEjD,MAAMQ,oBAAqC,GAAIC,KAAK,IAAK;IACvDF,cAAc,CAACE,KAAK,CAACC,WAAW,CAACC,SAAS,CAAC;IAC3CN,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAGI,KAAK,CAAC;EACxB,CAAC;EAED,MAAMG,MAAM,GAAGX,OAAO,CAAC,MAAM;IAC3B,IAAI,CAACG,UAAU,EAAE,OAAOE,OAAO,GAAGO,MAAM,CAACC,gBAAgB,GAAGC,SAAS;IACrE,MAAMC,aAAa,GACjB,OAAOZ,UAAU,KAAK,UAAU,GAAGA,UAAU,CAAC;MAAEE;IAAQ,CAAC,CAAC,GAAGF,UAAU;IACzE,OAAOE,OAAO,GAAGU,aAAa,GAAGD,SAAS;EAC5C,CAAC,EAAE,CAACT,OAAO,EAAEF,UAAU,CAAC,CAAC;EAEzB,OAAO;IACLI,oBAAoB;IACpBI;EACF,CAAC;AACH,CAAC;AAED,MAAMC,MAAM,GAAGX,UAAU,CAACe,MAAM,CAAC;EAC/BH,gBAAgB,EAAE;IAAEI,eAAe,EAAE;EAAU;AACjD,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["KeyboardFocusView"],"sourceRoot":"../../../../src","sources":["components/KeyboardFocusView/index.ts"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*
|
|
8
|
+
*
|
|
9
|
+
* @format
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { Pressable as RNPressable } from 'react-native';
|
|
14
|
+
import { KeyboardFocusView } from '../KeyboardFocusView';
|
|
15
|
+
const ANDROID_SPACE_KEY_CODE = 62;
|
|
16
|
+
export const Pressable = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
17
|
+
let {
|
|
18
|
+
canBeFocused,
|
|
19
|
+
focusStyle,
|
|
20
|
+
style,
|
|
21
|
+
onFocusChange,
|
|
22
|
+
onPress,
|
|
23
|
+
onLongPress,
|
|
24
|
+
onKeyDownPress,
|
|
25
|
+
onPressOut,
|
|
26
|
+
onPressIn,
|
|
27
|
+
...props
|
|
28
|
+
} = _ref;
|
|
29
|
+
const onKeyUpPressHandler = React.useCallback(e => {
|
|
30
|
+
const {
|
|
31
|
+
nativeEvent: {
|
|
32
|
+
keyCode,
|
|
33
|
+
isLongPress
|
|
34
|
+
}
|
|
35
|
+
} = e;
|
|
36
|
+
if (keyCode === ANDROID_SPACE_KEY_CODE) {
|
|
37
|
+
onPressOut === null || onPressOut === void 0 ? void 0 : onPressOut(e);
|
|
38
|
+
if (isLongPress) {
|
|
39
|
+
onLongPress === null || onLongPress === void 0 ? void 0 : onLongPress(e);
|
|
40
|
+
} else {
|
|
41
|
+
onPress === null || onPress === void 0 ? void 0 : onPress(e);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}, [onLongPress, onPress, onPressOut]);
|
|
45
|
+
const onPressablePressHandler = event => {
|
|
46
|
+
if (event.nativeEvent.identifier !== undefined) {
|
|
47
|
+
onPress === null || onPress === void 0 ? void 0 : onPress(event);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const onKeyDownHandler = React.useCallback(e => {
|
|
51
|
+
onKeyDownPress === null || onKeyDownPress === void 0 ? void 0 : onKeyDownPress(e);
|
|
52
|
+
onPressIn === null || onPressIn === void 0 ? void 0 : onPressIn(e);
|
|
53
|
+
}, [onKeyDownPress, onPressIn]);
|
|
54
|
+
return /*#__PURE__*/React.createElement(KeyboardFocusView, {
|
|
55
|
+
style: style,
|
|
56
|
+
focusStyle: focusStyle,
|
|
57
|
+
ref: ref,
|
|
58
|
+
withView: false,
|
|
59
|
+
onKeyUpPress: onKeyUpPressHandler,
|
|
60
|
+
onKeyDownPress: onKeyDownHandler,
|
|
61
|
+
canBeFocused: canBeFocused,
|
|
62
|
+
onFocusChange: onFocusChange
|
|
63
|
+
}, /*#__PURE__*/React.createElement(RNPressable, _extends({
|
|
64
|
+
onPressOut: onPressOut,
|
|
65
|
+
onPressIn: onPressIn,
|
|
66
|
+
onPress: onPressablePressHandler,
|
|
67
|
+
onLongPress: onLongPress
|
|
68
|
+
}, props)));
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=Pressable.android.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Pressable","RNPressable","KeyboardFocusView","ANDROID_SPACE_KEY_CODE","forwardRef","_ref","ref","canBeFocused","focusStyle","style","onFocusChange","onPress","onLongPress","onKeyDownPress","onPressOut","onPressIn","props","onKeyUpPressHandler","useCallback","e","nativeEvent","keyCode","isLongPress","onPressablePressHandler","event","identifier","undefined","onKeyDownHandler","createElement","withView","onKeyUpPress","_extends"],"sourceRoot":"../../../../src","sources":["components/Pressable/Pressable.android.tsx"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAEEC,SAAS,IAAIC,WAAW,QAGnB,cAAc;AAErB,SAASC,iBAAiB,QAAQ,sBAAsB;AAExD,MAAMC,sBAAsB,GAAG,EAAE;AAEjC,OAAO,MAAMH,SAAS,gBAAGD,KAAK,CAACK,UAAU,CAIvC,CAAAC,IAAA,EAaEC,GAAG,KACA;EAAA,IAbH;IACEC,YAAY;IACZC,UAAU;IACVC,KAAK;IACLC,aAAa;IACbC,OAAO;IACPC,WAAW;IACXC,cAAc;IACdC,UAAU;IACVC,SAAS;IACT,GAAGC;EACL,CAAC,GAAAX,IAAA;EAGD,MAAMY,mBAAmB,GAAGlB,KAAK,CAACmB,WAAW,CAC1CC,CAAC,IAAK;IACL,MAAM;MACJC,WAAW,EAAE;QAAEC,OAAO;QAAEC;MAAY;IACtC,CAAC,GAAGH,CAAC;IAEL,IAAIE,OAAO,KAAKlB,sBAAsB,EAAE;MACtCW,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAGK,CAAqC,CAAC;MACnD,IAAIG,WAAW,EAAE;QACfV,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAGO,CAAC,CAAC;MAClB,CAAC,MAAM;QACLR,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAGQ,CAAC,CAAC;MACd;IACF;EACF,CAAC,EACD,CAACP,WAAW,EAAED,OAAO,EAAEG,UAAU,CACnC,CAAC;EAED,MAAMS,uBAAuB,GAAIC,KAA4B,IAAK;IAChE,IAAIA,KAAK,CAACJ,WAAW,CAACK,UAAU,KAAKC,SAAS,EAAE;MAC9Cf,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAGa,KAAK,CAAC;IAClB;EACF,CAAC;EAED,MAAMG,gBAAgB,GAAG5B,KAAK,CAACmB,WAAW,CACvCC,CAAC,IAAK;IACLN,cAAc,aAAdA,cAAc,uBAAdA,cAAc,CAAGM,CAAC,CAAC;IACnBJ,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAGI,CAAqC,CAAC;EACpD,CAAC,EACD,CAACN,cAAc,EAAEE,SAAS,CAC5B,CAAC;EAED,oBACEhB,KAAA,CAAA6B,aAAA,CAAC1B,iBAAiB;IAChBO,KAAK,EAAEA,KAAM;IACbD,UAAU,EAAEA,UAAW;IACvBF,GAAG,EAAEA,GAAI;IACTuB,QAAQ,EAAE,KAAM;IAChBC,YAAY,EAAEb,mBAAoB;IAClCJ,cAAc,EAAEc,gBAAiB;IACjCpB,YAAY,EAAEA,YAAa;IAC3BG,aAAa,EAAEA;EAAc,gBAE7BX,KAAA,CAAA6B,aAAA,CAAC3B,WAAW,EAAA8B,QAAA;IACVjB,UAAU,EAAEA,UAAW;IACvBC,SAAS,EAAEA,SAAU;IACrBJ,OAAO,EAAEY,uBAAwB;IACjCX,WAAW,EAAEA;EAAY,GACrBI,KAAK,CACV,CACgB,CAAC;AAExB,CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["components/Pressable/Pressable.d.ts"],"mappings":""}
|