react-native-external-keyboard 0.9.1 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +95 -600
- package/android/build.gradle +0 -18
- 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/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 +54 -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 -7
- 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/ExternalKeyboardViewNativeComponent.ts +6 -4
- package/lib/commonjs/nativeSpec/TextInputFocusWrapperNativeComponent.ts +2 -0
- 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/ExternalKeyboardViewNativeComponent.ts +6 -4
- package/lib/module/nativeSpec/TextInputFocusWrapperNativeComponent.ts +2 -0
- 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 +19 -125
- package/lib/typescript/src/components/BaseKeyboardView/BaseKeyboardView.d.ts.map +1 -1
- package/lib/typescript/src/components/KeyboardExtendedInput/KeyboardExtendedInput.d.ts +13 -204
- 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/FocusFrame/FocusFrame.d.ts +1 -1
- package/lib/typescript/src/components/KeyboardFocusLock/FocusFrame/FocusFrame.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 +2 -2
- 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 +20 -133
- package/lib/typescript/src/components/KeyboardFocusView/KeyboardFocusView.d.ts.map +1 -1
- package/lib/typescript/src/components/Touchable/Pressable.d.ts +3 -160
- 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/context/OrderFocusContext.d.ts +1 -1
- package/lib/typescript/src/context/OrderFocusContext.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +48 -10
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/nativeSpec/ExternalKeyboardLockViewNativeComponent.d.ts +1 -3
- package/lib/typescript/src/nativeSpec/ExternalKeyboardLockViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/nativeSpec/ExternalKeyboardViewNativeComponent.d.ts +5 -6
- package/lib/typescript/src/nativeSpec/ExternalKeyboardViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/nativeSpec/KeyboardFocusGroupNativeComponent.d.ts +1 -3
- package/lib/typescript/src/nativeSpec/KeyboardFocusGroupNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/nativeSpec/NativeExternalKeyboardModule.d.ts +1 -1
- package/lib/typescript/src/nativeSpec/TextInputFocusWrapperNativeComponent.d.ts +3 -3
- 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 +44 -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 +7 -1017
- package/lib/typescript/src/utils/useFocusStyle.d.ts.map +1 -1
- package/lib/typescript/src/utils/useKeyboardFocusContainer.d.ts +34 -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 -8
- package/lib/typescript/src/utils/withKeyboardFocus.d.ts.map +1 -1
- package/package.json +10 -5
- 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/ExternalKeyboardViewNativeComponent.ts +6 -4
- package/src/nativeSpec/TextInputFocusWrapperNativeComponent.ts +2 -0
- 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 +49 -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/src/types/index.ts
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
export type {
|
|
2
|
+
FocusViewProps,
|
|
2
3
|
KeyboardFocusViewProps,
|
|
3
|
-
OnFocusChangeFn,
|
|
4
4
|
} from './KeyboardFocusView.types';
|
|
5
|
-
export type {
|
|
5
|
+
export type { KeyboardFocusLockProps } from './KeyboardFocusLock.types';
|
|
6
|
+
export { LockComponentType } from './KeyboardFocusLock.types';
|
|
7
|
+
export type {
|
|
8
|
+
OnFocusChangeFn,
|
|
9
|
+
KeyboardFocus,
|
|
10
|
+
BaseKeyboardViewType,
|
|
11
|
+
KeyboardFocusEvent,
|
|
12
|
+
NativeFocusChangeHandler,
|
|
13
|
+
} from './focus.types';
|
|
14
|
+
export type { OnKeyPress, OnKeyPressFn } from './keyPress.types';
|
|
15
|
+
export type { FocusOrderProps, LockFocusType } from './focusOrder.types';
|
|
16
|
+
export { LockFocusEnum } from './focusOrder.types';
|
|
17
|
+
export type {
|
|
18
|
+
BaseFocusViewProps,
|
|
19
|
+
BaseKeyboardViewProps,
|
|
20
|
+
} from './baseKeyboardView.types';
|
|
21
|
+
export type { FocusStateCallbackType, FocusStyle } from './focusStyle.types';
|
|
22
|
+
export type {
|
|
23
|
+
ExtraKeyboardProps,
|
|
24
|
+
KeyboardInputProps,
|
|
25
|
+
KeyboardInputPropsDeclaration,
|
|
26
|
+
} from './keyboardInput.types';
|
|
27
|
+
export type {
|
|
28
|
+
WithKeyboardFocusProps,
|
|
29
|
+
WithKeyboardFocusPropsWithRef,
|
|
30
|
+
KeyboardFocusableComponent,
|
|
31
|
+
KeyboardFocusableComponentDeclaration,
|
|
32
|
+
WithKeyboardProps,
|
|
33
|
+
KeyboardPressType,
|
|
34
|
+
ChildrenRenderState,
|
|
35
|
+
} from './withKeyboardFocus.types';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { NativeSyntheticEvent } from 'react-native';
|
|
2
|
+
import type { KeyPress } from '../nativeSpec/ExternalKeyboardViewNativeComponent';
|
|
3
|
+
|
|
4
|
+
/** Native event payload for a physical key press (key down / key up). */
|
|
5
|
+
export type OnKeyPress = NativeSyntheticEvent<KeyPress>;
|
|
6
|
+
|
|
7
|
+
/** Handler receiving a physical {@link OnKeyPress} event. */
|
|
8
|
+
export type OnKeyPressFn = (e: OnKeyPress) => void;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type TextInputProps,
|
|
3
|
+
type StyleProp,
|
|
4
|
+
type ViewStyle,
|
|
5
|
+
} from 'react-native';
|
|
6
|
+
|
|
7
|
+
import type { FocusStyle } from './focusStyle.types';
|
|
8
|
+
import type { FocusOrderProps } from './focusOrder.types';
|
|
9
|
+
import type { CommonFocusProps } from './baseKeyboardView.types';
|
|
10
|
+
|
|
11
|
+
/** Keyboard-focus props added on top of React Native's `TextInputProps`. */
|
|
12
|
+
export type ExtraKeyboardProps = {
|
|
13
|
+
/**
|
|
14
|
+
* How the input acquires focus.
|
|
15
|
+
*
|
|
16
|
+
* - `'default'` — platform default (Android focuses the input; iOS requires a press).
|
|
17
|
+
* - `'press'` — press the spacebar to focus the input.
|
|
18
|
+
* - `'auto'` — focus automatically; keyboard focus targets the input.
|
|
19
|
+
*/
|
|
20
|
+
focusType?: 'default' | 'press' | 'auto';
|
|
21
|
+
/**
|
|
22
|
+
* How the input blurs when keyboard focus moves away.
|
|
23
|
+
*
|
|
24
|
+
* - `'default'` — keep typing allowed while focus is on another component.
|
|
25
|
+
* - `'disable'` — blur the input when focus moves away.
|
|
26
|
+
* - `'auto'` — platform-managed blur behavior.
|
|
27
|
+
*
|
|
28
|
+
* @platform ios
|
|
29
|
+
*/
|
|
30
|
+
blurType?: 'default' | 'disable' | 'auto';
|
|
31
|
+
/** Style for the container wrapping the input. */
|
|
32
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
33
|
+
/** Called when the input gains or loses keyboard focus. */
|
|
34
|
+
onFocusChange?: (isFocused: boolean) => void;
|
|
35
|
+
/** Style applied to the inner `TextInput` while focused. */
|
|
36
|
+
focusStyle?: FocusStyle;
|
|
37
|
+
/** Style applied to the container while focused. */
|
|
38
|
+
containerFocusStyle?: FocusStyle;
|
|
39
|
+
/** Behavior of the submit / return key. */
|
|
40
|
+
submitBehavior?: string;
|
|
41
|
+
} & CommonFocusProps &
|
|
42
|
+
FocusOrderProps;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* `TextInput` props that differ across React Native versions and so are loosened
|
|
46
|
+
* to also accept `null` for backward/forward compatibility.
|
|
47
|
+
*/
|
|
48
|
+
type IgnoreForCompatibility =
|
|
49
|
+
| 'rejectResponderTermination'
|
|
50
|
+
| 'selectionHandleColor'
|
|
51
|
+
| 'cursorColor'
|
|
52
|
+
| 'maxFontSizeMultiplier';
|
|
53
|
+
|
|
54
|
+
type CompatibleInputProp<
|
|
55
|
+
TextInputPropsType extends object,
|
|
56
|
+
CompatibilityProp extends IgnoreForCompatibility
|
|
57
|
+
> = CompatibilityProp extends keyof TextInputPropsType
|
|
58
|
+
? TextInputPropsType[CompatibilityProp]
|
|
59
|
+
: CompatibilityProp extends keyof TextInputProps
|
|
60
|
+
? TextInputProps[CompatibilityProp]
|
|
61
|
+
: never;
|
|
62
|
+
|
|
63
|
+
type ReactNativeInputCompatibility<
|
|
64
|
+
TextInputPropsType extends object = TextInputProps
|
|
65
|
+
> = Omit<TextInputPropsType, IgnoreForCompatibility> & {
|
|
66
|
+
[CompatibilityProp in IgnoreForCompatibility]?: CompatibleInputProp<
|
|
67
|
+
TextInputPropsType,
|
|
68
|
+
CompatibilityProp
|
|
69
|
+
> | null;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Generic form of {@link KeyboardInputProps}. Combines a (version-compatible)
|
|
74
|
+
* `TextInputProps` shape with the library's {@link ExtraKeyboardProps}.
|
|
75
|
+
*/
|
|
76
|
+
export type KeyboardInputPropsDeclaration<
|
|
77
|
+
TextInputPropsType extends object = TextInputProps
|
|
78
|
+
> = ReactNativeInputCompatibility<TextInputPropsType> & ExtraKeyboardProps;
|
|
79
|
+
|
|
80
|
+
/** Props for `KeyboardExtendedInput` — RN `TextInputProps` plus keyboard-focus props. */
|
|
81
|
+
export type KeyboardInputProps = KeyboardInputPropsDeclaration<TextInputProps>;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import type { PressableProps, View, ViewProps } from 'react-native';
|
|
2
|
+
import type { FocusStyle } from './focusStyle.types';
|
|
3
|
+
import type { KeyboardFocus } from './focus.types';
|
|
4
|
+
import type { OnKeyPress } from './keyPress.types';
|
|
5
|
+
import type { FocusViewProps } from './KeyboardFocusView.types';
|
|
6
|
+
import type { RefAttributes } from 'react';
|
|
7
|
+
|
|
8
|
+
/** Fallback press handler used when the wrapped component declares no matching prop. */
|
|
9
|
+
type KeyboardPressHandler = (e?: OnKeyPress) => void;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Resolves a press-handler prop type: reuses the wrapped component's own signature
|
|
13
|
+
* if it declares `PropName`, otherwise falls back to {@link KeyboardPressHandler}.
|
|
14
|
+
*/
|
|
15
|
+
type PressHandlerProp<
|
|
16
|
+
ComponentProps extends object,
|
|
17
|
+
PropName extends 'onPress' | 'onLongPress' | 'onPressIn' | 'onPressOut'
|
|
18
|
+
> = PropName extends keyof ComponentProps
|
|
19
|
+
? ComponentProps[PropName]
|
|
20
|
+
: KeyboardPressHandler;
|
|
21
|
+
|
|
22
|
+
/** Picks the wrapped component's prop type for `PropName`, or `unknown` if absent. */
|
|
23
|
+
type PickProp<
|
|
24
|
+
ComponentProps extends object,
|
|
25
|
+
PropName extends string
|
|
26
|
+
> = PropName extends keyof ComponentProps ? ComponentProps[PropName] : unknown;
|
|
27
|
+
|
|
28
|
+
/** A component constructor that {@link WithKeyboardFocusProps} can enhance. */
|
|
29
|
+
export type KeyboardFocusableComponent<ComponentProps extends object> =
|
|
30
|
+
React.JSXElementConstructor<ComponentProps>;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Press and focus callbacks layered onto the wrapped component. Press handlers reuse
|
|
34
|
+
* the wrapped component's own signatures where possible; `onComponent{Focus,Blur}`
|
|
35
|
+
* forward to the wrapped component's native `onFocus` / `onBlur`.
|
|
36
|
+
*/
|
|
37
|
+
export type KeyboardPressType<ComponentProps extends object> = {
|
|
38
|
+
/** Called on press (touch or physical key). */
|
|
39
|
+
onPress?: PressHandlerProp<ComponentProps, 'onPress'>;
|
|
40
|
+
/** Called on long press (touch or physical key). */
|
|
41
|
+
onLongPress?: PressHandlerProp<ComponentProps, 'onLongPress'>;
|
|
42
|
+
/** Called when a press begins. */
|
|
43
|
+
onPressIn?: PressHandlerProp<ComponentProps, 'onPressIn'>;
|
|
44
|
+
/** Called when a press ends. */
|
|
45
|
+
onPressOut?: PressHandlerProp<ComponentProps, 'onPressOut'>;
|
|
46
|
+
/** Forwarded to the wrapped component's own `onFocus`. */
|
|
47
|
+
onComponentFocus?: PickProp<ComponentProps, 'onFocus'>;
|
|
48
|
+
/** Forwarded to the wrapped component's own `onBlur`. */
|
|
49
|
+
onComponentBlur?: PickProp<ComponentProps, 'onBlur'>;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/** Extracts the state argument from a component's children render prop, or `never`. */
|
|
53
|
+
type ExtractRenderPropState<T> = T extends (state: infer S) => any ? S : never;
|
|
54
|
+
|
|
55
|
+
/** The render-prop state of the wrapped component's `children`, or `never` if it has none. */
|
|
56
|
+
export type ChildrenRenderState<CP extends object> = 'children' extends keyof CP
|
|
57
|
+
? ExtractRenderPropState<NonNullable<CP['children']>>
|
|
58
|
+
: never;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* `renderContent` signature — receives the wrapped component's own render-prop state
|
|
62
|
+
* merged with `{ focused }`. Resolves to `never` when the component has no render-prop children.
|
|
63
|
+
*/
|
|
64
|
+
type RenderContentProp<CP extends object> =
|
|
65
|
+
ChildrenRenderState<CP> extends never
|
|
66
|
+
? never
|
|
67
|
+
: (
|
|
68
|
+
state: ChildrenRenderState<CP> & { focused: boolean }
|
|
69
|
+
) => React.ReactNode;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* `renderFocusable` signature — receives only `{ focused }`. Use it on components
|
|
73
|
+
* (e.g. `TouchableOpacity`) that don't expose a render-prop `children`.
|
|
74
|
+
*/
|
|
75
|
+
type RenderFocusableProp = (state: { focused: boolean }) => React.ReactNode;
|
|
76
|
+
|
|
77
|
+
// `renderContent` and `renderFocusable` are conceptually mutually exclusive, but
|
|
78
|
+
// the public slot is kept as a plain (non-discriminated) object so consumer-side
|
|
79
|
+
// `Omit`/`Pick` over the prop type don't collapse a union and break assignability.
|
|
80
|
+
// If both are passed, `renderContent` wins at runtime (see useRenderedChildren).
|
|
81
|
+
// `renderContent` still resolves to `never` for components without render-prop
|
|
82
|
+
// children, so it remains unassignable on those.
|
|
83
|
+
type RenderSlot<CP extends object> = {
|
|
84
|
+
renderContent?: RenderContentProp<CP>;
|
|
85
|
+
renderFocusable?: RenderFocusableProp;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
type WithKeyboardBaseProps<ViewType, ViewStyleType> = {
|
|
89
|
+
/**
|
|
90
|
+
* Enables the `pressed` style handler for custom components. Always effectively
|
|
91
|
+
* `true` for the standard `Pressable`.
|
|
92
|
+
*
|
|
93
|
+
* @default false
|
|
94
|
+
*/
|
|
95
|
+
withPressedStyle?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Android only. Physical-keyboard activation (Enter / Space / DPad-center)
|
|
98
|
+
* does not flow through the touch responder, so the wrapped component's
|
|
99
|
+
* `pressed` state stays `false` for keyboard presses. When enabled, the
|
|
100
|
+
* press is tracked from the key down/up events and merged into the `pressed`
|
|
101
|
+
* value passed to `renderContent` and to the `style({ pressed })` function.
|
|
102
|
+
* No-op on iOS, where native focus already drives `pressed`.
|
|
103
|
+
*/
|
|
104
|
+
androidKeyboardPressState?: boolean;
|
|
105
|
+
/** Style for the container wrapping the component. */
|
|
106
|
+
containerStyle?: ViewStyleType | ViewProps['style'];
|
|
107
|
+
/** Style applied to the container while focused. */
|
|
108
|
+
containerFocusStyle?: FocusStyle;
|
|
109
|
+
/** Ref to the wrapped component instance. */
|
|
110
|
+
componentRef?: React.RefObject<ViewType>;
|
|
111
|
+
/** Style for the wrapped component. */
|
|
112
|
+
style?: PressableProps['style'];
|
|
113
|
+
/** Called when the component loses keyboard focus. */
|
|
114
|
+
onBlur?: (() => void) | null;
|
|
115
|
+
/** Called when the component gains keyboard focus. */
|
|
116
|
+
onFocus?: (() => void) | null;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* The keyboard-focus-specific props added by {@link WithKeyboardFocusProps}: container
|
|
121
|
+
* styling, refs, focus callbacks, and the mutually-exclusive `renderContent` /
|
|
122
|
+
* `renderFocusable` slot.
|
|
123
|
+
*/
|
|
124
|
+
export type WithKeyboardProps<
|
|
125
|
+
ViewType = View,
|
|
126
|
+
ViewStyleType = unknown,
|
|
127
|
+
ComponentProps extends object = {}
|
|
128
|
+
> = WithKeyboardBaseProps<ViewType, ViewStyleType> & RenderSlot<ComponentProps>;
|
|
129
|
+
|
|
130
|
+
type KeyboardFocusBaseProps = Omit<
|
|
131
|
+
FocusViewProps,
|
|
132
|
+
'onPress' | 'onLongPress' | 'onBlur' | 'onFocus'
|
|
133
|
+
>;
|
|
134
|
+
|
|
135
|
+
type MergeProps<BaseProps extends object, OverrideProps extends object> = Omit<
|
|
136
|
+
BaseProps,
|
|
137
|
+
keyof OverrideProps
|
|
138
|
+
> &
|
|
139
|
+
OverrideProps;
|
|
140
|
+
|
|
141
|
+
type KeyboardFocusOverrideProps<
|
|
142
|
+
ComponentProps extends object,
|
|
143
|
+
ViewStyleType,
|
|
144
|
+
ViewType = View
|
|
145
|
+
> = KeyboardPressType<ComponentProps> &
|
|
146
|
+
KeyboardFocusBaseProps &
|
|
147
|
+
WithKeyboardProps<ViewType, ViewStyleType, ComponentProps>;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Full prop type for a `withKeyboardFocus`-wrapped component: the wrapped component's
|
|
151
|
+
* own props, with the library's press/focus/order props merged in (library props win
|
|
152
|
+
* on conflict).
|
|
153
|
+
*/
|
|
154
|
+
export type WithKeyboardFocusProps<
|
|
155
|
+
ComponentProps extends object,
|
|
156
|
+
ViewStyleType,
|
|
157
|
+
ViewType = View
|
|
158
|
+
> = MergeProps<
|
|
159
|
+
ComponentProps,
|
|
160
|
+
KeyboardFocusOverrideProps<ComponentProps, ViewStyleType, ViewType>
|
|
161
|
+
>;
|
|
162
|
+
|
|
163
|
+
/** {@link WithKeyboardFocusProps} plus a `ref` exposing the {@link KeyboardFocus} handle. */
|
|
164
|
+
export type WithKeyboardFocusPropsWithRef<
|
|
165
|
+
ComponentProps extends object,
|
|
166
|
+
ViewStyleType,
|
|
167
|
+
ViewType = View
|
|
168
|
+
> = WithKeyboardFocusProps<ComponentProps, ViewStyleType, ViewType> &
|
|
169
|
+
RefAttributes<KeyboardFocus>;
|
|
170
|
+
|
|
171
|
+
/** Type of the component returned by `withKeyboardFocus`. */
|
|
172
|
+
export type KeyboardFocusableComponentDeclaration<
|
|
173
|
+
ComponentProps extends object,
|
|
174
|
+
ViewStyleType,
|
|
175
|
+
ViewType = View
|
|
176
|
+
> = React.JSXElementConstructor<
|
|
177
|
+
WithKeyboardFocusPropsWithRef<ComponentProps, ViewStyleType, ViewType>
|
|
178
|
+
>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { LockFocusEnum, type LockFocusType } from '../types';
|
|
2
|
+
|
|
3
|
+
enum BITS {
|
|
4
|
+
BIT_01 = 0b1,
|
|
5
|
+
BIT_02 = 0b10,
|
|
6
|
+
BIT_03 = 0b100,
|
|
7
|
+
BIT_04 = 0b1000,
|
|
8
|
+
BIT_05 = 0b10000,
|
|
9
|
+
BIT_06 = 0b100000,
|
|
10
|
+
BIT_07 = 0b1000000,
|
|
11
|
+
BIT_08 = 0b10000000,
|
|
12
|
+
BIT_09 = 0b100000000,
|
|
13
|
+
BIT_10 = 0b1000000000,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const focusBinaryValue: Record<LockFocusEnum, number> = {
|
|
17
|
+
[LockFocusEnum.Up]: BITS.BIT_01,
|
|
18
|
+
[LockFocusEnum.Down]: BITS.BIT_02,
|
|
19
|
+
[LockFocusEnum.Left]: BITS.BIT_03,
|
|
20
|
+
[LockFocusEnum.Right]: BITS.BIT_04,
|
|
21
|
+
[LockFocusEnum.Forward]: BITS.BIT_05,
|
|
22
|
+
[LockFocusEnum.Backward]: BITS.BIT_06,
|
|
23
|
+
[LockFocusEnum.First]: BITS.BIT_09,
|
|
24
|
+
[LockFocusEnum.Last]: BITS.BIT_10,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const mapLockFocus = (values: LockFocusType[] | undefined): number => {
|
|
28
|
+
if (!values || !values.length) return 0;
|
|
29
|
+
// eslint-disable-next-line no-bitwise
|
|
30
|
+
return values.reduce((acc, item) => acc | focusBinaryValue[item], 0);
|
|
31
|
+
};
|
|
@@ -1,36 +1,22 @@
|
|
|
1
1
|
import { useState, useMemo, useCallback } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import type { PressableProps } from 'react-native';
|
|
3
3
|
import type { FocusStyle } from '../types';
|
|
4
|
-
import type { TintType } from '../types/WithKeyboardFocus';
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
background: true,
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const DEFAULT_BACKGROUND_TINT = '#dce3f9';
|
|
11
|
-
|
|
12
|
-
type UseFocusStyleProps<C> = {
|
|
5
|
+
type UseFocusStyleProps = {
|
|
13
6
|
focusStyle?: FocusStyle;
|
|
14
7
|
containerFocusStyle?: FocusStyle;
|
|
15
8
|
onFocusChange?: (isFocused: boolean) => void;
|
|
16
|
-
tintColor?: ColorValue;
|
|
17
|
-
tintType?: TintType;
|
|
18
9
|
style?: PressableProps['style'];
|
|
19
|
-
|
|
20
|
-
withPressedStyle?: boolean;
|
|
21
|
-
defaultFocusHighlightEnabled?: boolean;
|
|
10
|
+
pressedStyleSignature?: boolean;
|
|
22
11
|
};
|
|
23
12
|
|
|
24
|
-
export const useFocusStyle =
|
|
13
|
+
export const useFocusStyle = ({
|
|
25
14
|
focusStyle,
|
|
26
15
|
onFocusChange,
|
|
27
16
|
containerFocusStyle,
|
|
28
|
-
tintColor,
|
|
29
|
-
tintType = 'default',
|
|
30
17
|
style,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}: UseFocusStyleProps<C>) => {
|
|
18
|
+
pressedStyleSignature = false,
|
|
19
|
+
}: UseFocusStyleProps) => {
|
|
34
20
|
const [focused, setFocusStatus] = useState(false);
|
|
35
21
|
|
|
36
22
|
const onFocusChangeHandler = useCallback(
|
|
@@ -47,19 +33,7 @@ export const useFocusStyle = <C extends {}>({
|
|
|
47
33
|
return focused ? specificStyle : undefined;
|
|
48
34
|
}, [focusStyle, focused]);
|
|
49
35
|
|
|
50
|
-
const hoverColor = useMemo(
|
|
51
|
-
() => ({
|
|
52
|
-
backgroundColor: tintColor,
|
|
53
|
-
}),
|
|
54
|
-
[tintColor]
|
|
55
|
-
);
|
|
56
|
-
|
|
57
36
|
const containerFocusedStyle = useMemo(() => {
|
|
58
|
-
if (backgroundTintMap[tintType] && !containerFocusStyle) {
|
|
59
|
-
return focused
|
|
60
|
-
? { backgroundColor: tintColor ?? DEFAULT_BACKGROUND_TINT }
|
|
61
|
-
: undefined;
|
|
62
|
-
}
|
|
63
37
|
if (!containerFocusStyle) return undefined;
|
|
64
38
|
|
|
65
39
|
const specificStyle =
|
|
@@ -68,11 +42,11 @@ export const useFocusStyle = <C extends {}>({
|
|
|
68
42
|
: containerFocusStyle;
|
|
69
43
|
|
|
70
44
|
return focused ? specificStyle : undefined;
|
|
71
|
-
}, [containerFocusStyle, focused
|
|
45
|
+
}, [containerFocusStyle, focused]);
|
|
72
46
|
|
|
73
|
-
const
|
|
74
|
-
() => [style, componentFocusedStyle],
|
|
75
|
-
[style, componentFocusedStyle]
|
|
47
|
+
const defaultComponentStyle = useMemo(
|
|
48
|
+
() => (pressedStyleSignature ? undefined : [style, componentFocusedStyle]),
|
|
49
|
+
[pressedStyleSignature, style, componentFocusedStyle]
|
|
76
50
|
);
|
|
77
51
|
const styleHandlerPressable = useCallback(
|
|
78
52
|
({ pressed }: { pressed: boolean }) => {
|
|
@@ -85,17 +59,15 @@ export const useFocusStyle = <C extends {}>({
|
|
|
85
59
|
[componentFocusedStyle, style]
|
|
86
60
|
);
|
|
87
61
|
|
|
88
|
-
const componentStyleViewStyle =
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
: dafaultComponentStyle;
|
|
62
|
+
const componentStyleViewStyle = pressedStyleSignature
|
|
63
|
+
? styleHandlerPressable
|
|
64
|
+
: defaultComponentStyle;
|
|
92
65
|
|
|
93
66
|
return {
|
|
94
67
|
componentStyleViewStyle,
|
|
95
68
|
componentFocusedStyle,
|
|
96
69
|
containerFocusedStyle,
|
|
97
70
|
onFocusChangeHandler,
|
|
98
|
-
hoverColor,
|
|
99
71
|
focused,
|
|
100
72
|
};
|
|
101
73
|
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { useCallback, useMemo } from 'react';
|
|
2
|
+
import type { PressableProps } from 'react-native';
|
|
3
|
+
import { useFocusStyle } from './useFocusStyle';
|
|
4
|
+
import { useKeyboardPress } from './useKeyboardPress/useKeyboardPress';
|
|
5
|
+
import { useKeyboardPressState } from './useKeyboardPressState';
|
|
6
|
+
import type { FocusStyle, OnKeyPressFn } from '../types';
|
|
7
|
+
|
|
8
|
+
type AnyPressHandler = (event?: any) => void;
|
|
9
|
+
|
|
10
|
+
export type UseKeyboardFocusContainerProps<
|
|
11
|
+
TPress extends AnyPressHandler = AnyPressHandler,
|
|
12
|
+
TKeyOnlyPress extends AnyPressHandler = AnyPressHandler
|
|
13
|
+
> = {
|
|
14
|
+
focusStyle?: FocusStyle;
|
|
15
|
+
containerFocusStyle?: FocusStyle;
|
|
16
|
+
onFocusChange?: (isFocused: boolean) => void;
|
|
17
|
+
style?: PressableProps['style'];
|
|
18
|
+
pressedStyleSignature?: boolean;
|
|
19
|
+
onKeyUpPress?: OnKeyPressFn;
|
|
20
|
+
onKeyDownPress?: OnKeyPressFn;
|
|
21
|
+
onPress?: TPress;
|
|
22
|
+
onLongPress?: TPress;
|
|
23
|
+
onPressIn?: TKeyOnlyPress;
|
|
24
|
+
onPressOut?: TKeyOnlyPress;
|
|
25
|
+
triggerCodes?: number[];
|
|
26
|
+
androidKeyboardPressState?: boolean;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const useKeyboardFocusContainer = <
|
|
30
|
+
TPress extends AnyPressHandler = AnyPressHandler,
|
|
31
|
+
TKeyOnlyPress extends AnyPressHandler = AnyPressHandler
|
|
32
|
+
>({
|
|
33
|
+
focusStyle,
|
|
34
|
+
containerFocusStyle,
|
|
35
|
+
onFocusChange,
|
|
36
|
+
style,
|
|
37
|
+
pressedStyleSignature,
|
|
38
|
+
onKeyUpPress,
|
|
39
|
+
onKeyDownPress,
|
|
40
|
+
onPress,
|
|
41
|
+
onLongPress,
|
|
42
|
+
onPressIn,
|
|
43
|
+
onPressOut,
|
|
44
|
+
triggerCodes,
|
|
45
|
+
androidKeyboardPressState = false,
|
|
46
|
+
}: UseKeyboardFocusContainerProps<TPress, TKeyOnlyPress>) => {
|
|
47
|
+
const keyboardPress = useKeyboardPressState({
|
|
48
|
+
enabled: androidKeyboardPressState,
|
|
49
|
+
onPressIn,
|
|
50
|
+
onPressOut,
|
|
51
|
+
onFocusChange,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const {
|
|
55
|
+
focused,
|
|
56
|
+
containerFocusedStyle,
|
|
57
|
+
componentStyleViewStyle,
|
|
58
|
+
onFocusChangeHandler,
|
|
59
|
+
} = useFocusStyle({
|
|
60
|
+
onFocusChange: keyboardPress.onFocusChange,
|
|
61
|
+
focusStyle,
|
|
62
|
+
containerFocusStyle,
|
|
63
|
+
style,
|
|
64
|
+
pressedStyleSignature,
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const { onKeyUpPressHandler, onKeyDownPressHandler, onPressHandler } =
|
|
68
|
+
useKeyboardPress({
|
|
69
|
+
onKeyUpPress,
|
|
70
|
+
onKeyDownPress,
|
|
71
|
+
onPress,
|
|
72
|
+
onLongPress,
|
|
73
|
+
onPressIn: keyboardPress.onPressIn as typeof onPressIn,
|
|
74
|
+
onPressOut: keyboardPress.onPressOut as typeof onPressOut,
|
|
75
|
+
triggerCodes,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const { applyPressedStyle } = keyboardPress;
|
|
79
|
+
const componentStyle = useMemo(
|
|
80
|
+
() => applyPressedStyle(componentStyleViewStyle),
|
|
81
|
+
[applyPressedStyle, componentStyleViewStyle]
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
const onContextMenuHandler = useCallback(() => {
|
|
85
|
+
onLongPress?.();
|
|
86
|
+
}, [onLongPress]);
|
|
87
|
+
|
|
88
|
+
const enableContextMenu = Boolean(onLongPress);
|
|
89
|
+
|
|
90
|
+
return {
|
|
91
|
+
focused,
|
|
92
|
+
keyboardPressed: keyboardPress.pressed,
|
|
93
|
+
containerFocusedStyle,
|
|
94
|
+
componentStyleViewStyle: componentStyle,
|
|
95
|
+
onFocusChangeHandler,
|
|
96
|
+
onKeyUpPressHandler,
|
|
97
|
+
onKeyDownPressHandler,
|
|
98
|
+
onPressHandler,
|
|
99
|
+
onContextMenuHandler,
|
|
100
|
+
enableContextMenu,
|
|
101
|
+
};
|
|
102
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useCallback, useMemo, useRef } from 'react';
|
|
2
2
|
import type { GestureResponderEvent } from 'react-native';
|
|
3
3
|
import type { UseKeyboardPressProps } from './useKeyboardPress.types';
|
|
4
|
-
import type { OnKeyPress, OnKeyPressFn } from '../../types
|
|
4
|
+
import type { OnKeyPress, OnKeyPressFn } from '../../types';
|
|
5
5
|
|
|
6
6
|
export const ANDROID_SPACE_KEY_CODE = 62;
|
|
7
7
|
export const ANDROID_DPAD_CENTER_CODE = 23;
|
|
@@ -17,7 +17,7 @@ const useDebouncedCallback = <T extends (...args: any[]) => void>(
|
|
|
17
17
|
callback: T,
|
|
18
18
|
delay: number
|
|
19
19
|
) => {
|
|
20
|
-
const timeoutRef = useRef<ReturnType<typeof setTimeout
|
|
20
|
+
const timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
21
21
|
return useCallback(
|
|
22
22
|
(...args: Parameters<T>) => {
|
|
23
23
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
@@ -40,7 +40,6 @@ export const useKeyboardPress = <
|
|
|
40
40
|
onPress,
|
|
41
41
|
onLongPress,
|
|
42
42
|
triggerCodes = ANDROID_TRIGGER_CODES,
|
|
43
|
-
disabled = false,
|
|
44
43
|
}: UseKeyboardPressProps<T, K>) => {
|
|
45
44
|
const isLongPressRef = useRef(false);
|
|
46
45
|
|
|
@@ -65,7 +64,6 @@ export const useKeyboardPress = <
|
|
|
65
64
|
onPressOut?.(e as unknown as GestureResponderEvent);
|
|
66
65
|
onKeyUpPress?.(e);
|
|
67
66
|
|
|
68
|
-
if (disabled) return;
|
|
69
67
|
if (triggerCodes.includes(keyCode)) {
|
|
70
68
|
if (isLongPress) {
|
|
71
69
|
isLongPressRef.current = true;
|
|
@@ -73,19 +71,18 @@ export const useKeyboardPress = <
|
|
|
73
71
|
}
|
|
74
72
|
}
|
|
75
73
|
},
|
|
76
|
-
[onPressOut, onKeyUpPress, triggerCodes, debouncedOnPress
|
|
74
|
+
[onPressOut, onKeyUpPress, triggerCodes, debouncedOnPress]
|
|
77
75
|
);
|
|
78
76
|
|
|
79
77
|
const onKeyDownPressHandler = useMemo(() => {
|
|
80
78
|
if (!onPressIn) return onKeyDownPress;
|
|
81
79
|
return (e: OnKeyPress) => {
|
|
82
80
|
onKeyDownPress?.(e);
|
|
83
|
-
if (disabled) return;
|
|
84
81
|
if (triggerCodes.includes(e.nativeEvent.keyCode)) {
|
|
85
82
|
onPressIn?.(e as unknown as GestureResponderEvent);
|
|
86
83
|
}
|
|
87
84
|
};
|
|
88
|
-
}, [onKeyDownPress, onPressIn, triggerCodes
|
|
85
|
+
}, [onKeyDownPress, onPressIn, triggerCodes]);
|
|
89
86
|
|
|
90
87
|
const onPressHandler = useCallback(
|
|
91
88
|
(event: GestureResponderEvent) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import type { UseKeyboardPressProps } from './useKeyboardPress.types';
|
|
3
|
-
import type { OnKeyPress } from '../../types
|
|
3
|
+
import type { OnKeyPress } from '../../types';
|
|
4
4
|
import type { GestureResponderEvent } from 'react-native';
|
|
5
5
|
|
|
6
6
|
const IOS_SPACE_KEY = 44;
|
|
@@ -19,12 +19,10 @@ export const useKeyboardPress = <
|
|
|
19
19
|
onPressOut,
|
|
20
20
|
onLongPress,
|
|
21
21
|
triggerCodes = IOS_TRIGGER_CODES,
|
|
22
|
-
disabled = false,
|
|
23
22
|
}: UseKeyboardPressProps<T, K>) => {
|
|
24
23
|
const onKeyUpPressHandler = useMemo(() => {
|
|
25
24
|
return (e: OnKeyPress) => {
|
|
26
25
|
onKeyUpPress?.(e);
|
|
27
|
-
if (disabled) return;
|
|
28
26
|
|
|
29
27
|
if (triggerCodes.includes(e.nativeEvent.keyCode)) {
|
|
30
28
|
onPressOut?.(e);
|
|
@@ -35,18 +33,17 @@ export const useKeyboardPress = <
|
|
|
35
33
|
}
|
|
36
34
|
}
|
|
37
35
|
};
|
|
38
|
-
}, [onKeyUpPress, onLongPress, onPress, onPressOut, triggerCodes
|
|
36
|
+
}, [onKeyUpPress, onLongPress, onPress, onPressOut, triggerCodes]);
|
|
39
37
|
|
|
40
38
|
const onKeyDownPressHandler = useMemo(() => {
|
|
41
39
|
if (!onPressIn) return onKeyDownPress;
|
|
42
40
|
return (e: OnKeyPress) => {
|
|
43
41
|
onKeyDownPress?.(e);
|
|
44
|
-
if (disabled) return;
|
|
45
42
|
if (triggerCodes.includes(e.nativeEvent.keyCode)) {
|
|
46
43
|
onPressIn?.(e);
|
|
47
44
|
}
|
|
48
45
|
};
|
|
49
|
-
}, [onKeyDownPress, onPressIn, triggerCodes
|
|
46
|
+
}, [onKeyDownPress, onPressIn, triggerCodes]);
|
|
50
47
|
|
|
51
48
|
return {
|
|
52
49
|
onKeyUpPressHandler,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import type { UseKeyboardPressProps } from './useKeyboardPress.types';
|
|
3
|
-
import type { OnKeyPress } from '../../types
|
|
3
|
+
import type { OnKeyPress } from '../../types';
|
|
4
4
|
|
|
5
5
|
const IOS_SPACE_KEY = 44;
|
|
6
6
|
const IOS_RETURN_OR_ENTER = 40;
|
|
@@ -14,32 +14,34 @@ export const useKeyboardPress = <
|
|
|
14
14
|
onKeyUpPress,
|
|
15
15
|
onKeyDownPress,
|
|
16
16
|
onPress,
|
|
17
|
+
onLongPress,
|
|
17
18
|
onPressIn,
|
|
18
19
|
onPressOut,
|
|
19
20
|
triggerCodes = IOS_TRIGGER_CODES,
|
|
20
|
-
disabled = false,
|
|
21
21
|
}: UseKeyboardPressProps<T, K>) => {
|
|
22
22
|
const onKeyUpPressHandler = useMemo(() => {
|
|
23
|
-
if (!onPressOut) return onKeyUpPress;
|
|
24
23
|
return (e: OnKeyPress) => {
|
|
25
24
|
onKeyUpPress?.(e);
|
|
26
|
-
if (disabled) return;
|
|
27
25
|
if (triggerCodes.includes(e.nativeEvent.keyCode)) {
|
|
28
26
|
onPressOut?.(e);
|
|
27
|
+
if (e.nativeEvent.isLongPress) {
|
|
28
|
+
onLongPress?.({} as any);
|
|
29
|
+
} else {
|
|
30
|
+
onPress?.({} as any);
|
|
31
|
+
}
|
|
29
32
|
}
|
|
30
33
|
};
|
|
31
|
-
}, [onKeyUpPress, onPressOut, triggerCodes
|
|
34
|
+
}, [onKeyUpPress, onLongPress, onPress, onPressOut, triggerCodes]);
|
|
32
35
|
|
|
33
36
|
const onKeyDownPressHandler = useMemo(() => {
|
|
34
37
|
if (!onPressIn) return onKeyDownPress;
|
|
35
38
|
return (e: OnKeyPress) => {
|
|
36
39
|
onKeyDownPress?.(e);
|
|
37
|
-
if (disabled) return;
|
|
38
40
|
if (triggerCodes.includes(e.nativeEvent.keyCode)) {
|
|
39
41
|
onPressIn?.(e);
|
|
40
42
|
}
|
|
41
43
|
};
|
|
42
|
-
}, [onKeyDownPress, onPressIn, triggerCodes
|
|
44
|
+
}, [onKeyDownPress, onPressIn, triggerCodes]);
|
|
43
45
|
|
|
44
46
|
return {
|
|
45
47
|
onKeyUpPressHandler,
|