react-native-external-keyboard 0.9.1 → 1.0.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/README.md +95 -600
- package/android/build.gradle +0 -18
- package/android/src/main/java/com/externalkeyboard/ExternalKeyboardViewPackage.java +24 -22
- package/android/src/main/java/com/externalkeyboard/events/EventHelper.java +10 -13
- package/android/src/main/java/com/externalkeyboard/helper/FocusHelper.java +1 -2
- package/android/src/main/java/com/externalkeyboard/services/FocusMemoryService.java +64 -0
- package/android/src/main/java/com/externalkeyboard/services/KeyboardFocusService.java +41 -0
- package/android/src/main/java/com/externalkeyboard/services/KeyboardService.java +4 -13
- package/android/src/main/java/com/externalkeyboard/views/ExternalKeyboardView/ExternalKeyboardView.java +2 -8
- package/android/src/main/java/com/externalkeyboard/views/ExternalKeyboardView/ExternalKeyboardViewManager.java +20 -13
- package/android/src/main/java/com/externalkeyboard/views/TextInputFocusWrapper/TextInputFocusWrapper.java +99 -21
- package/android/src/main/java/com/externalkeyboard/views/TextInputFocusWrapper/TextInputFocusWrapperManager.java +11 -0
- package/android/src/main/java/com/externalkeyboard/views/base/FocusHighlightBase.java +11 -5
- package/android/src/main/java/com/externalkeyboard/views/base/FocusableBase.java +36 -0
- package/android/src/main/java/com/externalkeyboard/views/base/keyboard/ViewFocusChangeBase.java +2 -3
- package/android/src/main/java/com/externalkeyboard/views/base/keyboard/ViewFocusRequestBase.java +10 -61
- package/android/src/newarch/ExternalKeyboardLockViewManagerInterface.java +11 -0
- package/android/src/newarch/ExternalKeyboardLockViewManagerSpec.java +0 -1
- package/android/src/newarch/ExternalKeyboardViewManagerInterface.java +42 -0
- package/android/src/newarch/ExternalKeyboardViewManagerSpec.java +0 -1
- package/android/src/newarch/KeyboardFocusGroupManagerInterface.java +12 -0
- package/android/src/newarch/KeyboardFocusGroupManagerSpec.java +0 -1
- package/android/src/newarch/TextInputFocusWrapperManagerInterface.java +34 -0
- package/android/src/newarch/TextInputFocusWrapperManagerSpec.java +0 -10
- package/android/src/newarch/helper/ReactNativeEventDispatcher.java +28 -0
- package/android/src/oldarch/ExternalKeyboardViewManagerSpec.java +6 -4
- package/android/src/oldarch/TextInputFocusWrapperManagerSpec.java +4 -0
- package/android/src/oldarch/helper/ReactNativeEventDispatcher.java +15 -0
- package/ios/Delegates/RNCEKVFocusDelegate/RNCEKVFocusDelegate.mm +1 -1
- package/ios/Delegates/RNCEKVFocusDelegate/RNCEKVFocusProtocol.h +1 -1
- package/ios/Delegates/RNCEKVHaloDelegate/RNCEKVHaloDelegate.h +2 -1
- package/ios/Delegates/RNCEKVHaloDelegate/RNCEKVHaloDelegate.mm +41 -5
- package/ios/Delegates/RNCEKVHaloDelegate/RNCEKVHaloProtocol.h +1 -0
- package/ios/Extensions/RCTCustomScrollView+RNCEKVExternalKeyboard.mm +5 -6
- package/ios/Extensions/RCTEnhancedScrollView+RNCEKVExternalKeyboard.mm +8 -9
- package/ios/Extensions/RCTTextInputComponentView+RNCEKVExternalKeyboard.mm +1 -1
- package/ios/Extensions/RCTViewComponentView+RNCEKVExternalKeyboard.h +0 -1
- package/ios/Extensions/RCTViewComponentView+RNCEKVExternalKeyboard.mm +16 -4
- package/ios/Extensions/UIViewController+RNCEKVExternalKeyboard.mm +7 -10
- package/ios/Helpers/RNCEKVNativeProps/RNCEKVNativeProps.h +4 -4
- package/ios/Helpers/RNCEKVSwizzleInstanceMethod/RNCEKVSwizzleInstanceMethod.h +19 -0
- package/ios/Protocols/RNCEKVCustomFocusEffectProtocol.h +1 -1
- package/ios/Services/RNCEKVFocusMemoryService.h +39 -0
- package/ios/Services/RNCEKVFocusMemoryService.mm +42 -0
- package/ios/Services/RNCEKVKeyboardFocusService.h +28 -0
- package/ios/Services/RNCEKVKeyboardFocusService.mm +54 -0
- package/ios/Views/Base/FocusChange/RNCEKVViewFocusChangeBase.h +2 -0
- package/ios/Views/Base/FocusChange/RNCEKVViewFocusChangeBase.mm +12 -10
- package/ios/Views/Base/FocusRequest/RNCEKVViewFocusRequestBase.h +1 -1
- package/ios/Views/Base/FocusRequest/RNCEKVViewFocusRequestBase.mm +6 -17
- package/ios/Views/Base/KeyboardHallo/RNCEKVExternalKeyboardHalloBase.h +1 -0
- package/ios/Views/Base/KeyboardHallo/RNCEKVExternalKeyboardHalloBase.mm +146 -6
- package/ios/Views/Base/ViewGroup/RNCEKVViewGroupBase.h +2 -0
- package/ios/Views/Base/ViewGroup/RNCEKVViewGroupBase.mm +4 -0
- package/ios/Views/RNCEKVExternalKeyboardView/RNCEKVExternalKeyboardView.h +1 -1
- package/ios/Views/RNCEKVExternalKeyboardView/RNCEKVExternalKeyboardView.mm +8 -4
- package/ios/Views/RNCEKVExternalKeyboardView/RNCEKVExternalKeyboardViewManager.mm +22 -11
- package/ios/Views/RNCEKVTextInputFocusWrapper/RNCEKVTextInputFocusWrapper.mm +17 -0
- package/ios/Views/RNCEKVTextInputFocusWrapper/RNCEKVTextInputFocusWrapperManager.mm +12 -0
- package/lib/commonjs/components/BaseKeyboardView/BaseKeyboardView.js +67 -65
- package/lib/commonjs/components/BaseKeyboardView/BaseKeyboardView.js.map +1 -1
- package/lib/commonjs/components/KeyboardExtendedInput/KeyboardExtendedInput.js +49 -97
- package/lib/commonjs/components/KeyboardExtendedInput/KeyboardExtendedInput.js.map +1 -1
- package/lib/commonjs/components/KeyboardFocusGroup/KeyboardFocusGroup.android.js.map +1 -1
- package/lib/commonjs/components/KeyboardFocusGroup/KeyboardFocusGroup.ios.js.map +1 -1
- package/lib/commonjs/components/KeyboardFocusGroup/KeyboardFocusGroup.js.map +1 -1
- package/lib/commonjs/components/{KeyboardExtendedInput/KeyboardExtendedInput.types.js → KeyboardFocusGroup/KeyboardFocusGroup.types.js} +1 -1
- package/lib/commonjs/components/KeyboardFocusGroup/KeyboardFocusGroup.types.js.map +1 -0
- package/lib/commonjs/components/KeyboardFocusLock/FocusFrame/FocusFrame.android.js +2 -1
- package/lib/commonjs/components/KeyboardFocusLock/FocusFrame/FocusFrame.android.js.map +1 -1
- package/lib/commonjs/components/KeyboardFocusLock/FocusTrap/FocusTrap.android.js +2 -1
- package/lib/commonjs/components/KeyboardFocusLock/FocusTrap/FocusTrap.android.js.map +1 -1
- package/lib/commonjs/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.js +2 -1
- package/lib/commonjs/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.js.map +1 -1
- package/lib/commonjs/components/KeyboardFocusView/KeyboardFocusView.js +14 -51
- package/lib/commonjs/components/KeyboardFocusView/KeyboardFocusView.js.map +1 -1
- package/lib/commonjs/components/index.js +47 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/index.js +37 -19
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/nativeSpec/ExternalKeyboardLockViewNativeComponent.ts +1 -3
- package/lib/commonjs/nativeSpec/ExternalKeyboardViewNativeComponent.ts +12 -9
- package/lib/commonjs/nativeSpec/KeyboardFocusGroupNativeComponent.ts +5 -3
- package/lib/commonjs/nativeSpec/TextInputFocusWrapperNativeComponent.ts +7 -3
- package/lib/commonjs/types/KeyboardFocusLock.types.js +13 -0
- package/lib/commonjs/types/KeyboardFocusLock.types.js.map +1 -1
- package/lib/commonjs/types/baseKeyboardView.types.js +6 -0
- package/lib/commonjs/types/baseKeyboardView.types.js.map +1 -0
- package/lib/commonjs/types/{FocusStyle.js → focus.types.js} +1 -1
- package/lib/commonjs/types/{FocusStyle.js.map → focus.types.js.map} +1 -1
- package/lib/commonjs/types/focusOrder.types.js +33 -0
- package/lib/commonjs/types/focusOrder.types.js.map +1 -0
- package/lib/commonjs/types/{WithKeyboardFocus.js → focusStyle.types.js} +1 -1
- package/lib/commonjs/types/{WithKeyboardFocus.js.map → focusStyle.types.js.map} +1 -1
- package/lib/commonjs/types/index.js +18 -0
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/commonjs/types/keyPress.types.js +6 -0
- package/lib/{module/types/WithKeyboardFocus.js.map → commonjs/types/keyPress.types.js.map} +1 -1
- package/lib/commonjs/types/keyboardInput.types.js +6 -0
- package/lib/commonjs/types/keyboardInput.types.js.map +1 -0
- package/lib/commonjs/types/withKeyboardFocus.types.js +6 -0
- package/lib/commonjs/types/withKeyboardFocus.types.js.map +1 -0
- package/lib/commonjs/utils/mapLockFocus.js +37 -0
- package/lib/commonjs/utils/mapLockFocus.js.map +1 -0
- package/lib/commonjs/utils/useFocusStyle.js +4 -21
- package/lib/commonjs/utils/useFocusStyle.js.map +1 -1
- package/lib/commonjs/utils/useKeyboardFocusContainer.js +79 -0
- package/lib/commonjs/utils/useKeyboardFocusContainer.js.map +1 -0
- package/lib/commonjs/utils/useKeyboardPress/useKeyboardPress.android.js +4 -7
- package/lib/commonjs/utils/useKeyboardPress/useKeyboardPress.android.js.map +1 -1
- package/lib/commonjs/utils/useKeyboardPress/useKeyboardPress.ios.js +3 -6
- package/lib/commonjs/utils/useKeyboardPress/useKeyboardPress.ios.js.map +1 -1
- package/lib/commonjs/utils/useKeyboardPress/useKeyboardPress.js +9 -7
- package/lib/commonjs/utils/useKeyboardPress/useKeyboardPress.js.map +1 -1
- package/lib/commonjs/utils/useKeyboardPressState.js +65 -0
- package/lib/commonjs/utils/useKeyboardPressState.js.map +1 -0
- package/lib/commonjs/utils/useOnFocusChange.js +1 -1
- package/lib/commonjs/utils/useOnFocusChange.js.map +1 -1
- package/lib/commonjs/utils/useOrderValidation.js +35 -0
- package/lib/commonjs/utils/useOrderValidation.js.map +1 -0
- package/lib/commonjs/utils/useRenderedChildren.js +34 -0
- package/lib/commonjs/utils/useRenderedChildren.js.map +1 -0
- package/lib/commonjs/utils/useWrappedOrderProps.js +35 -0
- package/lib/commonjs/utils/useWrappedOrderProps.js.map +1 -0
- package/lib/commonjs/utils/withKeyboardFocus.js +81 -96
- package/lib/commonjs/utils/withKeyboardFocus.js.map +1 -1
- package/lib/module/components/BaseKeyboardView/BaseKeyboardView.js +57 -55
- package/lib/module/components/BaseKeyboardView/BaseKeyboardView.js.map +1 -1
- package/lib/module/components/KeyboardExtendedInput/KeyboardExtendedInput.js +51 -99
- package/lib/module/components/KeyboardExtendedInput/KeyboardExtendedInput.js.map +1 -1
- package/lib/module/components/KeyboardFocusGroup/KeyboardFocusGroup.android.js.map +1 -1
- package/lib/module/components/KeyboardFocusGroup/KeyboardFocusGroup.ios.js.map +1 -1
- package/lib/module/components/KeyboardFocusGroup/KeyboardFocusGroup.js.map +1 -1
- package/lib/module/components/KeyboardFocusGroup/KeyboardFocusGroup.types.js +4 -0
- package/lib/module/components/KeyboardFocusGroup/KeyboardFocusGroup.types.js.map +1 -0
- package/lib/module/components/KeyboardFocusLock/FocusFrame/FocusFrame.android.js +2 -1
- package/lib/module/components/KeyboardFocusLock/FocusFrame/FocusFrame.android.js.map +1 -1
- package/lib/module/components/KeyboardFocusLock/FocusTrap/FocusTrap.android.js +2 -1
- package/lib/module/components/KeyboardFocusLock/FocusTrap/FocusTrap.android.js.map +1 -1
- package/lib/module/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.js +2 -1
- package/lib/module/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.js.map +1 -1
- package/lib/module/components/KeyboardFocusView/KeyboardFocusView.js +16 -53
- package/lib/module/components/KeyboardFocusView/KeyboardFocusView.js.map +1 -1
- package/lib/module/components/index.js +5 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/index.js +20 -7
- package/lib/module/index.js.map +1 -1
- package/lib/module/nativeSpec/ExternalKeyboardLockViewNativeComponent.ts +1 -3
- package/lib/module/nativeSpec/ExternalKeyboardViewNativeComponent.ts +12 -9
- package/lib/module/nativeSpec/KeyboardFocusGroupNativeComponent.ts +5 -3
- package/lib/module/nativeSpec/TextInputFocusWrapperNativeComponent.ts +7 -3
- package/lib/module/types/KeyboardFocusLock.types.js +12 -1
- package/lib/module/types/KeyboardFocusLock.types.js.map +1 -1
- package/lib/module/types/baseKeyboardView.types.js +4 -0
- package/lib/module/types/baseKeyboardView.types.js.map +1 -0
- package/lib/module/types/focus.types.js +4 -0
- package/lib/module/types/{FocusStyle.js.map → focus.types.js.map} +1 -1
- package/lib/module/types/focusOrder.types.js +31 -0
- package/lib/module/types/focusOrder.types.js.map +1 -0
- package/lib/module/types/focusStyle.types.js +4 -0
- package/lib/module/types/focusStyle.types.js.map +1 -0
- package/lib/module/types/index.js +3 -0
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/types/keyPress.types.js +4 -0
- package/lib/module/types/keyPress.types.js.map +1 -0
- package/lib/module/types/keyboardInput.types.js +4 -0
- package/lib/module/types/keyboardInput.types.js.map +1 -0
- package/lib/module/types/withKeyboardFocus.types.js +4 -0
- package/lib/module/types/withKeyboardFocus.types.js.map +1 -0
- package/lib/module/utils/mapLockFocus.js +32 -0
- package/lib/module/utils/mapLockFocus.js.map +1 -0
- package/lib/module/utils/useFocusStyle.js +4 -21
- package/lib/module/utils/useFocusStyle.js.map +1 -1
- package/lib/module/utils/useKeyboardFocusContainer.js +74 -0
- package/lib/module/utils/useKeyboardFocusContainer.js.map +1 -0
- package/lib/module/utils/useKeyboardPress/useKeyboardPress.android.js +4 -7
- package/lib/module/utils/useKeyboardPress/useKeyboardPress.android.js.map +1 -1
- package/lib/module/utils/useKeyboardPress/useKeyboardPress.ios.js +3 -6
- package/lib/module/utils/useKeyboardPress/useKeyboardPress.ios.js.map +1 -1
- package/lib/module/utils/useKeyboardPress/useKeyboardPress.js +9 -7
- package/lib/module/utils/useKeyboardPress/useKeyboardPress.js.map +1 -1
- package/lib/module/utils/useKeyboardPressState.js +60 -0
- package/lib/module/utils/useKeyboardPressState.js.map +1 -0
- package/lib/module/utils/useOnFocusChange.js +1 -1
- package/lib/module/utils/useOnFocusChange.js.map +1 -1
- package/lib/module/utils/useOrderValidation.js +30 -0
- package/lib/module/utils/useOrderValidation.js.map +1 -0
- package/lib/module/utils/useRenderedChildren.js +29 -0
- package/lib/module/utils/useRenderedChildren.js.map +1 -0
- package/lib/module/utils/useWrappedOrderProps.js +30 -0
- package/lib/module/utils/useWrappedOrderProps.js.map +1 -0
- package/lib/module/utils/withKeyboardFocus.js +84 -99
- package/lib/module/utils/withKeyboardFocus.js.map +1 -1
- package/lib/typescript/src/components/BaseKeyboardView/BaseKeyboardView.d.ts +30 -10
- package/lib/typescript/src/components/BaseKeyboardView/BaseKeyboardView.d.ts.map +1 -1
- package/lib/typescript/src/components/KeyboardExtendedInput/KeyboardExtendedInput.d.ts +187 -12
- package/lib/typescript/src/components/KeyboardExtendedInput/KeyboardExtendedInput.d.ts.map +1 -1
- package/lib/typescript/src/components/KeyboardFocusGroup/KeyboardFocusGroup.android.d.ts +4 -146
- package/lib/typescript/src/components/KeyboardFocusGroup/KeyboardFocusGroup.android.d.ts.map +1 -1
- package/lib/typescript/src/components/KeyboardFocusGroup/KeyboardFocusGroup.d.ts +2 -12
- package/lib/typescript/src/components/KeyboardFocusGroup/KeyboardFocusGroup.d.ts.map +1 -1
- package/lib/typescript/src/components/KeyboardFocusGroup/KeyboardFocusGroup.ios.d.ts +4 -146
- package/lib/typescript/src/components/KeyboardFocusGroup/KeyboardFocusGroup.ios.d.ts.map +1 -1
- package/lib/typescript/src/components/KeyboardFocusGroup/KeyboardFocusGroup.types.d.ts +13 -0
- package/lib/typescript/src/components/KeyboardFocusGroup/KeyboardFocusGroup.types.d.ts.map +1 -0
- package/lib/typescript/src/components/KeyboardFocusLock/FocusFrame/FocusFrame.android.d.ts +1 -1
- package/lib/typescript/src/components/KeyboardFocusLock/FocusFrame/FocusFrame.android.d.ts.map +1 -1
- package/lib/typescript/src/components/KeyboardFocusLock/FocusTrap/FocusTrap.android.d.ts +1 -1
- package/lib/typescript/src/components/KeyboardFocusLock/FocusTrap/FocusTrap.android.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 +1 -1
- package/lib/typescript/src/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.d.ts.map +1 -1
- package/lib/typescript/src/components/KeyboardFocusView/KeyboardFocusView.d.ts +28 -18
- package/lib/typescript/src/components/KeyboardFocusView/KeyboardFocusView.d.ts.map +1 -1
- package/lib/typescript/src/components/Touchable/Pressable.d.ts +14 -14
- package/lib/typescript/src/components/Touchable/Pressable.d.ts.map +1 -1
- package/lib/typescript/src/components/index.d.ts +5 -0
- package/lib/typescript/src/components/index.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +694 -9
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/nativeSpec/ExternalKeyboardLockViewNativeComponent.d.ts +2 -4
- package/lib/typescript/src/nativeSpec/ExternalKeyboardLockViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/nativeSpec/ExternalKeyboardViewNativeComponent.d.ts +6 -7
- package/lib/typescript/src/nativeSpec/ExternalKeyboardViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/nativeSpec/KeyboardFocusGroupNativeComponent.d.ts +2 -4
- package/lib/typescript/src/nativeSpec/KeyboardFocusGroupNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/nativeSpec/TextInputFocusWrapperNativeComponent.d.ts +4 -4
- package/lib/typescript/src/nativeSpec/TextInputFocusWrapperNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/types/KeyboardFocusLock.types.d.ts +15 -1
- package/lib/typescript/src/types/KeyboardFocusLock.types.d.ts.map +1 -1
- package/lib/typescript/src/types/KeyboardFocusView.types.d.ts +16 -14
- package/lib/typescript/src/types/KeyboardFocusView.types.d.ts.map +1 -1
- package/lib/typescript/src/types/baseKeyboardView.types.d.ts +119 -0
- package/lib/typescript/src/types/baseKeyboardView.types.d.ts.map +1 -0
- package/lib/typescript/src/types/focus.types.d.ts +35 -0
- package/lib/typescript/src/types/focus.types.d.ts.map +1 -0
- package/lib/typescript/src/types/focusOrder.types.d.ts +57 -0
- package/lib/typescript/src/types/focusOrder.types.d.ts.map +1 -0
- package/lib/typescript/src/types/focusStyle.types.d.ts +11 -0
- package/lib/typescript/src/types/focusStyle.types.d.ts.map +1 -0
- package/lib/typescript/src/types/index.d.ts +11 -2
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/lib/typescript/src/types/keyPress.types.d.ts +7 -0
- package/lib/typescript/src/types/keyPress.types.d.ts.map +1 -0
- package/lib/typescript/src/types/keyboardInput.types.d.ts +53 -0
- package/lib/typescript/src/types/keyboardInput.types.d.ts.map +1 -0
- package/lib/typescript/src/types/withKeyboardFocus.types.d.ts +109 -0
- package/lib/typescript/src/types/withKeyboardFocus.types.d.ts.map +1 -0
- package/lib/typescript/src/utils/mapLockFocus.d.ts +3 -0
- package/lib/typescript/src/utils/mapLockFocus.d.ts.map +1 -0
- package/lib/typescript/src/utils/useFocusStyle.d.ts +26 -34
- package/lib/typescript/src/utils/useFocusStyle.d.ts.map +1 -1
- package/lib/typescript/src/utils/useKeyboardFocusContainer.d.ts +898 -0
- package/lib/typescript/src/utils/useKeyboardFocusContainer.d.ts.map +1 -0
- package/lib/typescript/src/utils/useKeyboardPress/useKeyboardPress.android.d.ts +2 -2
- package/lib/typescript/src/utils/useKeyboardPress/useKeyboardPress.android.d.ts.map +1 -1
- package/lib/typescript/src/utils/useKeyboardPress/useKeyboardPress.d.ts +4 -3
- package/lib/typescript/src/utils/useKeyboardPress/useKeyboardPress.d.ts.map +1 -1
- package/lib/typescript/src/utils/useKeyboardPress/useKeyboardPress.ios.d.ts +3 -3
- package/lib/typescript/src/utils/useKeyboardPress/useKeyboardPress.ios.d.ts.map +1 -1
- package/lib/typescript/src/utils/useKeyboardPress/useKeyboardPress.types.d.ts +1 -2
- package/lib/typescript/src/utils/useKeyboardPress/useKeyboardPress.types.d.ts.map +1 -1
- package/lib/typescript/src/utils/useKeyboardPressState.d.ts +29 -0
- package/lib/typescript/src/utils/useKeyboardPressState.d.ts.map +1 -0
- package/lib/typescript/src/utils/useOnFocusChange.d.ts +3 -3
- package/lib/typescript/src/utils/useOnFocusChange.d.ts.map +1 -1
- package/lib/typescript/src/utils/useOrderValidation.d.ts +8 -0
- package/lib/typescript/src/utils/useOrderValidation.d.ts.map +1 -0
- package/lib/typescript/src/utils/useRenderedChildren.d.ts +18 -0
- package/lib/typescript/src/utils/useRenderedChildren.d.ts.map +1 -0
- package/lib/typescript/src/utils/useWrappedOrderProps.d.ts +13 -0
- package/lib/typescript/src/utils/useWrappedOrderProps.d.ts.map +1 -0
- package/lib/typescript/src/utils/withKeyboardFocus.d.ts +3 -4
- package/lib/typescript/src/utils/withKeyboardFocus.d.ts.map +1 -1
- package/package.json +4 -2
- package/src/components/BaseKeyboardView/BaseKeyboardView.tsx +74 -94
- package/src/components/KeyboardExtendedInput/KeyboardExtendedInput.tsx +49 -149
- package/src/components/KeyboardFocusGroup/KeyboardFocusGroup.android.tsx +23 -32
- package/src/components/KeyboardFocusGroup/KeyboardFocusGroup.ios.tsx +32 -41
- package/src/components/KeyboardFocusGroup/KeyboardFocusGroup.tsx +3 -14
- package/src/components/KeyboardFocusGroup/KeyboardFocusGroup.types.ts +15 -0
- package/src/components/KeyboardFocusLock/FocusFrame/FocusFrame.android.tsx +2 -2
- package/src/components/KeyboardFocusLock/FocusTrap/FocusTrap.android.tsx +2 -2
- package/src/components/KeyboardFocusLock/FocusTrap/FocusTrap.tsx +1 -1
- package/src/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.tsx +2 -2
- package/src/components/KeyboardFocusView/KeyboardFocusView.tsx +29 -68
- package/src/components/Touchable/Pressable.tsx +2 -2
- package/src/components/index.ts +12 -0
- package/src/index.tsx +44 -32
- package/src/nativeSpec/ExternalKeyboardLockViewNativeComponent.ts +1 -3
- package/src/nativeSpec/ExternalKeyboardViewNativeComponent.ts +12 -9
- package/src/nativeSpec/KeyboardFocusGroupNativeComponent.ts +5 -3
- package/src/nativeSpec/TextInputFocusWrapperNativeComponent.ts +7 -3
- package/src/types/KeyboardFocusLock.types.ts +16 -1
- package/src/types/KeyboardFocusView.types.ts +17 -18
- package/src/types/baseKeyboardView.types.ts +122 -0
- package/src/types/focus.types.ts +40 -0
- package/src/types/focusOrder.types.ts +59 -0
- package/src/types/{FocusStyle.ts → focusStyle.types.ts} +5 -0
- package/src/types/index.ts +32 -2
- package/src/types/keyPress.types.ts +8 -0
- package/src/types/keyboardInput.types.ts +81 -0
- package/src/types/withKeyboardFocus.types.ts +178 -0
- package/src/utils/mapLockFocus.ts +31 -0
- package/src/utils/useFocusStyle.tsx +13 -41
- package/src/utils/useKeyboardFocusContainer.ts +102 -0
- package/src/utils/useKeyboardPress/useKeyboardPress.android.ts +4 -7
- package/src/utils/useKeyboardPress/useKeyboardPress.ios.ts +3 -6
- package/src/utils/useKeyboardPress/useKeyboardPress.ts +9 -7
- package/src/utils/useKeyboardPress/useKeyboardPress.types.ts +1 -2
- package/src/utils/useKeyboardPressState.ts +81 -0
- package/src/utils/useOnFocusChange.ts +4 -7
- package/src/utils/useOrderValidation.ts +74 -0
- package/src/utils/useRenderedChildren.ts +42 -0
- package/src/utils/useWrappedOrderProps.ts +48 -0
- package/src/utils/withKeyboardFocus.tsx +105 -125
- package/lib/commonjs/components/KeyboardExtendedInput/KeyboardExtendedInput.types.js.map +0 -1
- package/lib/commonjs/components/KeyboardFocusView/hooks/index.js +0 -13
- package/lib/commonjs/components/KeyboardFocusView/hooks/index.js.map +0 -1
- package/lib/commonjs/components/KeyboardFocusView/hooks/useFocusStyle/index.js +0 -13
- package/lib/commonjs/components/KeyboardFocusView/hooks/useFocusStyle/index.js.map +0 -1
- package/lib/commonjs/components/KeyboardFocusView/hooks/useFocusStyle/useFocusStyle.js +0 -33
- package/lib/commonjs/components/KeyboardFocusView/hooks/useFocusStyle/useFocusStyle.js.map +0 -1
- package/lib/commonjs/components/KeyboardFocusView/hooks/useFocusStyle/useTintStyle.js +0 -39
- package/lib/commonjs/components/KeyboardFocusView/hooks/useFocusStyle/useTintStyle.js.map +0 -1
- package/lib/commonjs/components/RenderPropComponent/RenderPropComponent.js +0 -23
- package/lib/commonjs/components/RenderPropComponent/RenderPropComponent.js.map +0 -1
- package/lib/commonjs/types/BaseKeyboardView.js +0 -18
- package/lib/commonjs/types/BaseKeyboardView.js.map +0 -1
- package/lib/module/components/KeyboardExtendedInput/KeyboardExtendedInput.types.js +0 -4
- package/lib/module/components/KeyboardExtendedInput/KeyboardExtendedInput.types.js.map +0 -1
- package/lib/module/components/KeyboardFocusView/hooks/index.js +0 -4
- package/lib/module/components/KeyboardFocusView/hooks/index.js.map +0 -1
- package/lib/module/components/KeyboardFocusView/hooks/useFocusStyle/index.js +0 -4
- package/lib/module/components/KeyboardFocusView/hooks/useFocusStyle/index.js.map +0 -1
- package/lib/module/components/KeyboardFocusView/hooks/useFocusStyle/useFocusStyle.js +0 -28
- package/lib/module/components/KeyboardFocusView/hooks/useFocusStyle/useFocusStyle.js.map +0 -1
- package/lib/module/components/KeyboardFocusView/hooks/useFocusStyle/useTintStyle.js +0 -34
- package/lib/module/components/KeyboardFocusView/hooks/useFocusStyle/useTintStyle.js.map +0 -1
- package/lib/module/components/RenderPropComponent/RenderPropComponent.js +0 -17
- package/lib/module/components/RenderPropComponent/RenderPropComponent.js.map +0 -1
- package/lib/module/types/BaseKeyboardView.js +0 -14
- package/lib/module/types/BaseKeyboardView.js.map +0 -1
- package/lib/module/types/FocusStyle.js +0 -4
- package/lib/module/types/WithKeyboardFocus.js +0 -4
- package/lib/typescript/src/components/KeyboardExtendedInput/KeyboardExtendedInput.types.d.ts +0 -45
- package/lib/typescript/src/components/KeyboardExtendedInput/KeyboardExtendedInput.types.d.ts.map +0 -1
- package/lib/typescript/src/components/KeyboardFocusView/hooks/index.d.ts +0 -2
- package/lib/typescript/src/components/KeyboardFocusView/hooks/index.d.ts.map +0 -1
- package/lib/typescript/src/components/KeyboardFocusView/hooks/useFocusStyle/index.d.ts +0 -2
- package/lib/typescript/src/components/KeyboardFocusView/hooks/useFocusStyle/index.d.ts.map +0 -1
- package/lib/typescript/src/components/KeyboardFocusView/hooks/useFocusStyle/useFocusStyle.d.ts +0 -175
- package/lib/typescript/src/components/KeyboardFocusView/hooks/useFocusStyle/useFocusStyle.d.ts.map +0 -1
- package/lib/typescript/src/components/KeyboardFocusView/hooks/useFocusStyle/useTintStyle.d.ts +0 -181
- package/lib/typescript/src/components/KeyboardFocusView/hooks/useFocusStyle/useTintStyle.d.ts.map +0 -1
- package/lib/typescript/src/components/RenderPropComponent/RenderPropComponent.d.ts +0 -6
- package/lib/typescript/src/components/RenderPropComponent/RenderPropComponent.d.ts.map +0 -1
- package/lib/typescript/src/types/BaseKeyboardView.d.ts +0 -70
- package/lib/typescript/src/types/BaseKeyboardView.d.ts.map +0 -1
- package/lib/typescript/src/types/FocusStyle.d.ts +0 -6
- package/lib/typescript/src/types/FocusStyle.d.ts.map +0 -1
- package/lib/typescript/src/types/WithKeyboardFocus.d.ts +0 -47
- package/lib/typescript/src/types/WithKeyboardFocus.d.ts.map +0 -1
- package/src/components/KeyboardExtendedInput/KeyboardExtendedInput.types.ts +0 -73
- package/src/components/KeyboardFocusView/hooks/index.ts +0 -1
- package/src/components/KeyboardFocusView/hooks/useFocusStyle/index.ts +0 -1
- package/src/components/KeyboardFocusView/hooks/useFocusStyle/useFocusStyle.ts +0 -34
- package/src/components/KeyboardFocusView/hooks/useFocusStyle/useTintStyle.ts +0 -41
- package/src/components/RenderPropComponent/RenderPropComponent.tsx +0 -18
- package/src/types/BaseKeyboardView.ts +0 -74
- package/src/types/WithKeyboardFocus.ts +0 -115
package/README.md
CHANGED
|
@@ -1,656 +1,151 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
|
|
1
4
|
# React Native External Keyboard
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
<div>
|
|
7
|
+
<img align="right" width="35%" src="/.github/images/react-native-external-keyboard.gif" alt="Demo of navigating a React Native app with a physical keyboard — focus moving between buttons and inputs">
|
|
8
|
+
</div>
|
|
4
9
|
|
|
5
|
-
-
|
|
6
|
-
- ⚡️ Bridgeless
|
|
10
|
+
Native-first React Native toolkit for physical (external) keyboard support on iOS and Android — focus management, key-press events, custom focus order, and focus locking.
|
|
7
11
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
- 🎯 **Keyboard focus management** — focus/blur events, `autoFocus`, imperative focus via `ref`
|
|
13
|
+
- ⌨️ **Key press events** — handle key-down / key-up with full modifier info
|
|
14
|
+
- 🔢 **Custom focus order** — link-based, index-based, or direction locking
|
|
15
|
+
- 🔒 **Focus lock** — keep focus inside modals and overlays (`Focus.Frame` / `Focus.Trap`)
|
|
16
|
+
- 🎨 **Native focus styling** — iOS halo effect & `tintColor`, Android `defaultFocusHighlightEnabled`
|
|
17
|
+
- ⚡ New Architecture · Old Architecture · Bridgeless · Expo prebuild
|
|
11
18
|
|
|
12
|
-
|
|
19
|
+
> [!TIP]
|
|
20
|
+
> The quickest start is the `K` namespace — `K.Pressable`, `K.View`, and `K.Input` are drop-in, keyboard-focusable versions of `Pressable`, `View`, and `TextInput`. To add focus to a component you already have (a custom button, `TouchableOpacity`, …), reach for the [`withKeyboardFocus`](./docs/components/overview.md#withkeyboardfocus) HOC. See the [getting started guide](./docs/getting-started/getting-started.md).
|
|
21
|
+
|
|
22
|
+
> [!NOTE]
|
|
23
|
+
> On iOS, long-pressing the spacebar does not fire a long press — iOS routes it through *Full Keyboard Access*. Use `Tab + M` (the default "open context menu" command) instead.
|
|
13
24
|
|
|
14
|
-
|
|
15
|
-
- Key press event handling.
|
|
16
|
-
- Focus management for `TextInput` and `Pressable` components.
|
|
17
|
-
- Customization of the `Halo Effect` and `tintColor` for iOS.
|
|
18
|
-
- `defaultFocusHighlightEnabled` support for Android.
|
|
19
|
-
- Keyboard focus order.
|
|
20
|
-
- Focus Lock.
|
|
25
|
+
</br>
|
|
21
26
|
|
|
22
27
|
## Installation
|
|
23
28
|
|
|
24
29
|
```sh
|
|
25
30
|
npm install react-native-external-keyboard
|
|
31
|
+
cd ios && pod install
|
|
26
32
|
```
|
|
27
33
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
```sh
|
|
31
|
-
cd ios && pod install && cd ..
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
+
Get started with the [getting started guide](./docs/getting-started/getting-started.md) or jump straight to the [component overview](./docs/components/overview.md).
|
|
34
35
|
|
|
35
|
-
##
|
|
36
|
+
## Quick start
|
|
36
37
|
|
|
37
|
-
|
|
38
|
+
Use the `K` namespace — `K.Pressable`, `K.View`, and `K.Input` are ready-made, keyboard-focusable replacements for `Pressable`, `View`, and `TextInput`:
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
```tsx
|
|
41
|
+
import { K } from 'react-native-external-keyboard';
|
|
42
|
+
import { Text } from 'react-native';
|
|
40
43
|
|
|
41
|
-
|
|
42
|
-
const KeyboardPressable = withKeyboardFocus(Pressable);
|
|
43
|
-
const KeyboardTouchable = withKeyboardFocus(TouchableOpacity);
|
|
44
|
-
const KeyboardButton = withKeyboardFocus(Button);
|
|
45
|
-
|
|
46
|
-
...
|
|
47
|
-
|
|
48
|
-
<TouchableOpacity
|
|
49
|
-
ref={ref}
|
|
50
|
-
onPress={...}
|
|
51
|
-
onLongPress={...}
|
|
52
|
-
onFocus={...}
|
|
53
|
-
onBlur={...}
|
|
54
|
-
style={styles.pressable}
|
|
55
|
-
containerStyle={styles.pressableContainer}
|
|
44
|
+
<K.Pressable
|
|
56
45
|
autoFocus
|
|
46
|
+
onPress={onPress}
|
|
47
|
+
focusStyle={{ backgroundColor: 'dodgerblue' }}
|
|
57
48
|
>
|
|
58
|
-
<Text>
|
|
59
|
-
</
|
|
49
|
+
<Text>Press me with Space or Enter</Text>
|
|
50
|
+
</K.Pressable>
|
|
60
51
|
```
|
|
61
52
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
Props | Description | Type
|
|
66
|
-
-- | -- | --
|
|
67
|
-
onPress?: | Default `onPress` or keyboard-handled `onPress` | `((event: GestureResponderEvent) => void) \| null \| undefined`
|
|
68
|
-
onLongPress?: | Default `onLongPress` or keyboard-handled `onLongPress` (`Tab+M` for iOS). | `((event: GestureResponderEvent) => void) \| null \| undefined`
|
|
69
|
-
onPressIn:? | Default `onPressIn` or keyboard-handled `onPressIn` | `((event: GestureResponderEvent) => void) \| null \| undefined`
|
|
70
|
-
onPressOut:? | Default `onPressOut` or keyboard-handled `onPressOut` | `((event: GestureResponderEvent) => void) \| null \| undefined`
|
|
71
|
-
style?: | Styles the inner component | `StyleProp<ViewStyle>; for Pressable: PressableProps['style']`
|
|
72
|
-
withPressedStyle?: | Enables the pressed style handler for custom components; always true for the standard Pressable. | `boolean \| undefined`, false by default
|
|
73
|
-
focusStyle?: | Style applied to the inner component when focused | `FocusStyle`
|
|
74
|
-
containerStyle?: | Style for the container | StyleProp<ViewStyle>;
|
|
75
|
-
containerFocusStyle?: | Style applied to the container when focused | `FocusStyle`
|
|
76
|
-
onFocus?: | Handler called when the component is focused | `() => void`
|
|
77
|
-
onBlur?: | Handler called when the component loses focus | `() => void`
|
|
78
|
-
onFocusChange?: | Handler called when the component is focused or blurred | `(isFocused: boolean, tag?: number) => void`
|
|
79
|
-
onKeyUpPress?: | Handler for the key-up event | `(e: OnKeyPress) => void`
|
|
80
|
-
onKeyDownPress?: | Handler for the key-down event | `(e: OnKeyPress) => void`
|
|
81
|
-
autoFocus?: | Indicates if the component should automatically gain focus | `boolean | undefined`
|
|
82
|
-
focusable?: | Indicates if the component can be focused by keyboard | `boolean | undefined`
|
|
83
|
-
tintColor?: | Color used for tinting the component | `string`
|
|
84
|
-
tintType?: | Tint behavior type | `'default' \| 'hover' \| 'background' \| 'none'`
|
|
85
|
-
FocusHoverComponent?: | Component displayed on focus | `\| ReactElement \| FunctionComponent \| (() => ReactElement);`
|
|
86
|
-
renderContent?: | Render prop for components whose `children` is itself a render function (e.g. `Pressable`). Receives the component's own render state merged with `{ focused: boolean }`, so you can style content based on both the component state (e.g. `pressed`) and keyboard focus simultaneously. Only available when the wrapped component exposes a render-prop `children`. | `(state: ComponentRenderState & { focused: boolean }) => ReactNode`
|
|
87
|
-
renderFocusable?: | Render prop available on any `withKeyboardFocus`-wrapped component. Replaces `children` and receives `{ focused: boolean }`, allowing you to render different content based on keyboard focus state. Use this when the wrapped component does not expose a render-prop `children`. | `(state: { focused: boolean }) => ReactNode`
|
|
88
|
-
group?: | Indicates if the component is a focusable group | `boolean`
|
|
89
|
-
haloEffect?: | Enables halo effect on focus (iOS only) | `boolean`
|
|
90
|
-
defaultFocusHighlightEnabled?: | **Android only.** Enables Android's default focus highlight for the focused native view. | `boolean \| undefined`, default: `true`
|
|
91
|
-
haloCornerRadius?: | Corner radius of the halo ring (iOS only) | `number`
|
|
92
|
-
haloExpendX?: | Horizontal expansion of the halo ring in points (iOS only) | `number`
|
|
93
|
-
haloExpendY?: | Vertical expansion of the halo ring in points (iOS only) | `number`
|
|
94
|
-
ref?: | Provides a reference to the component, allowing programmatic focus control | `{ focus: () => void}`
|
|
95
|
-
viewRef?: | Provides a reference to the underlying view component | `RefObject<View>`
|
|
96
|
-
onBubbledContextMenuPress | Handler for bubbled long-press events triggered by the context menu command (iOS only) | () => void;
|
|
97
|
-
triggerCodes?: | `onPress` and `onLongPress` trigger codes | `number[] \| undefined`, spacebar and enter by default
|
|
98
|
-
enableA11yFocus?: | Can be used to move the screen reader focus within the keyboard using `ref.current.focus`. | `boolean \| undefined`
|
|
99
|
-
screenAutoA11yFocus?: | Enables screen reader auto-focus functionality. | `boolean \| undefined`
|
|
100
|
-
`screenAutoA11yFocusDelay?:` | **Android only:** Delay for screen reader autofocus. On Android, focus can only be applied after the component has rendered, which may take 300–500 milliseconds. | `number \| undefined`, default: 300
|
|
101
|
-
`exposeMethods?:` | List of exposed view methods | `string[] \| undefined`, by default the following methods are exposed: `'blur', 'measure', 'measureInWindow', 'measureLayout', and 'setNativeProps'`.
|
|
102
|
-
orderId? | A unique ID used for link target identification. | `string`
|
|
103
|
-
orderBackward? | ID of the target for backward navigation with "Tab + Shift". | `string`
|
|
104
|
-
orderForward? | ID of the target for forward navigation with "Tab". | `string`
|
|
105
|
-
orderLeft? | ID of the target for navigation to the left. | `string`
|
|
106
|
-
orderRight? | ID of the target for navigation to the right. | `string`
|
|
107
|
-
orderUp? | ID of the target for navigation upward. | `string`
|
|
108
|
-
orderDown? | ID of the target for navigation downward. | `string`
|
|
109
|
-
orderGroup? | The name of the group for index-based focus ordering. | `string`
|
|
110
|
-
orderIndex? | The order index of the element within its group. | `number`
|
|
111
|
-
lockFocus? | An array of directions to lock focus. | Array of 'left' \| 'right' \| 'up' \| 'down' \| 'forward' \| 'backward' \| 'first' \| 'last'
|
|
112
|
-
...rest | Remaining component props | `Type of Component`
|
|
113
|
-
|
|
114
|
-
#### renderContent — Pressable with pressed + focused state
|
|
115
|
-
|
|
116
|
-
`Pressable` passes a `{ pressed }` state to its `children` render prop. Use `renderContent` to access both `pressed` and the keyboard `focused` state at the same time:
|
|
53
|
+
Need focus on a component the `K` namespace doesn't cover — `TouchableOpacity`, a custom button, a third-party component? Wrap it with the [`withKeyboardFocus`](./docs/components/overview.md#withkeyboardfocus) HOC:
|
|
117
54
|
|
|
118
55
|
```tsx
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
<KeyboardPressable
|
|
122
|
-
onPress={onPress}
|
|
123
|
-
renderContent={({ pressed, focused }) => (
|
|
124
|
-
<View style={[
|
|
125
|
-
styles.button,
|
|
126
|
-
pressed && styles.pressed,
|
|
127
|
-
focused && styles.focused,
|
|
128
|
-
]}>
|
|
129
|
-
<Text>{pressed ? 'Pressed' : focused ? 'Focused' : 'Default'}</Text>
|
|
130
|
-
</View>
|
|
131
|
-
)}
|
|
132
|
-
/>
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
#### renderFocusable — TouchableOpacity and other components
|
|
136
|
-
|
|
137
|
-
`TouchableOpacity` and similar components do not expose a render-prop `children`, so `renderContent` is not available. Use `renderFocusable` instead — it receives only `{ focused }`:
|
|
56
|
+
import { withKeyboardFocus } from 'react-native-external-keyboard';
|
|
57
|
+
import { TouchableOpacity } from 'react-native';
|
|
138
58
|
|
|
139
|
-
```tsx
|
|
140
59
|
const KeyboardTouchable = withKeyboardFocus(TouchableOpacity);
|
|
141
|
-
|
|
142
|
-
<KeyboardTouchable
|
|
143
|
-
onPress={onPress}
|
|
144
|
-
renderFocusable={({ focused }) => (
|
|
145
|
-
<View style={[styles.button, focused && styles.focused]}>
|
|
146
|
-
<Text>{focused ? 'Focused' : 'Default'}</Text>
|
|
147
|
-
</View>
|
|
148
|
-
)}
|
|
149
|
-
/>
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
> [!NOTE]
|
|
153
|
-
> You may discover that `long press on spacebar` does not trigger a long press event on `iOS`. This is because `iOS` uses the `Full Keyboard Access` system that provides commands for interacting with the system. Rather than holding down the spacebar, you can use `Tab+M` (the default action for opening the context menu).
|
|
154
|
-
> You can change `Commands` in: `Full Keyboard Access` -> `Commands`
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
### KeyboardExtendedView
|
|
158
|
-
`KeyboardExtendedView` is similar to `withKeyboardFocus`; it is also based on `KeyboardExtendedBaseView` and provides keyboard focus functionality. It can be useful for handling key presses or managing the focus of a group of components.
|
|
159
|
-
|
|
160
|
-
```
|
|
161
|
-
<KeyboardExtendedView>
|
|
162
|
-
<Text>Parent component</Text>
|
|
163
|
-
<KeyboardExtendedView>
|
|
164
|
-
<Text>Child component 1</Text>
|
|
165
|
-
</KeyboardExtendedView>
|
|
166
|
-
<KeyboardExtendedView>
|
|
167
|
-
<Text>Child component 2</Text>
|
|
168
|
-
</KeyboardExtendedView>
|
|
169
|
-
</KeyboardExtendedView>
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
Props | Description | Type
|
|
173
|
-
-- | -- | --
|
|
174
|
-
onPress?: | Default `onPress` or keyboard-handled `onPress` | `((event: GestureResponderEvent) => void) \| null \| undefined`
|
|
175
|
-
onLongPress?: | Default `onLongPress` or keyboard-handled `onLongPress` (`Tab+M` for iOS). | `((event: GestureResponderEvent) => void) \| null \| undefined`
|
|
176
|
-
onPressIn:? | Default `onPressIn` or keyboard-handled `onPressIn` | `((event: GestureResponderEvent) => void) \| null \| undefined`
|
|
177
|
-
onPressOut:? | Default `onPressOut` or keyboard-handled `onPressOut` | `((event: GestureResponderEvent) => void) \| null \| undefined`
|
|
178
|
-
style?: | Style for the inner component | `StyleProp<ViewStyle>`
|
|
179
|
-
focusStyle?: | Style applied to the inner component when focused | `FocusStyle`
|
|
180
|
-
containerStyle?: | Style for the container | StyleProp<ViewStyle>;
|
|
181
|
-
containerFocusStyle?: | Style applied to the container when focused | `FocusStyle`
|
|
182
|
-
onFocus?: | Handler called when the component is focused | `() => void`
|
|
183
|
-
onBlur?: | Handler called when the component loses focus | `() => void`
|
|
184
|
-
onFocusChange?: | Handler called when the component is focused or blurred | `(isFocused: boolean, tag?: number) => void`
|
|
185
|
-
onKeyUpPress?: | Handler for the key-up event | `(e: OnKeyPress) => void`
|
|
186
|
-
onKeyDownPress?: | Handler for the key-down event | `(e: OnKeyPress) => void`
|
|
187
|
-
onBubbledContextMenuPress | Handler for bubbled long-press events triggered by the context menu command (iOS only) | () => void;
|
|
188
|
-
autoFocus?: | Indicates if the component should automatically gain focus | `boolean | undefined`
|
|
189
|
-
focusable?: | Indicates if the component can be focused by keyboard | `boolean | undefined`
|
|
190
|
-
tintColor?: | Color used for tinting the component | `string`
|
|
191
|
-
tintType?: | Tint behavior type | `'default' \| 'hover' \| 'background' \| 'none'`
|
|
192
|
-
FocusHoverComponent?: | Component displayed on focus | `\| ReactElement \| FunctionComponent \| (() => ReactElement);`
|
|
193
|
-
group?: | Indicates if the component is a focusable group | `boolean`
|
|
194
|
-
haloEffect?: | Enables halo effect on focus (iOS only) | `boolean`
|
|
195
|
-
defaultFocusHighlightEnabled?: | **Android only.** Enables Android's default focus highlight for the focused native view. | `boolean \| undefined`, default: `true`
|
|
196
|
-
haloCornerRadius?: | Corner radius of the halo ring (iOS only) | `number`
|
|
197
|
-
haloExpendX?: | Horizontal expansion of the halo ring in points (iOS only) | `number`
|
|
198
|
-
haloExpendY?: | Vertical expansion of the halo ring in points (iOS only) | `number`
|
|
199
|
-
triggerCodes?: | `onPress` and `onLongPress` trigger codes | `number[] \| undefined`, spacebar and enter by default
|
|
200
|
-
enableA11yFocus?: | Can be used to move the screen reader focus within the keyboard using `ref.current.focus`. | `boolean \| undefined`
|
|
201
|
-
screenAutoA11yFocus?: | Enables screen reader auto-focus functionality. | `boolean \| undefined`
|
|
202
|
-
`screenAutoA11yFocusDelay?:` | **Android only:** Delay for screen reader autofocus. On Android, focus can only be applied after the component has rendered, which may take 300–500 milliseconds. | `number \| undefined`, default: 300
|
|
203
|
-
`exposeMethods?:` | List of exposed view methods | `string[] \| undefined`, by default the following methods are exposed: `'blur', 'measure', 'measureInWindow', 'measureLayout', and 'setNativeProps'`.
|
|
204
|
-
orderId? | A unique ID used for link target identification. | `string`
|
|
205
|
-
orderBackward? | ID of the target for backward navigation with "Tab + Shift". | `string`
|
|
206
|
-
orderForward? | ID of the target for forward navigation with "Tab". | `string`
|
|
207
|
-
orderLeft? | ID of the target for navigation to the left. | `string`
|
|
208
|
-
orderRight? | ID of the target for navigation to the right. | `string`
|
|
209
|
-
orderUp? | ID of the target for navigation upward. | `string`
|
|
210
|
-
orderDown? | ID of the target for navigation downward. | `string`
|
|
211
|
-
orderGroup? | The name of the group for index-based focus ordering. | `string`
|
|
212
|
-
orderIndex? | The order index of the element within its group. | `number`
|
|
213
|
-
lockFocus? | An array of directions to lock focus. | Array of 'left' \| 'right' \| 'up' \| 'down' \| 'forward' \| 'backward' \| 'first' \| 'last'
|
|
214
|
-
...rest | Remaining View props | `View`
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
### KeyboardExtendedInput
|
|
218
|
-
|
|
219
|
-
The `TextInput` component with keyboard focus support. This component allows the TextInput to be focused using the keyboard in various scenarios.
|
|
220
|
-
|
|
221
|
-
```js
|
|
222
|
-
import { KeyboardExtendedInput } from 'react-native-external-keyboard';
|
|
223
|
-
...
|
|
224
|
-
<KeyboardExtendedInput
|
|
225
|
-
focusType="default"
|
|
226
|
-
blurType="default"
|
|
227
|
-
value={textInput}
|
|
228
|
-
onChangeText={setTextInput}
|
|
229
|
-
/>
|
|
230
60
|
```
|
|
231
61
|
|
|
232
|
-
|
|
233
|
-
-- | -- | --
|
|
234
|
-
focusable?: | Boolean property whether component can be focused by keyboard | `boolean \\| undefined` default `true`
|
|
235
|
-
onFocusChange?: | Callback for focus change handling | `(isFocused: boolean) => void \\| undefined`
|
|
236
|
-
focusType?: | Focus type can be `default`, `auto`, or `press`. Based on investigation, Android and iOS typically have different default behaviors. On Android, the `TextInput` is focused by default, while on iOS, you need to press to focus. `auto` is used for automatic focusing, while keyboard focus targets the input. With `press`, you need to press the spacebar to focus an input. | `"default" \\| "press" \\| "auto"`
|
|
237
|
-
blurType?: | Only for iOS. This defines the behavior for blurring input when focus moves away from the component. By default, iOS allows typing when the keyboard focus is on another component. You can use disable to blur input when focus moves away. (Further investigation is needed for Android.) | `"default"\\| "disable" \\| "auto"`
|
|
238
|
-
haloEffect?: | Enables halo effect on focus (iOS only) | `boolean`
|
|
239
|
-
defaultFocusHighlightEnabled?: | **Android only.** Enables Android's default focus highlight for the focused native view. | `boolean \| undefined`, default: `true`
|
|
240
|
-
tintColor?: | Color used for tinting the component | `string`
|
|
241
|
-
style?: | Style for the inner TextInput | `StyleProp<ViewStyle>`
|
|
242
|
-
focusStyle? | Style applied to the inner TextInput when focused | `FocusStyle`
|
|
243
|
-
containerStyle | Style for the container | StyleProp<ViewStyle>
|
|
244
|
-
containerFocusStyle?: | Style applied to the container when focused | `FocusStyle`
|
|
245
|
-
tintType?: | Tint behavior type | `'default' \\| 'hover' \\| 'background' \\| 'none'`
|
|
246
|
-
FocusHoverComponent?: | Component displayed on focus | `\\| ReactElement \\| FunctionComponent \\| (() => ReactElement);`
|
|
247
|
-
onSubmitEditing?: | Extended `onSubmitEditing` for multiline input | `(e: NativeSyntheticEvent<TextInputSubmitEditingEventData>) => void)`
|
|
248
|
-
...rest | Remaining TextInput props | `TextInputProps`
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
### KeyboardExtendedBaseView: (alias for: ExternalKeyboardView)
|
|
252
|
-
|
|
253
|
-
```js
|
|
254
|
-
import { KeyboardExtendedBaseView } from 'react-native-external-keyboard';
|
|
255
|
-
...
|
|
256
|
-
<KeyboardExtendedBaseView
|
|
257
|
-
onKeyDownPress={...}
|
|
258
|
-
onKeyUpPress={...}
|
|
259
|
-
focusable
|
|
260
|
-
>
|
|
261
|
-
<Text>Content</Text>
|
|
262
|
-
</KeyboardExtendedBaseView>
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
Props | Description | Type
|
|
266
|
-
-- | -- | --
|
|
267
|
-
focusable | Indicates if the component can be focused by keyboard | `boolean \| undefined`
|
|
268
|
-
canBeFocused | (deprecated) Indicates if the component can be focused by keyboard | `boolean \| undefined`
|
|
269
|
-
group | Indicates if the component is a focusable group | `boolean`
|
|
270
|
-
onFocus | Handler called when the component is focused | `() => void`
|
|
271
|
-
onBlur | Handler called when the component loses focus | `() => void`
|
|
272
|
-
onFocusChange | Handler called when the component is focused or blurred | `(isFocused: boolean, tag?: number) => void`
|
|
273
|
-
onKeyUpPress | Handler for the key-up event | `(e: OnKeyPress) => void`
|
|
274
|
-
onKeyDownPress | Handler for the key-down event | `(e: OnKeyPress) => void`
|
|
275
|
-
onContextMenuPress?: | Handler for long press events triggered by the context menu command (iOS only) | () => void;
|
|
276
|
-
onBubbledContextMenuPress | Handler for bubbled long-press events triggered by the context menu command (iOS only) | () => void;
|
|
277
|
-
haloEffect | Enables halo effect on focus (iOS only) | `boolean \| undefined`
|
|
278
|
-
haloCornerRadius? | Corner radius of the halo ring (iOS only) | `number`
|
|
279
|
-
haloExpendX? | Horizontal expansion of the halo ring in points (iOS only) | `number`
|
|
280
|
-
haloExpendY? | Vertical expansion of the halo ring in points (iOS only) | `number`
|
|
281
|
-
autoFocus | Indicates if the component should automatically gain focus | `boolean \| undefined`
|
|
282
|
-
tintColor | Color used for tinting the component | `string`
|
|
283
|
-
ref->focus | Command to programmatically focus the component | () => void;
|
|
284
|
-
orderId? | A unique ID used for link target identification. | `string`
|
|
285
|
-
orderBackward? | ID of the target for backward navigation with "Tab + Shift". | `string`
|
|
286
|
-
orderForward? | ID of the target for forward navigation with "Tab". | `string`
|
|
287
|
-
orderLeft? | ID of the target for navigation to the left. | `string`
|
|
288
|
-
orderRight? | ID of the target for navigation to the right. | `string`
|
|
289
|
-
orderUp? | ID of the target for navigation upward. | `string`
|
|
290
|
-
orderDown? | ID of the target for navigation downward. | `string`
|
|
291
|
-
lockFocus? | An array of directions to lock focus. | Array of 'left' \| 'right' \| 'up' \| 'down' \| 'forward' \| 'backward' \| 'first' \| 'last'
|
|
292
|
-
...rest | Remaining View props | `View`
|
|
293
|
-
|
|
294
|
-
### KeyboardFocusGroup
|
|
295
|
-
The `KeyboardFocusGroup` is a View-based component developed based on the iOS API. It can be used for defining focus groups or setting the `tintColor` globally.
|
|
62
|
+
## Architecture support
|
|
296
63
|
|
|
297
|
-
|
|
298
|
-
<KeyboardFocusGroup
|
|
299
|
-
tintColor="orange">
|
|
300
|
-
<ScrollView
|
|
301
|
-
contentContainerStyle={styles.contentContainer}
|
|
302
|
-
style={styles.container}
|
|
303
|
-
>
|
|
304
|
-
...
|
|
305
|
-
</ScrollView>
|
|
306
|
-
</KeyboardFocusGroup>
|
|
307
|
-
<KeyboardFocusGroup
|
|
308
|
-
focusStyle={{ backgroundColor: 'green' }}
|
|
309
|
-
onFocusChange={(e) => console.log('green', e)}
|
|
310
|
-
groupIdentifier="green"
|
|
311
|
-
tintColor="green"
|
|
312
|
-
>
|
|
313
|
-
<Button>
|
|
314
|
-
</KeyboardFocusGroup>
|
|
315
|
-
<KeyboardFocusGroup
|
|
316
|
-
focusStyle={{ backgroundColor: 'yellow' }}
|
|
317
|
-
onFocusChange={(e) => console.log('yellow', e)}
|
|
318
|
-
groupIdentifier="yellow"
|
|
319
|
-
tintColor="yellow"
|
|
320
|
-
>
|
|
321
|
-
<Button>
|
|
322
|
-
</KeyboardFocusGroup>
|
|
323
|
-
```
|
|
324
|
-
|
|
325
|
-
Props | Description | Type
|
|
326
|
-
-- | -- | --
|
|
327
|
-
focusStyle? | Style applied to the inner component when it is focused | `FocusStyle`
|
|
328
|
-
onFocusChange?: | Handler called when the component is focused or blurred | `(isFocused: boolean) => void;`
|
|
329
|
-
onFocus?: | Handler called when the component is focused | `() => void`
|
|
330
|
-
onBlur?: | Handler called when the component loses focus | `() => void`
|
|
331
|
-
groupIdentifier?: | Relates to iOS `focusGroupIdentifier`: the identifier of the focus group to which this view belongs| `string`
|
|
332
|
-
|
|
333
|
-
### Keyboard
|
|
334
|
-
Keyboard module to support soft keyboard dismissal.
|
|
335
|
-
|
|
336
|
-
```tsx
|
|
337
|
-
import { Keyboard } from 'react-native-external-keyboard';
|
|
338
|
-
|
|
339
|
-
...
|
|
340
|
-
Keyboard.dismiss();
|
|
341
|
-
...
|
|
342
|
-
```
|
|
343
|
-
|
|
344
|
-
This is needed for hiding the soft keyboard using a hardware keyboard. Additionally, the soft keyboard can be hidden from the settings or by pressing `Alt + K`.
|
|
345
|
-
|
|
346
|
-
### Focus.Frame and Focus.Trap
|
|
347
|
-
|
|
348
|
-
`Focus.Frame` and `Focus.Trap` are two components that help manage and lock focus within specific areas of the screen.
|
|
349
|
-
|
|
350
|
-
- On iOS, `Focus.Trap` uses the native `accessibilityViewIsModal` property to keep the screen reader focus within a defined area. For stronger containment — such as preventing focus from reaching system elements like navigation bars or headers — pass `forceLock`. It observes focus changes and moves focus back into the trap when it escapes. Note: because focus is corrected reactively, VoiceOver may briefly jump to an element outside the trap before being returned.
|
|
351
|
-
- On Android, where no equivalent to `accessibilityViewIsModal` exists, custom logic has been implemented as a workaround. By default, Android uses a custom Activity or Modal to limit focus. While using a Modal is considered the best practice for focus locking on Android, some scenarios—such as issues with React Native's Modal or library-specific constraints—may require alternative implementations.
|
|
352
|
-
|
|
353
|
-
#### How It Works
|
|
354
|
-
|
|
355
|
-
The focus lock functionality should be used as a pair:
|
|
356
|
-
|
|
357
|
-
- `Focus.Frame`: This component is used at the root level of a "screen" to detect focus leaks and ensure that focus remains contained.
|
|
358
|
-
- `Focus.Trap`: This component wraps the content area where focus should be explicitly locked.
|
|
359
|
-
|
|
360
|
-
| Prop | Description |
|
|
64
|
+
| Capability | Supported |
|
|
361
65
|
| :-- | :-- |
|
|
362
|
-
|
|
|
363
|
-
|
|
|
364
|
-
|
|
|
66
|
+
| New Architecture (Fabric / Turbo Modules) | ✅ |
|
|
67
|
+
| Old Architecture (Bridge) | ✅ |
|
|
68
|
+
| Bridgeless mode | ✅ |
|
|
69
|
+
| Expo (prebuild / bare) | ✅ |
|
|
365
70
|
|
|
366
|
-
|
|
367
|
-
<Focus.Frame>
|
|
368
|
-
...
|
|
369
|
-
<Focus.Trap forceLock>
|
|
370
|
-
<Text accessibilityRole="header">Locked Area</Text>
|
|
371
|
-
<Button
|
|
372
|
-
title="Confirm"
|
|
373
|
-
accessibilityLabel="Confirm action"
|
|
374
|
-
/>
|
|
375
|
-
</Focus.Trap>
|
|
376
|
-
...
|
|
377
|
-
</Focus.Frame>
|
|
378
|
-
```
|
|
71
|
+
## React Native compatibility
|
|
379
72
|
|
|
380
|
-
|
|
73
|
+
| Library version | React Native |
|
|
74
|
+
| :-- | :-- |
|
|
75
|
+
| `1.0.0` | ≥ 0.80 |
|
|
76
|
+
| `0.11.0` | ≤ 0.79 |
|
|
381
77
|
|
|
382
|
-
##
|
|
78
|
+
## Documentation
|
|
383
79
|
|
|
384
|
-
|
|
80
|
+
New here? Start with the [getting started guide](./docs/getting-started/getting-started.md), then follow a task-focused guide. The [full docs index](./docs/README.md) links everything.
|
|
385
81
|
|
|
386
|
-
|
|
387
|
-
<View>
|
|
388
|
-
<Pressable
|
|
389
|
-
onPress={onPress}
|
|
390
|
-
orderId="0_0"
|
|
391
|
-
orderForward="0_2"
|
|
392
|
-
>
|
|
393
|
-
<Text>1</Text>
|
|
394
|
-
</Pressable>
|
|
395
|
-
<Pressable
|
|
396
|
-
onPress={onPress}
|
|
397
|
-
orderId="0_2"
|
|
398
|
-
orderBackward="0_1"
|
|
399
|
-
>
|
|
400
|
-
<Text>3</Text>
|
|
401
|
-
</Pressable>
|
|
402
|
-
<Pressable
|
|
403
|
-
onPress={onPress}
|
|
404
|
-
orderId="0_1"
|
|
405
|
-
orderForward="0_2"
|
|
406
|
-
orderBackward="0_0"
|
|
407
|
-
>
|
|
408
|
-
<Text>2</Text>
|
|
409
|
-
</Pressable>
|
|
410
|
-
</View>
|
|
411
|
-
```
|
|
82
|
+
**Guides** — task-focused walkthroughs
|
|
412
83
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
> **`KeyboardOrderFocusGroup` (auto namespace).** Wraps a component tree and automatically namespaces all `orderId` values inside. Ideal for screens and containers where uniqueness is needed but the exact prefix doesn't matter.
|
|
419
|
-
>
|
|
420
|
-
> ```tsx
|
|
421
|
-
> // Each card gets its own isolated namespace
|
|
422
|
-
> {items.map((item) => (
|
|
423
|
-
> <KeyboardOrderFocusGroup key={item.id}>
|
|
424
|
-
> <Pressable orderId="title" orderForward="action">…</Pressable>
|
|
425
|
-
> <Pressable orderId="action" orderBackward="title">…</Pressable>
|
|
426
|
-
> </KeyboardOrderFocusGroup>
|
|
427
|
-
> ))}
|
|
428
|
-
> ```
|
|
429
|
-
>
|
|
430
|
-
> **Static namespace with `groupId` / `orderPrefix`.** Use an explicit string when you need a stable, predictable namespace — for example, to create intentional focus links between two sibling components that know about each other.
|
|
431
|
-
>
|
|
432
|
-
> ```tsx
|
|
433
|
-
> // groupId on KeyboardOrderFocusGroup
|
|
434
|
-
> <KeyboardOrderFocusGroup groupId="card_42">
|
|
435
|
-
> <Pressable orderId="title" orderForward="action">…</Pressable>
|
|
436
|
-
> <Pressable orderId="action" orderBackward="title">…</Pressable>
|
|
437
|
-
> </KeyboardOrderFocusGroup>
|
|
438
|
-
>
|
|
439
|
-
> // or orderPrefix directly on each component
|
|
440
|
-
> <Pressable orderPrefix="card_42" orderId="title" orderForward="action">…</Pressable>
|
|
441
|
-
> <Pressable orderPrefix="card_42" orderId="action" orderBackward="title">…</Pressable>
|
|
442
|
-
> ```
|
|
443
|
-
|
|
444
|
-
You can find more examples here: [Focus Link Order](https://github.com/ArturKalach/react-native-external-keyboard/blob/release/0.6.0-rc/example/src/components/FocusOrderExample/FocusLinkOrder.tsx), [DPad Order](https://github.com/ArturKalach/react-native-external-keyboard/blob/release/0.6.0-rc/example/src/components/FocusOrderExample/FocusDPadOrder.tsx)
|
|
84
|
+
- [Pressable focus handling](./docs/guides/pressable-focus.md) — focus/blur events, `focusStyle`, render props
|
|
85
|
+
- [Native focus styling](./docs/guides/focus-styling.md) — iOS halo & `tintColor`, Android focus highlight
|
|
86
|
+
- [Programmatic focus](./docs/guides/programmatic-focus.md) — `ref.focus()`, `keyboardFocus()`, `autoFocus`
|
|
87
|
+
- [Keyboard text input](./docs/guides/text-input.md) — `KeyboardExtendedInput`, `focusType`, `blurType`
|
|
88
|
+
- [Focus order](./docs/guides/focus-order.md) — link-based, index-based, and direction-lock ordering
|
|
445
89
|
|
|
446
|
-
|
|
447
|
-
| :-- | :-- | :-- |
|
|
448
|
-
| orderId? | A unique ID used for link target identification. | `string` |
|
|
449
|
-
| orderBackward? | ID of the target for backward navigation with "Tab + Shift". | `string` |
|
|
450
|
-
| orderForward? | ID of the target for forward navigation with "Tab". | `string` |
|
|
451
|
-
| orderLeft? | ID of the target for navigation to the left. | `string` |
|
|
452
|
-
| orderRight? | ID of the target for navigation to the right. | `string` |
|
|
453
|
-
| orderUp? | ID of the target for navigation upward. | `string` |
|
|
454
|
-
| orderDown? | ID of the target for navigation downward. | `string` |
|
|
455
|
-
| orderPrefix? | Prefix prepended to this component's `orderId` and all `order*` target IDs. Use to namespace IDs in repeated components (lists, cards) or alongside a static `groupId`. | `string` |
|
|
90
|
+
**Advanced**
|
|
456
91
|
|
|
457
|
-
|
|
92
|
+
- [Native focus services](./docs/guides/native-focus-services.md) — native-side focus API & memory service for custom native code
|
|
458
93
|
|
|
459
|
-
|
|
94
|
+
**Reference**
|
|
460
95
|
|
|
461
|
-
|
|
96
|
+
- [Component overview](./docs/components/overview.md) — every component and its props
|
|
97
|
+
- [API reference](./docs/api/overview.md) — modules, hooks, the imperative ref, shared types
|
|
98
|
+
- [Migration guide](./docs/migration/migration.md) — version-to-version upgrade notes
|
|
462
99
|
|
|
463
|
-
|
|
100
|
+
## What's available
|
|
464
101
|
|
|
465
|
-
|
|
466
|
-
import { KeyboardOrderFocusGroup } from 'react-native-external-keyboard';
|
|
467
|
-
|
|
468
|
-
<KeyboardOrderFocusGroup>
|
|
469
|
-
<View>
|
|
470
|
-
<Pressable onPress={onPress} orderIndex={0}>
|
|
471
|
-
<Text>First</Text>
|
|
472
|
-
</Pressable>
|
|
473
|
-
<Pressable onPress={onPress} orderIndex={2}>
|
|
474
|
-
<Text>Third</Text>
|
|
475
|
-
</Pressable>
|
|
476
|
-
<Pressable onPress={onPress} orderIndex={1}>
|
|
477
|
-
<Text>Second</Text>
|
|
478
|
-
</Pressable>
|
|
479
|
-
</View>
|
|
480
|
-
</KeyboardOrderFocusGroup>
|
|
481
|
-
```
|
|
482
|
-
|
|
483
|
-
| Props | Description | Type |
|
|
484
|
-
| :-- | :-- | :-- |
|
|
485
|
-
| groupId? | Optional explicit group name. Auto-generated when omitted. | `string` |
|
|
486
|
-
| children? | Child components | `ReactNode` |
|
|
102
|
+
**Components**
|
|
487
103
|
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
|
502
|
-
|
|
|
104
|
+
| Export | Purpose |
|
|
105
|
+
| :-- | :-- |
|
|
106
|
+
| [`K.Pressable` / `K.View` / `K.Input`](./docs/getting-started/getting-started.md#quick-start) | Ready-made, keyboard-focusable `Pressable` / `View` / `TextInput`. Start here. |
|
|
107
|
+
| [`withKeyboardFocus(C)`](./docs/components/overview.md#withkeyboardfocus) | HOC that adds keyboard focus to any `Pressable`/`Touchable`-like component. |
|
|
108
|
+
| [`KeyboardExtendedView`](./docs/components/overview.md#keyboardextendedview) | Focus-aware `View` for key handling and grouping (also `K.View`). |
|
|
109
|
+
| [`KeyboardExtendedInput`](./docs/components/overview.md#keyboardextendedinput) | `TextInput` with keyboard focus support (also `K.Input`). |
|
|
110
|
+
| [`KeyboardExtendedBaseView`](./docs/components/overview.md#keyboardextendedbaseview) | Low-level focusable view (alias `ExternalKeyboardView`). |
|
|
111
|
+
| [`KeyboardFocusGroup`](./docs/components/overview.md#keyboardfocusgroup) | iOS `focusGroupIdentifier` grouping + global `tintColor`. |
|
|
112
|
+
| [`Focus.Frame` / `Focus.Trap`](./docs/components/overview.md#focusframe--focustrap) | Confine focus to a region (modals, overlays). |
|
|
113
|
+
| [`KeyboardOrderFocusGroup`](./docs/components/overview.md#keyboardorderfocusgroup) | Namespacing + index-based focus ordering. |
|
|
114
|
+
|
|
115
|
+
**API**
|
|
116
|
+
|
|
117
|
+
| Export | Purpose |
|
|
118
|
+
| :-- | :-- |
|
|
119
|
+
| [`Keyboard`](./docs/api/overview.md#keyboard-module) | Dismiss the soft keyboard from a hardware keyboard. |
|
|
120
|
+
| [`KeyboardFocus` ref](./docs/api/overview.md#imperative-ref-keyboardfocus) | Imperative focus handle (`focus`, `keyboardFocus`, `screenReaderFocus`). |
|
|
121
|
+
| [Hooks](./docs/api/overview.md#hooks) | `useIsViewFocused`, `useOrderFocusGroup`. |
|
|
122
|
+
| [Focus-order props](./docs/api/overview.md#focus-order-props) | `orderId`, `order*`, `orderIndex`, `orderGroup`, `lockFocus`. |
|
|
503
123
|
|
|
504
|
-
|
|
124
|
+
---
|
|
505
125
|
|
|
506
|
-
##
|
|
126
|
+
## Roadmap
|
|
507
127
|
|
|
508
|
-
|
|
128
|
+
All planned features are implemented and released. No new functionality or API changes are planned.
|
|
509
129
|
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
>
|
|
514
|
-
<Text>Lock Example</Text>
|
|
515
|
-
</Pressable>
|
|
516
|
-
```
|
|
130
|
+
Future work is limited to:
|
|
131
|
+
- React Native version support (new releases)
|
|
132
|
+
- Bug fixes and issue resolution
|
|
517
133
|
|
|
134
|
+
Both active versions receive fixes:
|
|
518
135
|
|
|
519
|
-
|
|
|
136
|
+
| Version | React Native | Status |
|
|
520
137
|
| :-- | :-- | :-- |
|
|
521
|
-
|
|
|
522
|
-
|
|
523
|
-
> [!NOTE]
|
|
524
|
-
> `first` and `last` are specific to `iOS`. When focus is blocked for `forward` and `backward` on iOS, it checks for the `last` and `first` elements to focus.
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
# Migration 0.3.x to 0.4.0
|
|
528
|
-
|
|
529
|
-
## Module (A11yModule, KeyboardExtendedModule)
|
|
530
|
-
|
|
531
|
-
Functions in the `A11yModule` (`KeyboardExtendedModule`) have been deprecated. They appeared appropriate at the time, but with the new architecture and to improve usability, they have been replaced with `ref` actions.
|
|
532
|
-
|
|
533
|
-
Previous:
|
|
534
|
-
```jsx
|
|
535
|
-
import { KeyboardExtendedModule } from 'react-native-external-keyboard';
|
|
536
|
-
|
|
537
|
-
KeyboardExtendedModule.setKeyboardFocus(ref); //or A11yModule.setKeyboardFocus(ref);
|
|
538
|
-
```
|
|
539
|
-
|
|
540
|
-
Updated:
|
|
541
|
-
```
|
|
542
|
-
import { KeyboardExtendedPressable, type KeyboardFocus } from 'react-native-external-keyboard';
|
|
543
|
-
...
|
|
544
|
-
|
|
545
|
-
const ref = useRef<KeyboardFocus>(null);
|
|
546
|
-
|
|
547
|
-
...
|
|
548
|
-
|
|
549
|
-
const onPressForFocus = () => {
|
|
550
|
-
ref.current.focus()
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
<TouchableOpacity
|
|
554
|
-
ref={ref}
|
|
555
|
-
>
|
|
556
|
-
<Text>TouchableOpacity</Text>
|
|
557
|
-
</TouchableOpacity>
|
|
558
|
-
|
|
559
|
-
```
|
|
560
|
-
|
|
561
|
-
The specific method for iOS, `setPreferredKeyboardFocus`, has not been added so far because we now have the new feature `autoFocus`, which does not fit well with the new API and its approach. It is better to use `autoFocus` for focusing views on both Android and iOS.
|
|
562
|
-
|
|
563
|
-
If you truly need this method, please create a new issue, and we will consider how to return it.
|
|
564
|
-
|
|
565
|
-
## Pressable
|
|
566
|
-
<details>
|
|
567
|
-
<summary>Pressable changes</summary>
|
|
568
|
-
|
|
569
|
-
Unfortunately, the previous version of Pressable had many issues. For iOS, we cloned the entire Pressable component from React Native's source code, while for Android, we simply wrapped the component.
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
This led to two main problems:
|
|
573
|
-
|
|
574
|
-
1. Difficulty in updating Pressable for iOS.
|
|
575
|
-
2. Challenges in controlling styles.
|
|
576
|
-
|
|
577
|
-
For these reasons, we replaced Pressable with `withKeyboardFocus(Pressable)`, as it was the only viable path forward to introduce new features.
|
|
578
|
-
</details>
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
## Component aliases
|
|
582
|
-
|
|
583
|
-
It is believed that good naming can simplify usage and development. Based on this principle and for compatibility with `0.2.x`, aliases were added. You can still use the old naming convention, and it will be maintained in future releases.
|
|
584
|
-
|
|
585
|
-
The map of aliases is provided below: <br />
|
|
586
|
-
`A11yModule` -> `KeyboardExtendedModule` <br />
|
|
587
|
-
`Pressable` -> `KeyboardExtendedPressable` <br />
|
|
588
|
-
`KeyboardFocusView` -> `KeyboardExtendedView` <br />
|
|
589
|
-
`ExternalKeyboardView` -> `KeyboardExtendedBaseView` <br />
|
|
590
|
-
|
|
591
|
-
# Migration 0.7.x to 0.8.0
|
|
592
|
-
|
|
593
|
-
React and React Native packages have been updated in `react-native-external-keyboard@0.8.0`.
|
|
594
|
-
|
|
595
|
-
Unfortunately, the latest React Native versions (0.83.x and 0.84.x) have different types compared to previous versions, and the Pressable as well as KeyboardExtendedPressable props could be incompatible with local types because they have static TypeScript declarations based on the React Native 0.83.4 dependency.
|
|
596
|
-
|
|
597
|
-
In some cases, you may experience the following TypeScript problem:
|
|
598
|
-
<img width="759" height="81" alt="image" src="https://github.com/user-attachments/assets/d47992ce-d3df-473b-bd96-5f2ba53ab889" />
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
It can be resolved by using a HOC, as it provides dynamic typing.
|
|
602
|
-
```tsx
|
|
603
|
-
const KeyboardPressable = withKeyboardFocus(Pressable)
|
|
604
|
-
|
|
605
|
-
export const K = (props: PressableProps) => {
|
|
606
|
-
return <KeyboardPressable {...props} />;
|
|
607
|
-
}
|
|
608
|
-
```
|
|
609
|
-
|
|
610
|
-
As well, it could be resolved by component redeclaration:
|
|
611
|
-
```ts
|
|
612
|
-
export {};
|
|
613
|
-
|
|
614
|
-
declare module 'react-native-external-keyboard' {
|
|
615
|
-
import type { PressableProps, ViewProps } from 'react-native';
|
|
616
|
-
import type { WithKeyboardFocusDeclaration } from 'react-native-external-keyboard/lib/typescript/src/types/WithKeyboardFocus';
|
|
617
|
-
|
|
618
|
-
export const Pressable: WithKeyboardFocusDeclaration<PressableProps, ViewProps['style']>
|
|
619
|
-
export const KeyboardExtendedPressable: WithKeyboardFocusDeclaration<PressableProps, ViewProps['style']>
|
|
620
|
-
}
|
|
621
|
-
```
|
|
622
|
-
|
|
623
|
-
# API
|
|
624
|
-
ToDo
|
|
625
|
-
|
|
626
|
-
```ts
|
|
627
|
-
export type OnKeyPress = NativeSyntheticEvent<{
|
|
628
|
-
keyCode: number;
|
|
629
|
-
unicode: number;
|
|
630
|
-
unicodeChar: string;
|
|
631
|
-
isLongPress: boolean;
|
|
632
|
-
isAltPressed: boolean;
|
|
633
|
-
isShiftPressed: boolean;
|
|
634
|
-
isCtrlPressed: boolean;
|
|
635
|
-
isCapsLockOn: boolean;
|
|
636
|
-
hasNoModifiers: boolean;
|
|
637
|
-
}>;
|
|
638
|
-
```
|
|
639
|
-
|
|
640
|
-
## Roadmap
|
|
641
|
-
- [ ] Refactor and Performance optimization
|
|
642
|
-
- [ ] Update `focusGroupIdentifier` and implement `KeyboardNavigationCluster` functionality
|
|
643
|
-
- [ ] Update `onPress` and `onLongPress` for `withKeyboardFocus`
|
|
644
|
-
- [x] Add functionality to control keyboard focus order.
|
|
645
|
-
- [ ] Verify and update `focusable` and `disabled` states for iOS and Android.
|
|
646
|
-
- [ ] Update `Readme.md`.
|
|
647
|
-
- [ ] Create the documentation.
|
|
138
|
+
| `1.0.0` | ≥ 0.80 | Active — bug fixes and new RN support |
|
|
139
|
+
| `0.11.0` | ≤ 0.79 | Active — bug fixes only |
|
|
648
140
|
|
|
141
|
+
---
|
|
649
142
|
|
|
650
143
|
## Contributing
|
|
651
|
-
|
|
144
|
+
|
|
145
|
+
Any type of contribution is highly appreciated. Feel free to create PRs, raise issues, or share ideas — see the [contributing guide](CONTRIBUTING.md) for the development workflow.
|
|
652
146
|
|
|
653
147
|
## Acknowledgements
|
|
148
|
+
|
|
654
149
|
It has been a long journey since the first release of the `react-native-external-keyboard` package. Many features have been added, and a lot of issues have been fixed.
|
|
655
150
|
|
|
656
151
|
With that, I would like to thank the contributors, those who created issues, and the followers, because achieving these results wouldn't have been possible without you.
|
|
@@ -659,7 +154,7 @@ Thanks to the initial authors: [Andrii Koval](https://github.com/ZioVio), [Micha
|
|
|
659
154
|
|
|
660
155
|
Thanks to the contributors: [João Mosmann](https://github.com/JoaoMosmann), [Stéphane](https://github.com/stephane-r).
|
|
661
156
|
|
|
662
|
-
Thanks to those who created issues:
|
|
157
|
+
Thanks to those who created issues: [Stéphane](https://github.com/stephane-r), [proohit](https://github.com/proohit), [Rananjaya Bandara](https://github.com/Rananjaya), [SteveHoneckPGE](https://github.com/SteveHoneckPGE), [Wes](https://github.com/mrpoodestump).
|
|
663
158
|
|
|
664
159
|
I really appreciate your help; it has truly helped me move forward!
|
|
665
160
|
|