react-native-external-keyboard 0.8.5 → 0.9.1
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/README.md +149 -67
- package/android/src/main/java/com/externalkeyboard/delegates/FocusOrderDelegate.java +81 -75
- package/android/src/main/java/com/externalkeyboard/delegates/FocusOrderDelegateHost.java +14 -0
- package/android/src/main/java/com/externalkeyboard/helper/Linking/A11yOrderLinking.java +5 -0
- package/android/src/main/java/com/externalkeyboard/modules/ExternalKeyboardModule.java +10 -10
- package/android/src/main/java/com/externalkeyboard/services/FocusLinkObserver/FocusLinkObserver.java +26 -35
- package/android/src/main/java/com/externalkeyboard/views/ExternalKeyboardLockView/ExternalKeyboardLockView.java +5 -0
- package/android/src/main/java/com/externalkeyboard/views/ExternalKeyboardLockView/ExternalKeyboardLockViewManager.java +6 -0
- package/android/src/main/java/com/externalkeyboard/views/ExternalKeyboardView/ExternalKeyboardView.java +8 -307
- package/android/src/main/java/com/externalkeyboard/views/ExternalKeyboardView/ExternalKeyboardViewManager.java +11 -18
- package/android/src/main/java/com/externalkeyboard/views/TextInputFocusWrapper/TextInputFocusWrapper.java +208 -101
- package/android/src/main/java/com/externalkeyboard/views/TextInputFocusWrapper/TextInputFocusWrapperManager.java +123 -34
- package/android/src/main/java/com/externalkeyboard/views/base/FocusHighlightBase.java +38 -0
- package/android/src/main/java/com/externalkeyboard/views/base/ViewGroupBase.java +19 -0
- package/android/src/main/java/com/externalkeyboard/views/base/ViewOrderGroupBase.java +190 -0
- package/android/src/main/java/com/externalkeyboard/views/base/keyboard/ViewFocusChangeBase.java +39 -0
- package/android/src/main/java/com/externalkeyboard/views/base/keyboard/ViewFocusRequestBase.java +125 -0
- package/android/src/main/java/com/externalkeyboard/views/base/keyboard/ViewKeyHandlerBase.java +40 -0
- package/android/src/newarch/TextInputFocusWrapperManagerSpec.java +2 -8
- package/android/src/oldarch/ExternalKeyboardLockViewManagerSpec.java +1 -0
- package/android/src/oldarch/TextInputFocusWrapperManagerSpec.java +32 -2
- package/ios/Delegates/RNCEKVFocusLinkDelegate/RNCEKVFocusLinkDelegate.h +35 -0
- package/ios/Delegates/RNCEKVFocusLinkDelegate/RNCEKVFocusLinkDelegate.mm +195 -0
- package/ios/Delegates/RNCEKVFocusOrderDelegate/RNCEKVFocusOrderProtocol.h +6 -8
- package/ios/Delegates/RNCEKVFocusSequenceDelegate/RNCEKVFocusSequenceDelegate.h +25 -0
- package/ios/Delegates/RNCEKVFocusSequenceDelegate/RNCEKVFocusSequenceDelegate.mm +163 -0
- package/ios/Delegates/RNCEKVGroupIdentifierDelegate/RNCEKVGroupIdentifierDelegate.h +2 -6
- package/ios/Delegates/RNCEKVGroupIdentifierDelegate/RNCEKVGroupIdentifierDelegate.mm +6 -78
- package/ios/Delegates/RNCEKVHaloDelegate/RNCEKVHaloDelegate.h +3 -4
- package/ios/Delegates/RNCEKVHaloDelegate/RNCEKVHaloDelegate.mm +32 -101
- package/ios/Delegates/RNCEKVHaloDelegate/RNCEKVHaloProtocol.h +1 -1
- package/ios/Extensions/RCTEnhancedScrollView+RNCEKVExternalKeyboard.mm +1 -1
- package/ios/Extensions/RCTTextInputComponentView+RNCEKVExternalKeyboard.mm +15 -0
- package/ios/Extensions/RCTViewComponentView+RNCEKVExternalKeyboard.h +9 -6
- package/ios/Extensions/RCTViewComponentView+RNCEKVExternalKeyboard.mm +16 -29
- package/ios/Extensions/UIViewController+RNCEKVExternalKeyboard.h +1 -0
- package/ios/Extensions/UIViewController+RNCEKVExternalKeyboard.mm +8 -0
- package/ios/Helpers/RNCEKVNativeProps/RNCEKVNativeProps.h +123 -0
- package/ios/Protocols/RNCEKVCustomFocusEffectProtocol.h +15 -0
- package/ios/Protocols/RNCEKVCustomGroudIdProtocol.h +15 -0
- package/ios/Protocols/RNCEKVKeyboardFocusableProtocol.h +15 -0
- package/ios/Services/RNCEKVFocusLinkObserver.mm +2 -3
- package/ios/Services/RNCEKVKeyboardOrderManager/RNCEKVOrderRelationship/RNCEKVOrderRelationship.mm +15 -28
- package/ios/Services/RNCEKVOrderLinking.mm +43 -51
- package/ios/Views/Base/ContextMenu/RNCEKVViewContextMenuBase.h +33 -0
- package/ios/Views/Base/ContextMenu/RNCEKVViewContextMenuBase.mm +84 -0
- package/ios/Views/Base/FocusChange/RNCEKVViewFocusChangeBase.h +37 -0
- package/ios/Views/Base/FocusChange/RNCEKVViewFocusChangeBase.mm +89 -0
- package/ios/Views/Base/FocusOrderGroup/RNCEKVViewOrderGroupBase.h +49 -0
- package/ios/Views/Base/FocusOrderGroup/RNCEKVViewOrderGroupBase.mm +245 -0
- package/ios/Views/Base/FocusRequest/RNCEKVViewFocusRequestBase.h +34 -0
- package/ios/Views/Base/FocusRequest/RNCEKVViewFocusRequestBase.mm +112 -0
- package/ios/Views/Base/GroupIdentifier/RNCEKVViewGroupIdentifierBase.h +27 -0
- package/ios/Views/Base/GroupIdentifier/RNCEKVViewGroupIdentifierBase.mm +69 -0
- package/ios/Views/Base/KeyPress/RNCEKVViewKeyPress.h +30 -0
- package/ios/Views/Base/KeyPress/RNCEKVViewKeyPress.mm +75 -0
- package/ios/Views/Base/KeyboardHallo/RNCEKVExternalKeyboardHalloBase.h +33 -0
- package/ios/Views/Base/KeyboardHallo/RNCEKVExternalKeyboardHalloBase.mm +92 -0
- package/ios/Views/Base/ViewGroup/RNCEKVViewGroupBase.h +36 -0
- package/ios/Views/Base/ViewGroup/RNCEKVViewGroupBase.mm +63 -0
- package/ios/Views/RNCEKVExternalKeyboardLockView/RNCEKVExternalKeyboardLockView.h +8 -0
- package/ios/Views/RNCEKVExternalKeyboardLockView/RNCEKVExternalKeyboardLockView.mm +105 -2
- package/ios/Views/RNCEKVExternalKeyboardLockView/RNCEKVExternalKeyboardLockViewManager.mm +11 -0
- package/ios/Views/RNCEKVExternalKeyboardView/RNCEKVExternalKeyboardView.h +7 -82
- package/ios/Views/RNCEKVExternalKeyboardView/RNCEKVExternalKeyboardView.mm +23 -493
- package/ios/Views/RNCEKVExternalKeyboardView/RNCEKVExternalKeyboardViewManager.mm +5 -7
- package/ios/Views/RNCEKVKeyboardFocusGroupView/RNCEKVKeyboardFocusGroup.mm +20 -17
- package/ios/Views/RNCEKVTextInputFocusWrapper/RNCEKVTextInputFocusWrapper.h +10 -39
- package/ios/Views/RNCEKVTextInputFocusWrapper/RNCEKVTextInputFocusWrapper.mm +40 -73
- package/ios/Views/RNCEKVTextInputFocusWrapper/RNCEKVTextInputFocusWrapperManager.mm +76 -8
- package/lib/commonjs/components/BaseKeyboardView/BaseKeyboardView.js +35 -7
- package/lib/commonjs/components/BaseKeyboardView/BaseKeyboardView.js.map +1 -1
- package/lib/commonjs/components/KeyboardExtendedInput/KeyboardExtendedInput.js +79 -1
- package/lib/commonjs/components/KeyboardExtendedInput/KeyboardExtendedInput.js.map +1 -1
- package/lib/commonjs/components/KeyboardFocusLock/FocusTrap/FocusTrap.js +18 -4
- package/lib/commonjs/components/KeyboardFocusLock/FocusTrap/FocusTrap.js.map +1 -1
- package/lib/commonjs/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.js +17 -2
- package/lib/commonjs/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.js.map +1 -1
- package/lib/commonjs/components/KeyboardFocusView/KeyboardFocusView.js +2 -0
- package/lib/commonjs/components/KeyboardFocusView/KeyboardFocusView.js.map +1 -1
- package/lib/commonjs/nativeSpec/ExternalKeyboardLockViewNativeComponent.ts +1 -0
- package/lib/commonjs/nativeSpec/TextInputFocusWrapperNativeComponent.ts +16 -0
- package/lib/commonjs/utils/useFocusStyle.js +3 -9
- package/lib/commonjs/utils/useFocusStyle.js.map +1 -1
- package/lib/commonjs/utils/withKeyboardFocus.js +32 -15
- package/lib/commonjs/utils/withKeyboardFocus.js.map +1 -1
- package/lib/commonjs/utils/wrapOrderPrefix.js +17 -0
- package/lib/commonjs/utils/wrapOrderPrefix.js.map +1 -0
- package/lib/module/components/BaseKeyboardView/BaseKeyboardView.js +35 -7
- package/lib/module/components/BaseKeyboardView/BaseKeyboardView.js.map +1 -1
- package/lib/module/components/KeyboardExtendedInput/KeyboardExtendedInput.js +80 -2
- package/lib/module/components/KeyboardExtendedInput/KeyboardExtendedInput.js.map +1 -1
- package/lib/module/components/KeyboardFocusLock/FocusTrap/FocusTrap.js +18 -4
- package/lib/module/components/KeyboardFocusLock/FocusTrap/FocusTrap.js.map +1 -1
- package/lib/module/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.js +16 -2
- package/lib/module/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.js.map +1 -1
- package/lib/module/components/KeyboardFocusView/KeyboardFocusView.js +2 -0
- package/lib/module/components/KeyboardFocusView/KeyboardFocusView.js.map +1 -1
- package/lib/module/nativeSpec/ExternalKeyboardLockViewNativeComponent.ts +1 -0
- package/lib/module/nativeSpec/TextInputFocusWrapperNativeComponent.ts +16 -0
- package/lib/module/utils/useFocusStyle.js +4 -10
- package/lib/module/utils/useFocusStyle.js.map +1 -1
- package/lib/module/utils/withKeyboardFocus.js +32 -15
- package/lib/module/utils/withKeyboardFocus.js.map +1 -1
- package/lib/module/utils/wrapOrderPrefix.js +12 -0
- package/lib/module/utils/wrapOrderPrefix.js.map +1 -0
- package/lib/typescript/src/components/BaseKeyboardView/BaseKeyboardView.d.ts.map +1 -1
- package/lib/typescript/src/components/KeyboardExtendedInput/KeyboardExtendedInput.d.ts.map +1 -1
- package/lib/typescript/src/components/KeyboardExtendedInput/KeyboardExtendedInput.types.d.ts +15 -0
- package/lib/typescript/src/components/KeyboardExtendedInput/KeyboardExtendedInput.types.d.ts.map +1 -1
- package/lib/typescript/src/components/KeyboardFocusLock/FocusTrap/FocusTrap.d.ts +1 -1
- package/lib/typescript/src/components/KeyboardFocusLock/FocusTrap/FocusTrap.d.ts.map +1 -1
- package/lib/typescript/src/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.d.ts +2 -1
- package/lib/typescript/src/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.d.ts.map +1 -1
- package/lib/typescript/src/components/KeyboardFocusView/KeyboardFocusView.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/nativeSpec/ExternalKeyboardLockViewNativeComponent.d.ts +1 -0
- package/lib/typescript/src/nativeSpec/ExternalKeyboardLockViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/nativeSpec/TextInputFocusWrapperNativeComponent.d.ts +16 -1
- package/lib/typescript/src/nativeSpec/TextInputFocusWrapperNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/types/BaseKeyboardView.d.ts +2 -0
- package/lib/typescript/src/types/BaseKeyboardView.d.ts.map +1 -1
- package/lib/typescript/src/types/KeyboardFocusLock.types.d.ts +1 -0
- package/lib/typescript/src/types/KeyboardFocusLock.types.d.ts.map +1 -1
- package/lib/typescript/src/types/WithKeyboardFocus.d.ts +11 -2
- package/lib/typescript/src/types/WithKeyboardFocus.d.ts.map +1 -1
- package/lib/typescript/src/utils/useFocusStyle.d.ts +1 -0
- package/lib/typescript/src/utils/useFocusStyle.d.ts.map +1 -1
- package/lib/typescript/src/utils/withKeyboardFocus.d.ts.map +1 -1
- package/lib/typescript/src/utils/wrapOrderPrefix.d.ts +9 -0
- package/lib/typescript/src/utils/wrapOrderPrefix.d.ts.map +1 -0
- package/package.json +6 -2
- package/src/components/BaseKeyboardView/BaseKeyboardView.tsx +88 -10
- package/src/components/KeyboardExtendedInput/KeyboardExtendedInput.tsx +138 -2
- package/src/components/KeyboardExtendedInput/KeyboardExtendedInput.types.ts +15 -0
- package/src/components/KeyboardFocusLock/FocusTrap/FocusTrap.tsx +21 -4
- package/src/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.tsx +20 -3
- package/src/components/KeyboardFocusView/KeyboardFocusView.tsx +2 -0
- package/src/nativeSpec/ExternalKeyboardLockViewNativeComponent.ts +1 -0
- package/src/nativeSpec/TextInputFocusWrapperNativeComponent.ts +16 -0
- package/src/types/BaseKeyboardView.ts +2 -0
- package/src/types/KeyboardFocusLock.types.ts +1 -0
- package/src/types/WithKeyboardFocus.ts +19 -2
- package/src/utils/useFocusStyle.tsx +5 -15
- package/src/utils/withKeyboardFocus.tsx +44 -15
- package/src/utils/wrapOrderPrefix.ts +16 -0
- package/ios/Delegates/RNCEKVFocusOrderDelegate/RNCEKVFocusGuideDelegate/RNCEKVFocusGuideDelegate.h +0 -36
- package/ios/Delegates/RNCEKVFocusOrderDelegate/RNCEKVFocusGuideDelegate/RNCEKVFocusGuideDelegate.mm +0 -150
- package/ios/Delegates/RNCEKVFocusOrderDelegate/RNCEKVFocusOrderDelegate.h +0 -47
- package/ios/Delegates/RNCEKVFocusOrderDelegate/RNCEKVFocusOrderDelegate.mm +0 -326
- package/ios/Services/RNCEKVKeyboardOrderManager/RNCEKVKeyboardOrderManager.h +0 -17
- package/ios/Services/RNCEKVKeyboardOrderManager/RNCEKVKeyboardOrderManager.mm +0 -15
- package/lib/commonjs/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.android.js +0 -22
- package/lib/commonjs/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.android.js.map +0 -1
- package/lib/module/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.android.js +0 -17
- package/lib/module/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.android.js.map +0 -1
- package/lib/typescript/src/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.android.d.ts +0 -4
- package/lib/typescript/src/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.android.d.ts.map +0 -1
- package/src/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.android.tsx +0 -16
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ViewProps, ColorValue } from 'react-native';
|
|
2
|
-
import type { DirectEventHandler, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
|
|
2
|
+
import type { DirectEventHandler, Float, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
|
|
3
3
|
export type FocusChange = Readonly<{
|
|
4
4
|
isFocused: boolean;
|
|
5
5
|
}>;
|
|
@@ -13,10 +13,25 @@ export interface TextInputFocusWrapperNativeComponent extends ViewProps {
|
|
|
13
13
|
blurType?: Int32;
|
|
14
14
|
canBeFocused?: boolean;
|
|
15
15
|
haloEffect?: boolean;
|
|
16
|
+
haloCornerRadius?: Float;
|
|
17
|
+
haloExpendX?: Float;
|
|
18
|
+
haloExpendY?: Float;
|
|
16
19
|
tintColor?: ColorValue;
|
|
17
20
|
blurOnSubmit?: boolean;
|
|
18
21
|
multiline?: boolean;
|
|
19
22
|
groupIdentifier?: string;
|
|
23
|
+
lockFocus?: Int32;
|
|
24
|
+
orderGroup?: string;
|
|
25
|
+
orderIndex?: Int32;
|
|
26
|
+
orderId?: string;
|
|
27
|
+
orderLeft?: string;
|
|
28
|
+
orderRight?: string;
|
|
29
|
+
orderUp?: string;
|
|
30
|
+
orderDown?: string;
|
|
31
|
+
orderForward?: string;
|
|
32
|
+
orderBackward?: string;
|
|
33
|
+
orderFirst?: string;
|
|
34
|
+
orderLast?: string;
|
|
20
35
|
}
|
|
21
36
|
declare const _default: (props: Omit<TextInputFocusWrapperNativeComponent, "ref"> & {
|
|
22
37
|
ref?: React.Ref<import("react-native").HostInstance>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInputFocusWrapperNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/nativeSpec/TextInputFocusWrapperNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,KAAK,EACV,kBAAkB,EAClB,KAAK,EACN,MAAM,2CAA2C,CAAC;AAInD,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;IACjC,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC;IACxC,IAAI,EAAE,MAAM,CAAC;CACd,CAAC,CAAC;AAEH,MAAM,WAAW,oCAAqC,SAAQ,SAAS;IACrE,aAAa,CAAC,EAAE,kBAAkB,CAAC,WAAW,CAAC,CAAC;IAChD,oBAAoB,CAAC,EAAE,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;IAC9D,SAAS,CAAC,EAAE,KAAK,CAAC;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"TextInputFocusWrapperNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/nativeSpec/TextInputFocusWrapperNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,KAAK,EACV,kBAAkB,EAClB,KAAK,EACL,KAAK,EACN,MAAM,2CAA2C,CAAC;AAInD,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;IACjC,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC;IACxC,IAAI,EAAE,MAAM,CAAC;CACd,CAAC,CAAC;AAEH,MAAM,WAAW,oCAAqC,SAAQ,SAAS;IACrE,aAAa,CAAC,EAAE,kBAAkB,CAAC,WAAW,CAAC,CAAC;IAChD,oBAAoB,CAAC,EAAE,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;IAC9D,SAAS,CAAC,EAAE,KAAK,CAAC;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gBAAgB,CAAC,EAAE,KAAK,CAAC;IACzB,WAAW,CAAC,EAAE,KAAK,CAAC;IACpB,WAAW,CAAC,EAAE,KAAK,CAAC;IACpB,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,KAAK,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;;;;AAED,wBAEE"}
|
|
@@ -63,6 +63,8 @@ export type BaseFocusViewProps = {
|
|
|
63
63
|
orderBackward?: string;
|
|
64
64
|
orderFirst?: string | null;
|
|
65
65
|
orderLast?: string | null;
|
|
66
|
+
orderPrefix?: string;
|
|
67
|
+
defaultFocusHighlightEnabled?: boolean;
|
|
66
68
|
};
|
|
67
69
|
export type BaseKeyboardViewProps = ViewProps & BaseFocusViewProps;
|
|
68
70
|
//# sourceMappingURL=BaseKeyboardView.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseKeyboardView.d.ts","sourceRoot":"","sources":["../../../../src/types/BaseKeyboardView.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,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4BAA4B,CAAC,EAAE,OAAO,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyboardFocusLock.types.d.ts","sourceRoot":"","sources":["../../../../src/types/KeyboardFocusLock.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG;IAC/C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"KeyboardFocusLock.types.d.ts","sourceRoot":"","sources":["../../../../src/types/KeyboardFocusLock.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG;IAC/C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC"}
|
|
@@ -16,7 +16,10 @@ export type KeyboardPressType<ComponentProps extends object> = {
|
|
|
16
16
|
onComponentFocus?: PickProp<ComponentProps, 'onFocus'>;
|
|
17
17
|
onComponentBlur?: PickProp<ComponentProps, 'onBlur'>;
|
|
18
18
|
};
|
|
19
|
-
|
|
19
|
+
/** Extracts the state argument from a component's children render prop, or `never`. */
|
|
20
|
+
type ExtractRenderPropState<T> = T extends (state: infer S) => any ? S : never;
|
|
21
|
+
export type ChildrenRenderState<CP extends object> = 'children' extends keyof CP ? ExtractRenderPropState<NonNullable<CP['children']>> : never;
|
|
22
|
+
export type WithKeyboardProps<ViewType = View, ViewStyleType = unknown, ComponentProps extends object = {}> = {
|
|
20
23
|
withPressedStyle?: boolean;
|
|
21
24
|
containerStyle?: ViewStyleType | ViewProps['style'];
|
|
22
25
|
containerFocusStyle?: FocusStyle;
|
|
@@ -26,10 +29,16 @@ export type WithKeyboardProps<ViewType = View, ViewStyleType = unknown> = {
|
|
|
26
29
|
style?: PressableProps['style'];
|
|
27
30
|
onBlur?: (() => void) | ((e: any) => void) | null;
|
|
28
31
|
onFocus?: (() => void) | ((e: any) => void) | null;
|
|
32
|
+
renderContent?: ChildrenRenderState<ComponentProps> extends never ? never : (state: ChildrenRenderState<ComponentProps> & {
|
|
33
|
+
focused: boolean;
|
|
34
|
+
}) => React.ReactNode;
|
|
35
|
+
renderFocusable?: (state: {
|
|
36
|
+
focused: boolean;
|
|
37
|
+
}) => React.ReactNode;
|
|
29
38
|
};
|
|
30
39
|
type KeyboardFocusBaseProps = Omit<FocusViewProps, 'onPress' | 'onLongPress' | 'onBlur' | 'onFocus'>;
|
|
31
40
|
type MergeProps<BaseProps extends object, OverrideProps extends object> = Omit<BaseProps, keyof OverrideProps> & OverrideProps;
|
|
32
|
-
type KeyboardFocusOverrideProps<ComponentProps extends object, ViewStyleType, ViewType = View> = KeyboardPressType<ComponentProps> & KeyboardFocusBaseProps & WithKeyboardProps<ViewType, ViewStyleType>;
|
|
41
|
+
type KeyboardFocusOverrideProps<ComponentProps extends object, ViewStyleType, ViewType = View> = KeyboardPressType<ComponentProps> & KeyboardFocusBaseProps & WithKeyboardProps<ViewType, ViewStyleType, ComponentProps>;
|
|
33
42
|
export type WithKeyboardFocus<ComponentProps extends object, ViewStyleType, ViewType = View> = MergeProps<ComponentProps, KeyboardFocusOverrideProps<ComponentProps, ViewStyleType, ViewType>>;
|
|
34
43
|
export type WithKeyboardPropsTypeDeclaration<ComponentProps extends object, ViewStyleType, ViewType = View> = WithKeyboardFocus<ComponentProps, ViewStyleType, ViewType> & RefAttributes<KeyboardFocus>;
|
|
35
44
|
export type WithKeyboardFocusDeclaration<ComponentProps extends object, ViewStyleType, ViewType = View> = React.JSXElementConstructor<WithKeyboardPropsTypeDeclaration<ComponentProps, ViewStyleType, ViewType>> | React.ForwardRefExoticComponent<WithKeyboardPropsTypeDeclaration<ComponentProps, ViewStyleType, ViewType>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WithKeyboardFocus.d.ts","sourceRoot":"","sources":["../../../../src/types/WithKeyboardFocus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,MAAM,MAAM,UAAU,GAClB,KAAK,CAAC,YAAY,GAClB,KAAK,CAAC,iBAAiB,GACvB,CAAC,MAAM,KAAK,CAAC,YAAY,CAAC,CAAC;AAE/B,KAAK,oBAAoB,GAAG,CAAC,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;AAErD,KAAK,gBAAgB,CACnB,cAAc,SAAS,MAAM,EAC7B,QAAQ,SAAS,SAAS,GAAG,aAAa,GAAG,WAAW,GAAG,YAAY,IACrE,QAAQ,SAAS,MAAM,cAAc,GACrC,cAAc,CAAC,QAAQ,CAAC,GACxB,oBAAoB,CAAC;AAEzB,KAAK,QAAQ,CACX,cAAc,SAAS,MAAM,EAC7B,QAAQ,SAAS,MAAM,IACrB,QAAQ,SAAS,MAAM,cAAc,GAAG,cAAc,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC;AAE/E,MAAM,MAAM,0BAA0B,CAAC,cAAc,SAAS,MAAM,IAChE,KAAK,CAAC,qBAAqB,CAAC,cAAc,CAAC,GA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a,CAAC;AAEhB,KAAK,0BAA0B,CAC7B,cAAc,SAAS,MAAM,EAC7B,aAAa,EACb,QAAQ,GAAG,IAAI,IACb,iBAAiB,CAAC,cAAc,CAAC,GACnC,sBAAsB,GACtB,iBAAiB,CAAC,QAAQ,EAAE,aAAa,EAAE,cAAc,CAAC,CAAC;AAE7D,MAAM,MAAM,iBAAiB,CAC3B,cAAc,SAAS,MAAM,EAC7B,aAAa,EACb,QAAQ,GAAG,IAAI,IACb,UAAU,CACZ,cAAc,EACd,0BAA0B,CAAC,cAAc,EAAE,aAAa,EAAE,QAAQ,CAAC,CACpE,CAAC;AAEF,MAAM,MAAM,gCAAgC,CAC1C,cAAc,SAAS,MAAM,EAC7B,aAAa,EACb,QAAQ,GAAG,IAAI,IACb,iBAAiB,CAAC,cAAc,EAAE,aAAa,EAAE,QAAQ,CAAC,GAC5D,aAAa,CAAC,aAAa,CAAC,CAAC;AAE/B,MAAM,MAAM,4BAA4B,CACtC,cAAc,SAAS,MAAM,EAC7B,aAAa,EACb,QAAQ,GAAG,IAAI,IAEb,KAAK,CAAC,qBAAqB,CACzB,gCAAgC,CAAC,cAAc,EAAE,aAAa,EAAE,QAAQ,CAAC,CAC1E,GACD,KAAK,CAAC,yBAAyB,CAC7B,gCAAgC,CAAC,cAAc,EAAE,aAAa,EAAE,QAAQ,CAAC,CAC1E,CAAC;AAEN,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,YAAY,GAAG,MAAM,CAAC"}
|
|
@@ -10,6 +10,7 @@ type UseFocusStyleProps<C> = {
|
|
|
10
10
|
style?: PressableProps['style'];
|
|
11
11
|
Component?: React.ComponentType<C>;
|
|
12
12
|
withPressedStyle?: boolean;
|
|
13
|
+
defaultFocusHighlightEnabled?: boolean;
|
|
13
14
|
};
|
|
14
15
|
export declare const useFocusStyle: <C extends {}>({ focusStyle, onFocusChange, containerFocusStyle, tintColor, tintType, style, Component, withPressedStyle, }: UseFocusStyleProps<C>) => {
|
|
15
16
|
componentStyleViewStyle: (({ pressed }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFocusStyle.d.ts","sourceRoot":"","sources":["../../../../src/utils/useFocusStyle.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"useFocusStyle.d.ts","sourceRoot":"","sources":["../../../../src/utils/useFocusStyle.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,cAAc,EAAa,MAAM,cAAc,CAAC;AAC/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAQ3D,KAAK,kBAAkB,CAAC,CAAC,IAAI;IAC3B,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,mBAAmB,CAAC,EAAE,UAAU,CAAC;IACjC,aAAa,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7C,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,KAAK,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;IAChC,SAAS,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IACnC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,4BAA4B,CAAC,EAAE,OAAO,CAAC;CACxC,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,EAAE,EAAE,8GASzC,kBAAkB,CAAC,CAAC,CAAC;4CA6CN;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwB0ttB,CAAC;kBAAoB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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+1 @@
|
|
|
1
|
-
{"version":3,"file":"withKeyboardFocus.d.ts","sourceRoot":"","sources":["../../../../src/utils/withKeyboardFocus.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,IAAI,EAAc,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEhE,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,2BAA2B,CAAC;AAE3E,OAAO,KAAK,EAEV,iBAAiB,EACjB,0BAA0B,EAC3B,MAAM,4BAA4B,CAAC;AAMpC,eAAO,MAAM,iBAAiB,GAC5B,cAAc,SAAS,MAAM,EAC7B,aAAa,EACb,QAAQ,GAAG,IAAI,EAEf,WAAW,0BAA0B,CAAC,cAAc,CAAC;OAFjD,CAAC;;OAGJ,CAAC;
|
|
1
|
+
{"version":3,"file":"withKeyboardFocus.d.ts","sourceRoot":"","sources":["../../../../src/utils/withKeyboardFocus.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,IAAI,EAAc,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEhE,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,2BAA2B,CAAC;AAE3E,OAAO,KAAK,EAEV,iBAAiB,EACjB,0BAA0B,EAC3B,MAAM,4BAA4B,CAAC;AAMpC,eAAO,MAAM,iBAAiB,GAC5B,cAAc,SAAS,MAAM,EAC7B,aAAa,EACb,QAAQ,GAAG,IAAI,EAEf,WAAW,0BAA0B,CAAC,cAAc,CAAC;OAFjD,CAAC;;OAGJ,CAAC;wCA8MH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type Wrap = (id: string | undefined) => string | undefined;
|
|
2
|
+
/**
|
|
3
|
+
* Returns a function that prepends `prefix` to an order ID.
|
|
4
|
+
* When `prefix` is empty the identity function is returned — no
|
|
5
|
+
* per-call branch needed.
|
|
6
|
+
*/
|
|
7
|
+
export declare const wrapOrderPrefix: (prefix: string) => Wrap;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=wrapOrderPrefix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapOrderPrefix.d.ts","sourceRoot":"","sources":["../../../../src/utils/wrapOrderPrefix.ts"],"names":[],"mappings":"AAAA,KAAK,IAAI,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,KAAK,MAAM,GAAG,SAAS,CAAC;AAS3D;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,KAAG,IACT,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-external-keyboard",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "Toolkit for improving physical keyboard support in React Native",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -46,7 +46,11 @@
|
|
|
46
46
|
"keyboard",
|
|
47
47
|
"keyboard focus",
|
|
48
48
|
"physical keyboard",
|
|
49
|
-
"
|
|
49
|
+
"focus lock",
|
|
50
|
+
"focus order",
|
|
51
|
+
"WCAG",
|
|
52
|
+
"UIFocusHaloEffect",
|
|
53
|
+
"defaultFocusHighlightEnabled"
|
|
50
54
|
],
|
|
51
55
|
"repository": "https://github.com/ArturKalach/react-native-external-keyboard",
|
|
52
56
|
"author": "Artur Kalach <artur.kalach.andreevich@gmail.com> (https://github.com/ArturKalach)",
|
|
@@ -20,6 +20,7 @@ import { useBubbledInfo } from './BaseKeyboardView.hooks';
|
|
|
20
20
|
import { useGroupIdentifierContext } from '../../context/GroupIdentifierContext';
|
|
21
21
|
import { useOnFocusChange } from '../../utils/useOnFocusChange';
|
|
22
22
|
import { useOrderFocusGroup } from '../../context/OrderFocusContext';
|
|
23
|
+
import { wrapOrderPrefix } from '../../utils/wrapOrderPrefix';
|
|
23
24
|
|
|
24
25
|
// @ts-ignore
|
|
25
26
|
type NativeRef = React.ElementRef<ComponentType>;
|
|
@@ -93,7 +94,14 @@ export const BaseKeyboardView = React.memo(
|
|
|
93
94
|
orderFirst,
|
|
94
95
|
orderLast,
|
|
95
96
|
orderGroup,
|
|
97
|
+
orderLeft,
|
|
98
|
+
orderRight,
|
|
99
|
+
orderUp,
|
|
100
|
+
orderDown,
|
|
101
|
+
orderId,
|
|
96
102
|
enableContextMenu,
|
|
103
|
+
orderPrefix: _orderPrefix,
|
|
104
|
+
defaultFocusHighlightEnabled = true,
|
|
97
105
|
...props
|
|
98
106
|
},
|
|
99
107
|
ref
|
|
@@ -106,17 +114,51 @@ export const BaseKeyboardView = React.memo(
|
|
|
106
114
|
);
|
|
107
115
|
|
|
108
116
|
const contextIdentifier = useGroupIdentifierContext();
|
|
109
|
-
|
|
110
117
|
const contextGroupId = useOrderFocusGroup();
|
|
111
118
|
const groupId = orderGroup ?? contextGroupId;
|
|
112
119
|
|
|
120
|
+
const orderPrefix = _orderPrefix ?? contextGroupId ?? '';
|
|
121
|
+
|
|
113
122
|
useEffect(() => {
|
|
123
|
+
if (!__DEV__) return;
|
|
114
124
|
if (orderIndex !== undefined && !groupId)
|
|
115
125
|
console.warn(
|
|
116
126
|
'`orderIndex` must be declared alongside `orderGroup` for proper functionality. Ensure components are wrapped with `KeyboardOrderFocusGroup` or provide `orderGroup` directly.'
|
|
117
127
|
);
|
|
118
128
|
}, [groupId, orderIndex]);
|
|
119
129
|
|
|
130
|
+
useEffect(() => {
|
|
131
|
+
if (!__DEV__) return;
|
|
132
|
+
const hasOrderLinkProp =
|
|
133
|
+
orderId !== undefined ||
|
|
134
|
+
orderForward !== undefined ||
|
|
135
|
+
orderBackward !== undefined ||
|
|
136
|
+
orderFirst !== undefined ||
|
|
137
|
+
orderLast !== undefined ||
|
|
138
|
+
orderLeft !== undefined ||
|
|
139
|
+
orderRight !== undefined ||
|
|
140
|
+
orderUp !== undefined ||
|
|
141
|
+
orderDown !== undefined;
|
|
142
|
+
if (hasOrderLinkProp && orderPrefix === '') {
|
|
143
|
+
console.warn(
|
|
144
|
+
'[react-native-external-keyboard] orderId, orderForward, orderBackward, orderFirst, orderLast, ' +
|
|
145
|
+
'orderLeft, orderRight, orderUp, and orderDown are global IDs. ' +
|
|
146
|
+
'Wrap the component in <KeyboardOrderFocusGroup> or pass orderPrefix to avoid ID collisions across screens.'
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
}, [
|
|
150
|
+
orderId,
|
|
151
|
+
orderForward,
|
|
152
|
+
orderBackward,
|
|
153
|
+
orderFirst,
|
|
154
|
+
orderLast,
|
|
155
|
+
orderLeft,
|
|
156
|
+
orderRight,
|
|
157
|
+
orderUp,
|
|
158
|
+
orderDown,
|
|
159
|
+
orderPrefix,
|
|
160
|
+
]);
|
|
161
|
+
|
|
120
162
|
useImperativeHandle(
|
|
121
163
|
ref,
|
|
122
164
|
() => {
|
|
@@ -154,16 +196,55 @@ export const BaseKeyboardView = React.memo(
|
|
|
154
196
|
const hasOnFocusChanged = onFocusChange || onFocus || onBlur;
|
|
155
197
|
const ignoreFocusHint = Platform.OS !== 'ios' || !ignoreGroupFocusHint;
|
|
156
198
|
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
199
|
+
const wrapPrefix = useMemo(
|
|
200
|
+
() => wrapOrderPrefix(orderPrefix),
|
|
201
|
+
[orderPrefix]
|
|
202
|
+
);
|
|
203
|
+
|
|
204
|
+
const wrappedOrderProps = useMemo(
|
|
205
|
+
() => ({
|
|
206
|
+
orderId: wrapPrefix(orderId),
|
|
207
|
+
orderForward: wrapPrefix(orderForward),
|
|
208
|
+
orderBackward: wrapPrefix(orderBackward),
|
|
209
|
+
orderFirst: wrapPrefix(
|
|
210
|
+
orderFirst === null ? undefined : orderFirst ?? orderForward
|
|
211
|
+
),
|
|
212
|
+
orderLast: wrapPrefix(
|
|
213
|
+
orderLast === null ? undefined : orderLast ?? orderBackward
|
|
214
|
+
),
|
|
215
|
+
orderLeft: wrapPrefix(orderLeft),
|
|
216
|
+
orderRight: wrapPrefix(orderRight),
|
|
217
|
+
orderUp: wrapPrefix(orderUp),
|
|
218
|
+
orderDown: wrapPrefix(orderDown),
|
|
219
|
+
}),
|
|
220
|
+
[
|
|
221
|
+
wrapPrefix,
|
|
222
|
+
orderId,
|
|
223
|
+
orderForward,
|
|
224
|
+
orderBackward,
|
|
225
|
+
orderFirst,
|
|
226
|
+
orderLast,
|
|
227
|
+
orderLeft,
|
|
228
|
+
orderRight,
|
|
229
|
+
orderUp,
|
|
230
|
+
orderDown,
|
|
231
|
+
]
|
|
232
|
+
);
|
|
233
|
+
|
|
234
|
+
const platformSpecificHalo = useMemo(
|
|
235
|
+
() =>
|
|
236
|
+
Platform.select({
|
|
237
|
+
ios: haloEffect,
|
|
238
|
+
android: defaultFocusHighlightEnabled,
|
|
239
|
+
}) ?? true,
|
|
240
|
+
[defaultFocusHighlightEnabled, haloEffect]
|
|
241
|
+
);
|
|
161
242
|
|
|
162
243
|
return (
|
|
163
244
|
<KeyPressContext.Provider value={bubbled.context}>
|
|
164
245
|
<ExternalKeyboardViewNative
|
|
165
246
|
{...props}
|
|
166
|
-
haloEffect={
|
|
247
|
+
haloEffect={platformSpecificHalo}
|
|
167
248
|
ref={targetRef as React.RefObject<any>}
|
|
168
249
|
enableContextMenu={enableContextMenu}
|
|
169
250
|
canBeFocused={ignoreFocusHint && focusable && canBeFocused}
|
|
@@ -184,10 +265,7 @@ export const BaseKeyboardView = React.memo(
|
|
|
184
265
|
enableA11yFocus={enableA11yFocus}
|
|
185
266
|
screenAutoA11yFocusDelay={screenAutoA11yFocusDelay}
|
|
186
267
|
lockFocus={lockFocusValue}
|
|
187
|
-
|
|
188
|
-
orderBackward={orderBackward}
|
|
189
|
-
orderFirst={_orderFirst}
|
|
190
|
-
orderLast={_orderLast}
|
|
268
|
+
{...wrappedOrderProps}
|
|
191
269
|
orderGroup={groupId}
|
|
192
270
|
/>
|
|
193
271
|
</KeyPressContext.Provider>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useMemo } from 'react';
|
|
1
|
+
import React, { useEffect, useMemo } from 'react';
|
|
2
2
|
import { View, TextInput, Platform, StyleSheet } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { TextInputFocusWrapperNative } from '../../nativeSpec';
|
|
@@ -6,8 +6,44 @@ import { useFocusStyle } from '../../utils/useFocusStyle';
|
|
|
6
6
|
import { focusEventMapper } from '../../utils/focusEventMapper';
|
|
7
7
|
import { RenderPropComponent } from '../RenderPropComponent/RenderPropComponent';
|
|
8
8
|
import { useGroupIdentifierContext } from '../../context/GroupIdentifierContext';
|
|
9
|
+
import { useOrderFocusGroup } from '../../context/OrderFocusContext';
|
|
9
10
|
import type { KeyboardInputProps } from './KeyboardExtendedInput.types';
|
|
10
11
|
import { blurMap, focusMap } from './KeyboardExtendedInput.consts';
|
|
12
|
+
import { wrapOrderPrefix } from '../../utils/wrapOrderPrefix';
|
|
13
|
+
import {
|
|
14
|
+
LockFocusEnum,
|
|
15
|
+
type LockFocusType,
|
|
16
|
+
} from '../../types/BaseKeyboardView';
|
|
17
|
+
|
|
18
|
+
enum BITS {
|
|
19
|
+
BIT_01 = 0b1,
|
|
20
|
+
BIT_02 = 0b10,
|
|
21
|
+
BIT_03 = 0b100,
|
|
22
|
+
BIT_04 = 0b1000,
|
|
23
|
+
BIT_05 = 0b10000,
|
|
24
|
+
BIT_06 = 0b100000,
|
|
25
|
+
BIT_07 = 0b1000000,
|
|
26
|
+
BIT_08 = 0b10000000,
|
|
27
|
+
BIT_09 = 0b100000000,
|
|
28
|
+
BIT_10 = 0b1000000000,
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const focusBinaryValue: Record<LockFocusEnum, number> = {
|
|
32
|
+
[LockFocusEnum.Up]: BITS.BIT_01,
|
|
33
|
+
[LockFocusEnum.Down]: BITS.BIT_02,
|
|
34
|
+
[LockFocusEnum.Left]: BITS.BIT_03,
|
|
35
|
+
[LockFocusEnum.Right]: BITS.BIT_04,
|
|
36
|
+
[LockFocusEnum.Forward]: BITS.BIT_05,
|
|
37
|
+
[LockFocusEnum.Backward]: BITS.BIT_06,
|
|
38
|
+
[LockFocusEnum.First]: BITS.BIT_09,
|
|
39
|
+
[LockFocusEnum.Last]: BITS.BIT_10,
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const mapLockFocus = (values: LockFocusType[] | undefined): number => {
|
|
43
|
+
if (!values || !values.length) return 0;
|
|
44
|
+
// eslint-disable-next-line no-bitwise
|
|
45
|
+
return values.reduce((acc, item) => acc | focusBinaryValue[item], 0);
|
|
46
|
+
};
|
|
11
47
|
|
|
12
48
|
const isIOS = Platform.OS === 'ios';
|
|
13
49
|
|
|
@@ -33,10 +69,24 @@ export const KeyboardExtendedInput = React.forwardRef<
|
|
|
33
69
|
onSubmitEditing,
|
|
34
70
|
submitBehavior,
|
|
35
71
|
groupIdentifier,
|
|
72
|
+
lockFocus,
|
|
73
|
+
orderGroup,
|
|
74
|
+
orderIndex,
|
|
75
|
+
orderId,
|
|
76
|
+
orderForward,
|
|
77
|
+
orderBackward,
|
|
78
|
+
orderLeft,
|
|
79
|
+
orderRight,
|
|
80
|
+
orderUp,
|
|
81
|
+
orderDown,
|
|
36
82
|
rejectResponderTermination,
|
|
37
83
|
selectionHandleColor,
|
|
38
84
|
cursorColor,
|
|
39
85
|
maxFontSizeMultiplier,
|
|
86
|
+
orderFirst,
|
|
87
|
+
orderLast,
|
|
88
|
+
defaultFocusHighlightEnabled = true,
|
|
89
|
+
orderPrefix: _orderPrefix,
|
|
40
90
|
...props
|
|
41
91
|
},
|
|
42
92
|
ref
|
|
@@ -56,8 +106,15 @@ export const KeyboardExtendedInput = React.forwardRef<
|
|
|
56
106
|
});
|
|
57
107
|
|
|
58
108
|
const contextIdentifier = useGroupIdentifierContext();
|
|
109
|
+
const contextGroupId = useOrderFocusGroup();
|
|
110
|
+
const groupId = orderGroup ?? contextGroupId;
|
|
59
111
|
|
|
60
|
-
const
|
|
112
|
+
const orderPrefix = _orderPrefix ?? contextGroupId ?? '';
|
|
113
|
+
|
|
114
|
+
const withHaloEffect = Platform.select({
|
|
115
|
+
ios: tintType === 'default' && haloEffect,
|
|
116
|
+
android: defaultFocusHighlightEnabled,
|
|
117
|
+
});
|
|
61
118
|
|
|
62
119
|
const nativeFocusHandler = useMemo(
|
|
63
120
|
() => focusEventMapper(onFocusChangeHandler),
|
|
@@ -76,6 +133,81 @@ export const KeyboardExtendedInput = React.forwardRef<
|
|
|
76
133
|
? submitBehavior === 'blurAndSubmit'
|
|
77
134
|
: props.blurOnSubmit ?? true;
|
|
78
135
|
|
|
136
|
+
useEffect(() => {
|
|
137
|
+
if (!__DEV__) return;
|
|
138
|
+
if (orderIndex !== undefined && !groupId)
|
|
139
|
+
console.warn(
|
|
140
|
+
'`orderIndex` must be declared alongside `orderGroup` for proper functionality. Ensure components are wrapped with `KeyboardOrderFocusGroup` or provide `orderGroup` directly.'
|
|
141
|
+
);
|
|
142
|
+
}, [groupId, orderIndex]);
|
|
143
|
+
|
|
144
|
+
useEffect(() => {
|
|
145
|
+
if (!__DEV__) return;
|
|
146
|
+
const hasOrderLinkProp =
|
|
147
|
+
orderId !== undefined ||
|
|
148
|
+
orderForward !== undefined ||
|
|
149
|
+
orderBackward !== undefined ||
|
|
150
|
+
orderFirst !== undefined ||
|
|
151
|
+
orderLast !== undefined ||
|
|
152
|
+
orderLeft !== undefined ||
|
|
153
|
+
orderRight !== undefined ||
|
|
154
|
+
orderUp !== undefined ||
|
|
155
|
+
orderDown !== undefined;
|
|
156
|
+
if (hasOrderLinkProp && orderPrefix === '') {
|
|
157
|
+
console.warn(
|
|
158
|
+
'[react-native-external-keyboard] orderId, orderForward, orderBackward, orderFirst, orderLast, ' +
|
|
159
|
+
'orderLeft, orderRight, orderUp, and orderDown are global IDs. ' +
|
|
160
|
+
'Wrap the component in <KeyboardOrderFocusGroup> or pass orderPrefix to avoid ID collisions across screens.'
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
}, [
|
|
164
|
+
orderId,
|
|
165
|
+
orderForward,
|
|
166
|
+
orderBackward,
|
|
167
|
+
orderFirst,
|
|
168
|
+
orderLast,
|
|
169
|
+
orderLeft,
|
|
170
|
+
orderRight,
|
|
171
|
+
orderUp,
|
|
172
|
+
orderDown,
|
|
173
|
+
orderPrefix,
|
|
174
|
+
]);
|
|
175
|
+
|
|
176
|
+
const wrapPrefix = useMemo(
|
|
177
|
+
() => wrapOrderPrefix(orderPrefix),
|
|
178
|
+
[orderPrefix]
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
const wrappedOrderProps = useMemo(
|
|
182
|
+
() => ({
|
|
183
|
+
orderId: wrapPrefix(orderId),
|
|
184
|
+
orderForward: wrapPrefix(orderForward),
|
|
185
|
+
orderBackward: wrapPrefix(orderBackward),
|
|
186
|
+
orderLeft: wrapPrefix(orderLeft),
|
|
187
|
+
orderRight: wrapPrefix(orderRight),
|
|
188
|
+
orderUp: wrapPrefix(orderUp),
|
|
189
|
+
orderDown: wrapPrefix(orderDown),
|
|
190
|
+
orderFirst: wrapPrefix(
|
|
191
|
+
orderFirst === null ? undefined : orderFirst ?? orderForward
|
|
192
|
+
),
|
|
193
|
+
orderLast: wrapPrefix(
|
|
194
|
+
orderLast === null ? undefined : orderLast ?? orderBackward
|
|
195
|
+
),
|
|
196
|
+
}),
|
|
197
|
+
[
|
|
198
|
+
wrapPrefix,
|
|
199
|
+
orderId,
|
|
200
|
+
orderForward,
|
|
201
|
+
orderBackward,
|
|
202
|
+
orderLeft,
|
|
203
|
+
orderRight,
|
|
204
|
+
orderUp,
|
|
205
|
+
orderDown,
|
|
206
|
+
orderFirst,
|
|
207
|
+
orderLast,
|
|
208
|
+
]
|
|
209
|
+
);
|
|
210
|
+
|
|
79
211
|
return (
|
|
80
212
|
<TextInputFocusWrapperNative
|
|
81
213
|
onFocusChange={nativeFocusHandler as unknown as undefined} //ToDo update type
|
|
@@ -89,6 +221,10 @@ export const KeyboardExtendedInput = React.forwardRef<
|
|
|
89
221
|
canBeFocused={canBeFocusable && focusable}
|
|
90
222
|
tintColor={isIOS ? tintColor : undefined}
|
|
91
223
|
groupIdentifier={groupIdentifier ?? contextIdentifier}
|
|
224
|
+
lockFocus={mapLockFocus(lockFocus)}
|
|
225
|
+
orderGroup={groupId}
|
|
226
|
+
orderIndex={orderIndex ?? -1}
|
|
227
|
+
{...wrappedOrderProps}
|
|
92
228
|
>
|
|
93
229
|
<TextInput
|
|
94
230
|
ref={ref as React.RefObject<any>}
|
|
@@ -9,6 +9,7 @@ import type { FocusStyle } from '../../types/FocusStyle';
|
|
|
9
9
|
import type { TintType } from '../../types/WithKeyboardFocus';
|
|
10
10
|
import { type RenderProp } from '../RenderPropComponent/RenderPropComponent';
|
|
11
11
|
import type { blurMap, focusMap } from './KeyboardExtendedInput.consts';
|
|
12
|
+
import type { LockFocusType } from '../../types/BaseKeyboardView';
|
|
12
13
|
|
|
13
14
|
export type ExtraKeyboardProps = {
|
|
14
15
|
focusType?: keyof typeof focusMap;
|
|
@@ -25,6 +26,20 @@ export type ExtraKeyboardProps = {
|
|
|
25
26
|
FocusHoverComponent?: RenderProp;
|
|
26
27
|
submitBehavior?: string;
|
|
27
28
|
groupIdentifier?: string;
|
|
29
|
+
lockFocus?: LockFocusType[];
|
|
30
|
+
orderGroup?: string;
|
|
31
|
+
orderIndex?: number;
|
|
32
|
+
orderId?: string;
|
|
33
|
+
orderForward?: string;
|
|
34
|
+
orderBackward?: string;
|
|
35
|
+
orderLeft?: string;
|
|
36
|
+
orderRight?: string;
|
|
37
|
+
orderUp?: string;
|
|
38
|
+
orderDown?: string;
|
|
39
|
+
orderFirst?: string | null;
|
|
40
|
+
orderLast?: string | null;
|
|
41
|
+
orderPrefix?: string;
|
|
42
|
+
defaultFocusHighlightEnabled?: boolean;
|
|
28
43
|
};
|
|
29
44
|
|
|
30
45
|
type IgnoreForCompatibility =
|
|
@@ -1,9 +1,26 @@
|
|
|
1
1
|
import { View } from 'react-native';
|
|
2
2
|
import { FocusTrapMountWrapper } from './FocusTrapMountWrapper';
|
|
3
3
|
import type { KeyboardFocusLockProps } from '../../../types/KeyboardFocusLock.types';
|
|
4
|
+
import { KeyboardFocusLockBase } from '../KeyboardFocusLockBase/KeyboardFocusLockBase';
|
|
4
5
|
|
|
5
|
-
export const FocusTrap = (
|
|
6
|
-
|
|
6
|
+
export const FocusTrap = ({
|
|
7
|
+
forceLock = false,
|
|
8
|
+
...props
|
|
9
|
+
}: KeyboardFocusLockProps) => {
|
|
10
|
+
if (forceLock) {
|
|
11
|
+
return (
|
|
12
|
+
<FocusTrapMountWrapper>
|
|
13
|
+
<KeyboardFocusLockBase
|
|
14
|
+
collapsable={false}
|
|
15
|
+
accessibilityViewIsModal={true}
|
|
16
|
+
forceLock={forceLock}
|
|
17
|
+
{...props}
|
|
18
|
+
/>
|
|
19
|
+
</FocusTrapMountWrapper>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return (
|
|
7
24
|
<View collapsable={false} accessibilityViewIsModal={true} {...props} />
|
|
8
|
-
|
|
9
|
-
|
|
25
|
+
);
|
|
26
|
+
};
|
|
@@ -1,5 +1,22 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ExternalKeyboardLockView from '../../../nativeSpec/ExternalKeyboardLockViewNativeComponent';
|
|
3
|
+
|
|
2
4
|
import type { KeyboardFocusLockProps } from '../../../types/KeyboardFocusLock.types';
|
|
3
5
|
|
|
4
|
-
export const KeyboardFocusLockBase =
|
|
5
|
-
|
|
6
|
+
export const KeyboardFocusLockBase = React.memo<KeyboardFocusLockProps>(
|
|
7
|
+
({
|
|
8
|
+
lockDisabled = false,
|
|
9
|
+
componentType = 0,
|
|
10
|
+
forceLock = false,
|
|
11
|
+
...props
|
|
12
|
+
}) => {
|
|
13
|
+
return (
|
|
14
|
+
<ExternalKeyboardLockView
|
|
15
|
+
{...props}
|
|
16
|
+
componentType={componentType}
|
|
17
|
+
lockDisabled={lockDisabled}
|
|
18
|
+
forceLock={forceLock}
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
);
|
|
@@ -46,6 +46,7 @@ export const KeyboardFocusView = React.forwardRef<
|
|
|
46
46
|
children,
|
|
47
47
|
accessible,
|
|
48
48
|
triggerCodes,
|
|
49
|
+
defaultFocusHighlightEnabled = true,
|
|
49
50
|
...props
|
|
50
51
|
},
|
|
51
52
|
ref
|
|
@@ -96,6 +97,7 @@ export const KeyboardFocusView = React.forwardRef<
|
|
|
96
97
|
onFocusChange={onFocusChangeHandler}
|
|
97
98
|
onContextMenuPress={onLongPress}
|
|
98
99
|
haloEffect={withHaloEffect}
|
|
100
|
+
defaultFocusHighlightEnabled={defaultFocusHighlightEnabled}
|
|
99
101
|
autoFocus={autoFocus}
|
|
100
102
|
canBeFocused={canBeFocused}
|
|
101
103
|
focusable={focusable}
|