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
|
@@ -1,31 +1,20 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import type { KeyboardFocusViewProps } from '../../types/KeyboardFocusView.types';
|
|
4
|
-
import { BaseKeyboardView } from '../BaseKeyboardView/BaseKeyboardView';
|
|
2
|
+
import { Platform } from 'react-native';
|
|
5
3
|
import type {
|
|
4
|
+
KeyboardFocusViewProps,
|
|
6
5
|
BaseKeyboardViewType,
|
|
7
6
|
KeyboardFocus,
|
|
8
|
-
} from '../../types
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
type RenderProp,
|
|
12
|
-
RenderPropComponent,
|
|
13
|
-
} from '../RenderPropComponent/RenderPropComponent';
|
|
14
|
-
import { useFocusStyle } from '../../utils/useFocusStyle';
|
|
15
|
-
import { useKeyboardPress } from '../../utils/useKeyboardPress/useKeyboardPress';
|
|
7
|
+
} from '../../types';
|
|
8
|
+
import { BaseKeyboardView } from '../BaseKeyboardView/BaseKeyboardView';
|
|
9
|
+
import { useKeyboardFocusContainer } from '../../utils/useKeyboardFocusContainer';
|
|
16
10
|
import { IsViewFocusedContext } from '../../context/IsViewFocusedContext';
|
|
17
11
|
|
|
18
12
|
export const KeyboardFocusView = React.forwardRef<
|
|
19
13
|
BaseKeyboardViewType | KeyboardFocus,
|
|
20
|
-
KeyboardFocusViewProps
|
|
21
|
-
tintType?: TintType;
|
|
22
|
-
FocusHoverComponent?: RenderProp;
|
|
23
|
-
withView?: boolean;
|
|
24
|
-
}
|
|
14
|
+
KeyboardFocusViewProps
|
|
25
15
|
>(
|
|
26
16
|
(
|
|
27
17
|
{
|
|
28
|
-
tintType = 'default',
|
|
29
18
|
autoFocus,
|
|
30
19
|
focusStyle,
|
|
31
20
|
style,
|
|
@@ -34,15 +23,13 @@ export const KeyboardFocusView = React.forwardRef<
|
|
|
34
23
|
onLongPress,
|
|
35
24
|
onKeyUpPress,
|
|
36
25
|
onKeyDownPress,
|
|
37
|
-
|
|
26
|
+
focusableWrapper = false,
|
|
38
27
|
haloEffect = true,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
withView = true, //ToDo RNCEKV-9 update and rename Discussion #63
|
|
28
|
+
focusable,
|
|
29
|
+
withView = true,
|
|
42
30
|
tintColor,
|
|
43
31
|
onFocus,
|
|
44
32
|
onBlur,
|
|
45
|
-
FocusHoverComponent,
|
|
46
33
|
children,
|
|
47
34
|
accessible,
|
|
48
35
|
triggerCodes,
|
|
@@ -51,81 +38,55 @@ export const KeyboardFocusView = React.forwardRef<
|
|
|
51
38
|
},
|
|
52
39
|
ref
|
|
53
40
|
) => {
|
|
54
|
-
const {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const { onKeyUpPressHandler, onKeyDownPressHandler } = useKeyboardPress({
|
|
41
|
+
const {
|
|
42
|
+
focused,
|
|
43
|
+
containerFocusedStyle,
|
|
44
|
+
onFocusChangeHandler,
|
|
45
|
+
onKeyUpPressHandler,
|
|
46
|
+
onKeyDownPressHandler,
|
|
47
|
+
} = useKeyboardFocusContainer({
|
|
48
|
+
onFocusChange,
|
|
49
|
+
containerFocusStyle: focusStyle,
|
|
65
50
|
onKeyUpPress,
|
|
66
51
|
onKeyDownPress,
|
|
67
52
|
onPress,
|
|
68
53
|
onLongPress,
|
|
69
54
|
triggerCodes,
|
|
70
|
-
disabled: (props as { disabled?: boolean })?.disabled,
|
|
71
55
|
});
|
|
72
56
|
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
return <View style={[hoverColor, styles.absolute, styles.opacity]} />;
|
|
77
|
-
|
|
78
|
-
return undefined;
|
|
79
|
-
}, [FocusHoverComponent, hoverColor, tintType]);
|
|
57
|
+
const a11y =
|
|
58
|
+
(Platform.OS === 'android' && withView && accessible !== false) ||
|
|
59
|
+
accessible;
|
|
80
60
|
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
);
|
|
86
|
-
}, [accessible, withView]);
|
|
61
|
+
const containerStyleArr = useMemo(
|
|
62
|
+
() => [style, containerFocusedStyle],
|
|
63
|
+
[style, containerFocusedStyle]
|
|
64
|
+
);
|
|
87
65
|
|
|
88
66
|
return (
|
|
89
67
|
<IsViewFocusedContext.Provider value={focused}>
|
|
90
68
|
<BaseKeyboardView
|
|
91
|
-
style={
|
|
92
|
-
ref={ref}
|
|
69
|
+
style={containerStyleArr}
|
|
70
|
+
ref={ref as React.Ref<BaseKeyboardViewType>}
|
|
93
71
|
onKeyUpPress={onKeyUpPressHandler}
|
|
94
72
|
onKeyDownPress={onKeyDownPressHandler}
|
|
95
73
|
onFocus={onFocus}
|
|
96
74
|
onBlur={onBlur}
|
|
97
75
|
onFocusChange={onFocusChangeHandler}
|
|
98
76
|
onContextMenuPress={onLongPress}
|
|
99
|
-
haloEffect={
|
|
77
|
+
haloEffect={haloEffect}
|
|
100
78
|
defaultFocusHighlightEnabled={defaultFocusHighlightEnabled}
|
|
101
79
|
autoFocus={autoFocus}
|
|
102
|
-
canBeFocused={canBeFocused}
|
|
103
80
|
focusable={focusable}
|
|
104
81
|
tintColor={tintColor}
|
|
105
|
-
|
|
82
|
+
focusableWrapper={focusableWrapper}
|
|
106
83
|
accessible={a11y}
|
|
107
84
|
enableContextMenu={Boolean(onLongPress)}
|
|
108
85
|
{...props}
|
|
109
86
|
>
|
|
110
87
|
{children}
|
|
111
|
-
{focused && HoverComonent && (
|
|
112
|
-
<RenderPropComponent render={HoverComonent} />
|
|
113
|
-
)}
|
|
114
88
|
</BaseKeyboardView>
|
|
115
89
|
</IsViewFocusedContext.Provider>
|
|
116
90
|
);
|
|
117
91
|
}
|
|
118
92
|
);
|
|
119
|
-
|
|
120
|
-
const styles = StyleSheet.create({
|
|
121
|
-
absolute: {
|
|
122
|
-
position: 'absolute',
|
|
123
|
-
top: 0,
|
|
124
|
-
left: 0,
|
|
125
|
-
right: 0,
|
|
126
|
-
bottom: 0,
|
|
127
|
-
},
|
|
128
|
-
opacity: {
|
|
129
|
-
opacity: 0.3,
|
|
130
|
-
},
|
|
131
|
-
});
|
|
@@ -6,11 +6,11 @@ import {
|
|
|
6
6
|
} from 'react-native';
|
|
7
7
|
|
|
8
8
|
import { withKeyboardFocus } from '../../utils/withKeyboardFocus';
|
|
9
|
-
import type {
|
|
9
|
+
import type { WithKeyboardFocusPropsWithRef } from '../../types';
|
|
10
10
|
|
|
11
11
|
export const Pressable = withKeyboardFocus(RNPressable);
|
|
12
12
|
|
|
13
|
-
export type KeyboardPressableProps =
|
|
13
|
+
export type KeyboardPressableProps = WithKeyboardFocusPropsWithRef<
|
|
14
14
|
PressableProps,
|
|
15
15
|
ViewProps['style'],
|
|
16
16
|
View
|
package/src/components/index.ts
CHANGED
|
@@ -7,3 +7,15 @@ export {
|
|
|
7
7
|
KeyboardFocusView,
|
|
8
8
|
KeyboardFocusView as KeyboardExtendedView,
|
|
9
9
|
} from './KeyboardFocusView';
|
|
10
|
+
export { KeyboardFocusGroup } from './KeyboardFocusGroup/KeyboardFocusGroup';
|
|
11
|
+
export {
|
|
12
|
+
KeyboardExtendedInput,
|
|
13
|
+
KeyboardExtendedInput as TextInput,
|
|
14
|
+
} from './KeyboardExtendedInput/KeyboardExtendedInput';
|
|
15
|
+
export {
|
|
16
|
+
Pressable,
|
|
17
|
+
Pressable as KeyboardExtendedPressable,
|
|
18
|
+
type KeyboardPressableProps,
|
|
19
|
+
} from './Touchable/Pressable';
|
|
20
|
+
export { FocusFrame } from './KeyboardFocusLock/FocusFrame/FocusFrame';
|
|
21
|
+
export { FocusTrap } from './KeyboardFocusLock/FocusTrap/FocusTrap';
|
package/src/index.tsx
CHANGED
|
@@ -1,49 +1,53 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
FocusFrame,
|
|
3
|
+
FocusTrap,
|
|
4
|
+
KeyboardFocusView,
|
|
5
|
+
KeyboardExtendedInput,
|
|
6
|
+
Pressable,
|
|
7
|
+
} from './components';
|
|
8
|
+
import * as Keyboard from './modules/Keyboard';
|
|
3
9
|
|
|
10
|
+
// Native spec
|
|
4
11
|
export {
|
|
5
12
|
ExternalKeyboardViewNative,
|
|
6
13
|
TextInputFocusWrapperNative,
|
|
7
14
|
type KeyPress,
|
|
8
15
|
} from './nativeSpec';
|
|
9
16
|
|
|
10
|
-
|
|
11
|
-
OnKeyPress,
|
|
12
|
-
KeyboardFocus,
|
|
13
|
-
BaseKeyboardViewType as KeyboardExtendedViewType,
|
|
14
|
-
} from './types/BaseKeyboardView';
|
|
15
|
-
|
|
16
|
-
export type {
|
|
17
|
-
TintType,
|
|
18
|
-
WithKeyboardFocusDeclaration,
|
|
19
|
-
WithKeyboardPropsTypeDeclaration,
|
|
20
|
-
WithKeyboardFocus,
|
|
21
|
-
} from './types/WithKeyboardFocus';
|
|
22
|
-
|
|
17
|
+
// Components
|
|
23
18
|
export {
|
|
24
19
|
BaseKeyboardView,
|
|
20
|
+
BaseKeyboardView as ExternalKeyboardView,
|
|
21
|
+
BaseKeyboardView as KeyboardExtendedBaseView,
|
|
25
22
|
KeyboardFocusView,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
export {
|
|
23
|
+
KeyboardFocusView as KeyboardExtendedView,
|
|
24
|
+
KeyboardFocusGroup,
|
|
25
|
+
KeyboardExtendedInput,
|
|
26
|
+
KeyboardExtendedInput as TextInput,
|
|
31
27
|
Pressable,
|
|
32
28
|
Pressable as KeyboardExtendedPressable,
|
|
33
|
-
|
|
34
|
-
} from './components/Touchable/Pressable';
|
|
29
|
+
} from './components';
|
|
35
30
|
|
|
31
|
+
// Types
|
|
36
32
|
export {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
33
|
+
LockComponentType,
|
|
34
|
+
type OnKeyPress,
|
|
35
|
+
type OnKeyPressFn,
|
|
36
|
+
type KeyboardFocus,
|
|
37
|
+
type OnFocusChangeFn,
|
|
38
|
+
type BaseKeyboardViewType,
|
|
39
|
+
type WithKeyboardFocusProps,
|
|
40
|
+
type WithKeyboardFocusPropsWithRef,
|
|
41
|
+
type KeyboardFocusableComponent,
|
|
42
|
+
type KeyboardFocusableComponentDeclaration,
|
|
43
|
+
type KeyboardFocusLockProps,
|
|
44
|
+
type KeyboardInputPropsDeclaration,
|
|
45
|
+
type KeyboardInputProps,
|
|
46
|
+
type ExtraKeyboardProps,
|
|
47
|
+
} from './types';
|
|
48
|
+
export type { KeyboardPressableProps } from './components';
|
|
45
49
|
|
|
46
|
-
|
|
50
|
+
// Hooks & context
|
|
47
51
|
export { withKeyboardFocus } from './utils/withKeyboardFocus';
|
|
48
52
|
export { useIsViewFocused } from './context/IsViewFocusedContext';
|
|
49
53
|
export {
|
|
@@ -51,10 +55,18 @@ export {
|
|
|
51
55
|
OrderFocusGroupContext,
|
|
52
56
|
useOrderFocusGroup,
|
|
53
57
|
} from './context/OrderFocusContext';
|
|
54
|
-
|
|
58
|
+
|
|
59
|
+
// Modules
|
|
55
60
|
export { Keyboard };
|
|
56
61
|
|
|
62
|
+
// Namespaces
|
|
57
63
|
export const Focus = {
|
|
58
64
|
Frame: FocusFrame,
|
|
59
65
|
Trap: FocusTrap,
|
|
60
66
|
};
|
|
67
|
+
|
|
68
|
+
export const K = {
|
|
69
|
+
Input: KeyboardExtendedInput,
|
|
70
|
+
View: KeyboardFocusView,
|
|
71
|
+
Pressable,
|
|
72
|
+
};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { codegenNativeComponent, type ViewProps } from 'react-native';
|
|
2
2
|
import type { Int32 } from 'react-native/Libraries/Types/CodegenTypes';
|
|
3
|
-
// eslint-disable-next-line @react-native/no-deep-imports
|
|
4
|
-
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
5
3
|
|
|
6
4
|
export interface ExternalKeyboardLockViewNativeComponentProps
|
|
7
5
|
extends ViewProps {
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
codegenNativeComponent,
|
|
3
|
+
codegenNativeCommands,
|
|
4
|
+
type ColorValue,
|
|
5
|
+
type ViewProps,
|
|
6
|
+
} from 'react-native';
|
|
2
7
|
import type {
|
|
3
8
|
BubblingEventHandler,
|
|
4
9
|
DirectEventHandler,
|
|
@@ -6,10 +11,6 @@ import type {
|
|
|
6
11
|
Int32,
|
|
7
12
|
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
8
13
|
import type { ComponentType } from 'react';
|
|
9
|
-
// eslint-disable-next-line @react-native/no-deep-imports
|
|
10
|
-
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
|
|
11
|
-
// eslint-disable-next-line @react-native/no-deep-imports
|
|
12
|
-
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
13
14
|
|
|
14
15
|
export type FocusChange = Readonly<{
|
|
15
16
|
isFocused: boolean;
|
|
@@ -48,10 +49,10 @@ export interface ExternalKeyboardNativeProps extends ViewProps {
|
|
|
48
49
|
haloCornerRadius?: Float;
|
|
49
50
|
haloExpendX?: Float;
|
|
50
51
|
haloExpendY?: Float;
|
|
52
|
+
roundedHaloFix?: boolean;
|
|
51
53
|
tintColor?: ColorValue;
|
|
52
|
-
|
|
54
|
+
focusableWrapper?: boolean;
|
|
53
55
|
groupIdentifier?: string;
|
|
54
|
-
enableA11yFocus?: boolean;
|
|
55
56
|
screenAutoA11yFocus?: boolean;
|
|
56
57
|
screenAutoA11yFocusDelay?: Int32;
|
|
57
58
|
orderGroup?: string;
|
|
@@ -71,11 +72,13 @@ export interface ExternalKeyboardNativeProps extends ViewProps {
|
|
|
71
72
|
|
|
72
73
|
export interface NativeCommands {
|
|
73
74
|
// @ts-ignore
|
|
74
|
-
|
|
75
|
+
rnekKeyboardFocus: (viewRef: React.ElementRef<ComponentType>) => void;
|
|
76
|
+
// @ts-ignore
|
|
77
|
+
rnekScreenReaderFocus: (viewRef: React.ElementRef<ComponentType>) => void;
|
|
75
78
|
}
|
|
76
79
|
|
|
77
80
|
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
|
|
78
|
-
supportedCommands: ['
|
|
81
|
+
supportedCommands: ['rnekKeyboardFocus', 'rnekScreenReaderFocus'],
|
|
79
82
|
});
|
|
80
83
|
|
|
81
84
|
export default codegenNativeComponent<ExternalKeyboardNativeProps>(
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
codegenNativeComponent,
|
|
3
|
+
type ViewProps,
|
|
4
|
+
type ColorValue,
|
|
5
|
+
} from 'react-native';
|
|
2
6
|
import type { DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes';
|
|
3
|
-
// eslint-disable-next-line @react-native/no-deep-imports
|
|
4
|
-
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
5
7
|
|
|
6
8
|
export type FocusChange = Readonly<{
|
|
7
9
|
isFocused: boolean;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
codegenNativeComponent,
|
|
3
|
+
type ViewProps,
|
|
4
|
+
type ColorValue,
|
|
5
|
+
} from 'react-native';
|
|
2
6
|
import type {
|
|
3
7
|
DirectEventHandler,
|
|
4
8
|
Float,
|
|
5
9
|
Int32,
|
|
6
10
|
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
7
|
-
// eslint-disable-next-line @react-native/no-deep-imports
|
|
8
|
-
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
9
11
|
|
|
10
12
|
export type FocusChange = Readonly<{
|
|
11
13
|
isFocused: boolean;
|
|
@@ -21,10 +23,12 @@ export interface TextInputFocusWrapperNativeComponent extends ViewProps {
|
|
|
21
23
|
focusType?: Int32;
|
|
22
24
|
blurType?: Int32;
|
|
23
25
|
canBeFocused?: boolean;
|
|
26
|
+
hasOnFocusChanged?: boolean;
|
|
24
27
|
haloEffect?: boolean;
|
|
25
28
|
haloCornerRadius?: Float;
|
|
26
29
|
haloExpendX?: Float;
|
|
27
30
|
haloExpendY?: Float;
|
|
31
|
+
roundedHaloFix?: boolean;
|
|
28
32
|
tintColor?: ColorValue;
|
|
29
33
|
blurOnSubmit?: boolean;
|
|
30
34
|
multiline?: boolean;
|
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
import type { ViewProps } from 'react-native';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Native role for a KeyboardFocusLock component on Android.
|
|
5
|
+
* iOS does not consume this value.
|
|
6
|
+
*
|
|
7
|
+
* Values must match the constants in
|
|
8
|
+
* `android/src/main/java/com/externalkeyboard/views/ExternalKeyboardLockView/ExternalKeyboardLockView.java`.
|
|
9
|
+
*/
|
|
10
|
+
export enum LockComponentType {
|
|
11
|
+
Trap = 0,
|
|
12
|
+
Frame = 1,
|
|
13
|
+
}
|
|
14
|
+
|
|
3
15
|
export type KeyboardFocusLockProps = ViewProps & {
|
|
4
|
-
|
|
16
|
+
/** Native role of the lock — `Trap` (containment) or `Frame` (leak detection). */
|
|
17
|
+
componentType?: LockComponentType;
|
|
18
|
+
/** When `true`, disables the lock without unmounting the component. */
|
|
5
19
|
lockDisabled?: boolean;
|
|
20
|
+
/** When `true`, forces focus containment even when it would otherwise be allowed to leave. */
|
|
6
21
|
forceLock?: boolean;
|
|
7
22
|
};
|
|
@@ -1,29 +1,28 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { FocusStyle } from './
|
|
1
|
+
import type { GestureResponderEvent } from 'react-native';
|
|
2
|
+
import type { FocusStyle } from './focusStyle.types';
|
|
3
3
|
import type {
|
|
4
4
|
BaseFocusViewProps,
|
|
5
5
|
BaseKeyboardViewProps,
|
|
6
|
-
|
|
7
|
-
} from './
|
|
8
|
-
|
|
9
|
-
export type KeyboardFocusEvent = NativeSyntheticEvent<{
|
|
10
|
-
isFocused: boolean;
|
|
11
|
-
}>;
|
|
12
|
-
|
|
13
|
-
export type OnFocusChangeFn = (e: KeyboardFocusEvent) => void;
|
|
14
|
-
|
|
15
|
-
export type FocusStateCallbackType = {
|
|
16
|
-
readonly focused: boolean;
|
|
17
|
-
};
|
|
6
|
+
} from './baseKeyboardView.types';
|
|
7
|
+
import type { OnKeyPress } from './keyPress.types';
|
|
18
8
|
|
|
19
9
|
export type FocusViewProps = {
|
|
20
|
-
|
|
10
|
+
/** Key codes that trigger `onPress` / `onLongPress`. Defaults to spacebar and enter. */
|
|
21
11
|
triggerCodes?: number[];
|
|
12
|
+
/** Style applied to the inner component while focused. */
|
|
22
13
|
focusStyle?: FocusStyle;
|
|
14
|
+
/** Called on press — from touch (`GestureResponderEvent`) or physical key ({@link OnKeyPress}). */
|
|
23
15
|
onPress?: (e: GestureResponderEvent | OnKeyPress) => void;
|
|
16
|
+
/** Called on long press — from touch (`GestureResponderEvent`) or physical key ({@link OnKeyPress}). */
|
|
24
17
|
onLongPress?: (e?: GestureResponderEvent | OnKeyPress) => void;
|
|
25
|
-
onFocus?: () => void;
|
|
26
|
-
onBlur?: () => void;
|
|
27
18
|
} & BaseFocusViewProps;
|
|
28
19
|
|
|
29
|
-
export type KeyboardFocusViewProps = BaseKeyboardViewProps &
|
|
20
|
+
export type KeyboardFocusViewProps = BaseKeyboardViewProps &
|
|
21
|
+
FocusViewProps & {
|
|
22
|
+
/**
|
|
23
|
+
* Wraps children in an extra native view.
|
|
24
|
+
*
|
|
25
|
+
* @see https://github.com/anfedorov/react-native-external-keyboard/discussions/63
|
|
26
|
+
*/
|
|
27
|
+
withView?: boolean;
|
|
28
|
+
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import type { ViewProps, ColorValue } from 'react-native';
|
|
2
|
+
import type { OnFocusChangeFn } from './focus.types';
|
|
3
|
+
import type { OnKeyPressFn } from './keyPress.types';
|
|
4
|
+
import type { FocusOrderProps, LockFocusType } from './focusOrder.types';
|
|
5
|
+
|
|
6
|
+
/** Focus props shared by every keyboard-focusable component. */
|
|
7
|
+
export type CommonFocusProps = {
|
|
8
|
+
/** Whether the component can receive keyboard focus. Defaults to `true`. */
|
|
9
|
+
focusable?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Enables the halo highlight ring drawn around the component on focus.
|
|
12
|
+
*
|
|
13
|
+
* @platform ios
|
|
14
|
+
*/
|
|
15
|
+
haloEffect?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Keeps a disabled halo (`haloEffect={false}`) suppressed on views that have
|
|
18
|
+
* a `borderRadius`. UIKit re-arms the halo from the view's
|
|
19
|
+
* `layer.cornerRadius` (set by RN from `borderRadius`) on every layout pass,
|
|
20
|
+
* so the halo can reappear after being disabled; this watches layout changes
|
|
21
|
+
* and resets the focus effect each pass. Only takes effect when
|
|
22
|
+
* `haloEffect={false}`. Alternatively, move `borderRadius` to `containerStyle`
|
|
23
|
+
* so the focused view itself stays square.
|
|
24
|
+
*
|
|
25
|
+
* @platform ios
|
|
26
|
+
*/
|
|
27
|
+
roundedHaloFix?: boolean;
|
|
28
|
+
/** Color used to tint the component on focus. */
|
|
29
|
+
tintColor?: ColorValue;
|
|
30
|
+
/**
|
|
31
|
+
* iOS `focusGroupIdentifier` — the identifier of the focus group this view belongs to.
|
|
32
|
+
*
|
|
33
|
+
* @platform ios
|
|
34
|
+
*/
|
|
35
|
+
groupIdentifier?: string;
|
|
36
|
+
/** Directions in which focus movement is locked. See {@link LockFocusType}. */
|
|
37
|
+
lockFocus?: LockFocusType[];
|
|
38
|
+
/**
|
|
39
|
+
* Enables Android's default focus highlight for the focused native view.
|
|
40
|
+
*
|
|
41
|
+
* @platform android
|
|
42
|
+
* @default true
|
|
43
|
+
*/
|
|
44
|
+
defaultFocusHighlightEnabled?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Cross-platform focus highlight mode. `'none'` disables the focus highlight
|
|
47
|
+
* entirely — the iOS halo and the Android default highlight — equivalent to
|
|
48
|
+
* `haloEffect={false}` / `defaultFocusHighlightEnabled={false}`. `'default'`
|
|
49
|
+
* (the default) keeps the platform highlight.
|
|
50
|
+
*
|
|
51
|
+
* @default 'default'
|
|
52
|
+
*/
|
|
53
|
+
tintType?: 'default' | 'none';
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export type BaseFocusViewProps = {
|
|
57
|
+
/** Treats the view as a transparent focus wrapper rather than a focusable target itself. */
|
|
58
|
+
focusableWrapper?: boolean;
|
|
59
|
+
/** Called when the component gains or loses keyboard focus. */
|
|
60
|
+
onFocusChange?: OnFocusChangeFn;
|
|
61
|
+
/** Handler for the physical key-up event. */
|
|
62
|
+
onKeyUpPress?: OnKeyPressFn;
|
|
63
|
+
/** Handler for the physical key-down event. */
|
|
64
|
+
onKeyDownPress?: OnKeyPressFn;
|
|
65
|
+
/**
|
|
66
|
+
* Handler for long-press events triggered by the context-menu command.
|
|
67
|
+
*
|
|
68
|
+
* @platform ios
|
|
69
|
+
*/
|
|
70
|
+
onContextMenuPress?: () => void;
|
|
71
|
+
/**
|
|
72
|
+
* Bubbling variant of {@link BaseFocusViewProps.onContextMenuPress} — fires for
|
|
73
|
+
* context-menu presses that bubble up from descendants.
|
|
74
|
+
*
|
|
75
|
+
* @platform ios
|
|
76
|
+
*/
|
|
77
|
+
onBubbledContextMenuPress?: () => void;
|
|
78
|
+
/** Whether the component should automatically gain focus on mount. */
|
|
79
|
+
autoFocus?: boolean;
|
|
80
|
+
/** Called when the component gains keyboard focus. */
|
|
81
|
+
onFocus?: () => void;
|
|
82
|
+
/** Called when the component loses keyboard focus. */
|
|
83
|
+
onBlur?: () => void;
|
|
84
|
+
/**
|
|
85
|
+
* Corner radius of the halo ring, in points.
|
|
86
|
+
*
|
|
87
|
+
* @platform ios
|
|
88
|
+
*/
|
|
89
|
+
haloCornerRadius?: number;
|
|
90
|
+
/**
|
|
91
|
+
* Horizontal expansion of the halo ring beyond the view bounds, in points.
|
|
92
|
+
*
|
|
93
|
+
* @platform ios
|
|
94
|
+
*/
|
|
95
|
+
haloExpendX?: number;
|
|
96
|
+
/**
|
|
97
|
+
* Vertical expansion of the halo ring beyond the view bounds, in points.
|
|
98
|
+
*
|
|
99
|
+
* @platform ios
|
|
100
|
+
*/
|
|
101
|
+
haloExpendY?: number;
|
|
102
|
+
/** Enables the context-menu interaction on the view. */
|
|
103
|
+
enableContextMenu?: boolean;
|
|
104
|
+
/** Enables moving screen reader focus to this component automatically. */
|
|
105
|
+
screenAutoA11yFocus?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Delay before screen reader auto-focus is applied. On Android focus can only be
|
|
108
|
+
* applied after render, which may take 300–500 ms.
|
|
109
|
+
*
|
|
110
|
+
* @platform android
|
|
111
|
+
* @default 300
|
|
112
|
+
*/
|
|
113
|
+
screenAutoA11yFocusDelay?: number;
|
|
114
|
+
/**
|
|
115
|
+
* @deprecated No longer has any effect — kept only for backwards compatibility.
|
|
116
|
+
*/
|
|
117
|
+
enableA11yFocus?: boolean;
|
|
118
|
+
} & CommonFocusProps &
|
|
119
|
+
FocusOrderProps;
|
|
120
|
+
|
|
121
|
+
/** Props for `BaseKeyboardView` — standard `ViewProps` plus all focus props. */
|
|
122
|
+
export type BaseKeyboardViewProps = ViewProps & BaseFocusViewProps;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { HostInstance, NativeSyntheticEvent } from 'react-native';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Handler invoked when a view gains or loses keyboard focus.
|
|
5
|
+
*
|
|
6
|
+
* @param isFocused `true` on focus, `false` on blur.
|
|
7
|
+
* @param tag Native view tag of the affected element, when available.
|
|
8
|
+
*/
|
|
9
|
+
export type OnFocusChangeFn = (isFocused: boolean, tag?: number) => void;
|
|
10
|
+
|
|
11
|
+
/** Imperative focus handle exposed via `ref` on keyboard-focusable components. */
|
|
12
|
+
export type KeyboardFocusHandle = {
|
|
13
|
+
/** Moves both physical-keyboard and screen-reader focus to this element. */
|
|
14
|
+
focus: () => void;
|
|
15
|
+
/** Moves physical-keyboard focus to this element. */
|
|
16
|
+
keyboardFocus: () => void;
|
|
17
|
+
/** Moves screen reader (VoiceOver / TalkBack) focus to this element. */
|
|
18
|
+
screenReaderFocus: () => void;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The underlying native view instance augmented with the imperative
|
|
23
|
+
* {@link KeyboardFocusHandle}. Uses RN's `HostInstance` (the host view ref —
|
|
24
|
+
* `measure`, `measureInWindow`, `setNativeProps`, …) rather than the `View`
|
|
25
|
+
* component type, so it resolves correctly under both the legacy and strict
|
|
26
|
+
* (`react-native-strict-api`) RN type sets.
|
|
27
|
+
*/
|
|
28
|
+
export type KeyboardFocus = HostInstance & KeyboardFocusHandle;
|
|
29
|
+
|
|
30
|
+
/** Alias of {@link KeyboardFocus}. */
|
|
31
|
+
export type BaseKeyboardViewType = KeyboardFocus;
|
|
32
|
+
|
|
33
|
+
/** Native event payload emitted by the view's focus-change callback. */
|
|
34
|
+
export type KeyboardFocusEvent = NativeSyntheticEvent<{
|
|
35
|
+
isFocused: boolean;
|
|
36
|
+
target?: number;
|
|
37
|
+
}>;
|
|
38
|
+
|
|
39
|
+
/** Handler receiving the raw {@link KeyboardFocusEvent} from the native view. */
|
|
40
|
+
export type NativeFocusChangeHandler = (e: KeyboardFocusEvent) => void;
|