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
|
@@ -21,10 +21,12 @@ export interface TextInputFocusWrapperNativeComponent extends ViewProps {
|
|
|
21
21
|
focusType?: Int32;
|
|
22
22
|
blurType?: Int32;
|
|
23
23
|
canBeFocused?: boolean;
|
|
24
|
+
hasOnFocusChanged?: boolean;
|
|
24
25
|
haloEffect?: boolean;
|
|
25
26
|
haloCornerRadius?: Float;
|
|
26
27
|
haloExpendX?: Float;
|
|
27
28
|
haloExpendY?: Float;
|
|
29
|
+
roundedHaloFix?: boolean;
|
|
28
30
|
tintColor?: ColorValue;
|
|
29
31
|
blurOnSubmit?: boolean;
|
|
30
32
|
multiline?: boolean;
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
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 let LockComponentType = /*#__PURE__*/function (LockComponentType) {
|
|
11
|
+
LockComponentType[LockComponentType["Trap"] = 0] = "Trap";
|
|
12
|
+
LockComponentType[LockComponentType["Frame"] = 1] = "Frame";
|
|
13
|
+
return LockComponentType;
|
|
14
|
+
}({});
|
|
4
15
|
//# sourceMappingURL=KeyboardFocusLock.types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/KeyboardFocusLock.types.ts"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["LockComponentType"],"sourceRoot":"../../../src","sources":["types/KeyboardFocusLock.types.ts"],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAYA,iBAAiB,0BAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/baseKeyboardView.types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/focus.types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Directions in which keyboard focus movement can be locked via {@link CommonFocusProps.lockFocus}.
|
|
5
|
+
*
|
|
6
|
+
* - `Up` / `Down` / `Left` / `Right` — block directional (arrow / DPad) movement.
|
|
7
|
+
* - `Forward` / `Backward` — block `Tab` and `Shift + Tab` movement.
|
|
8
|
+
* - `First` / `Last` — block jumping to the first / last focusable element.
|
|
9
|
+
*/
|
|
10
|
+
export let LockFocusEnum = /*#__PURE__*/function (LockFocusEnum) {
|
|
11
|
+
LockFocusEnum["Up"] = "up";
|
|
12
|
+
LockFocusEnum["Down"] = "down";
|
|
13
|
+
LockFocusEnum["Right"] = "right";
|
|
14
|
+
LockFocusEnum["Left"] = "left";
|
|
15
|
+
LockFocusEnum["Forward"] = "forward";
|
|
16
|
+
LockFocusEnum["Backward"] = "backward";
|
|
17
|
+
LockFocusEnum["First"] = "first";
|
|
18
|
+
LockFocusEnum["Last"] = "last";
|
|
19
|
+
return LockFocusEnum;
|
|
20
|
+
}({});
|
|
21
|
+
|
|
22
|
+
/** String-literal form of {@link LockFocusEnum} — `'up' | 'down' | 'left' | …`. */
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Link-based focus ordering props. Each `order*` target names the {@link FocusOrderProps.orderId orderId}
|
|
26
|
+
* of the element that should receive focus when moving in that direction.
|
|
27
|
+
*
|
|
28
|
+
* > `orderId` values are global. In repeated content (lists, cards) duplicate IDs cause
|
|
29
|
+
* > incorrect focus jumps — namespace them with `orderPrefix` or a `KeyboardOrderFocusGroup`.
|
|
30
|
+
*/
|
|
31
|
+
//# sourceMappingURL=focusOrder.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["LockFocusEnum"],"sourceRoot":"../../../src","sources":["types/focusOrder.types.ts"],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAYA,aAAa,0BAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAA,OAAbA,aAAa;AAAA;;AAWzB;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/focusStyle.types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/index.ts"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["LockComponentType","LockFocusEnum"],"sourceRoot":"../../../src","sources":["types/index.ts"],"mappings":";;AAKA,SAASA,iBAAiB,QAAQ,2BAA2B;AAU7D,SAASC,aAAa,QAAQ,oBAAoB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/keyPress.types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/keyboardInput.types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/withKeyboardFocus.types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { LockFocusEnum } from '../types';
|
|
4
|
+
var BITS = /*#__PURE__*/function (BITS) {
|
|
5
|
+
BITS[BITS["BIT_01"] = 1] = "BIT_01";
|
|
6
|
+
BITS[BITS["BIT_02"] = 2] = "BIT_02";
|
|
7
|
+
BITS[BITS["BIT_03"] = 4] = "BIT_03";
|
|
8
|
+
BITS[BITS["BIT_04"] = 8] = "BIT_04";
|
|
9
|
+
BITS[BITS["BIT_05"] = 16] = "BIT_05";
|
|
10
|
+
BITS[BITS["BIT_06"] = 32] = "BIT_06";
|
|
11
|
+
BITS[BITS["BIT_07"] = 64] = "BIT_07";
|
|
12
|
+
BITS[BITS["BIT_08"] = 128] = "BIT_08";
|
|
13
|
+
BITS[BITS["BIT_09"] = 256] = "BIT_09";
|
|
14
|
+
BITS[BITS["BIT_10"] = 512] = "BIT_10";
|
|
15
|
+
return BITS;
|
|
16
|
+
}(BITS || {});
|
|
17
|
+
const focusBinaryValue = {
|
|
18
|
+
[LockFocusEnum.Up]: BITS.BIT_01,
|
|
19
|
+
[LockFocusEnum.Down]: BITS.BIT_02,
|
|
20
|
+
[LockFocusEnum.Left]: BITS.BIT_03,
|
|
21
|
+
[LockFocusEnum.Right]: BITS.BIT_04,
|
|
22
|
+
[LockFocusEnum.Forward]: BITS.BIT_05,
|
|
23
|
+
[LockFocusEnum.Backward]: BITS.BIT_06,
|
|
24
|
+
[LockFocusEnum.First]: BITS.BIT_09,
|
|
25
|
+
[LockFocusEnum.Last]: BITS.BIT_10
|
|
26
|
+
};
|
|
27
|
+
export const mapLockFocus = values => {
|
|
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
|
+
};
|
|
32
|
+
//# sourceMappingURL=mapLockFocus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["LockFocusEnum","BITS","focusBinaryValue","Up","BIT_01","Down","BIT_02","Left","BIT_03","Right","BIT_04","Forward","BIT_05","Backward","BIT_06","First","BIT_09","Last","BIT_10","mapLockFocus","values","length","reduce","acc","item"],"sourceRoot":"../../../src","sources":["utils/mapLockFocus.ts"],"mappings":";;AAAA,SAASA,aAAa,QAA4B,UAAU;AAAC,IAExDC,IAAI,0BAAJA,IAAI;EAAJA,IAAI,CAAJA,IAAI;EAAJA,IAAI,CAAJA,IAAI;EAAJA,IAAI,CAAJA,IAAI;EAAJA,IAAI,CAAJA,IAAI;EAAJA,IAAI,CAAJA,IAAI;EAAJA,IAAI,CAAJA,IAAI;EAAJA,IAAI,CAAJA,IAAI;EAAJA,IAAI,CAAJA,IAAI;EAAJA,IAAI,CAAJA,IAAI;EAAJA,IAAI,CAAJA,IAAI;EAAA,OAAJA,IAAI;AAAA,EAAJA,IAAI;AAaT,MAAMC,gBAA+C,GAAG;EACtD,CAACF,aAAa,CAACG,EAAE,GAAGF,IAAI,CAACG,MAAM;EAC/B,CAACJ,aAAa,CAACK,IAAI,GAAGJ,IAAI,CAACK,MAAM;EACjC,CAACN,aAAa,CAACO,IAAI,GAAGN,IAAI,CAACO,MAAM;EACjC,CAACR,aAAa,CAACS,KAAK,GAAGR,IAAI,CAACS,MAAM;EAClC,CAACV,aAAa,CAACW,OAAO,GAAGV,IAAI,CAACW,MAAM;EACpC,CAACZ,aAAa,CAACa,QAAQ,GAAGZ,IAAI,CAACa,MAAM;EACrC,CAACd,aAAa,CAACe,KAAK,GAAGd,IAAI,CAACe,MAAM;EAClC,CAAChB,aAAa,CAACiB,IAAI,GAAGhB,IAAI,CAACiB;AAC7B,CAAC;AAED,OAAO,MAAMC,YAAY,GAAIC,MAAmC,IAAa;EAC3E,IAAI,CAACA,MAAM,IAAI,CAACA,MAAM,CAACC,MAAM,EAAE,OAAO,CAAC;EACvC;EACA,OAAOD,MAAM,CAACE,MAAM,CAAC,CAACC,GAAG,EAAEC,IAAI,KAAKD,GAAG,GAAGrB,gBAAgB,CAACsB,IAAI,CAAC,EAAE,CAAC,CAAC;AACtE,CAAC","ignoreList":[]}
|
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { useState, useMemo, useCallback } from 'react';
|
|
4
|
-
import { Pressable } from 'react-native';
|
|
5
|
-
const backgroundTintMap = {
|
|
6
|
-
background: true
|
|
7
|
-
};
|
|
8
|
-
const DEFAULT_BACKGROUND_TINT = '#dce3f9';
|
|
9
4
|
export const useFocusStyle = ({
|
|
10
5
|
focusStyle,
|
|
11
6
|
onFocusChange,
|
|
12
7
|
containerFocusStyle,
|
|
13
|
-
tintColor,
|
|
14
|
-
tintType = 'default',
|
|
15
8
|
style,
|
|
16
|
-
|
|
17
|
-
withPressedStyle = false
|
|
9
|
+
pressedStyleSignature = false
|
|
18
10
|
}) => {
|
|
19
11
|
const [focused, setFocusStatus] = useState(false);
|
|
20
12
|
const onFocusChangeHandler = useCallback(isFocused => {
|
|
@@ -27,22 +19,14 @@ export const useFocusStyle = ({
|
|
|
27
19
|
}) : focusStyle;
|
|
28
20
|
return focused ? specificStyle : undefined;
|
|
29
21
|
}, [focusStyle, focused]);
|
|
30
|
-
const hoverColor = useMemo(() => ({
|
|
31
|
-
backgroundColor: tintColor
|
|
32
|
-
}), [tintColor]);
|
|
33
22
|
const containerFocusedStyle = useMemo(() => {
|
|
34
|
-
if (backgroundTintMap[tintType] && !containerFocusStyle) {
|
|
35
|
-
return focused ? {
|
|
36
|
-
backgroundColor: tintColor ?? DEFAULT_BACKGROUND_TINT
|
|
37
|
-
} : undefined;
|
|
38
|
-
}
|
|
39
23
|
if (!containerFocusStyle) return undefined;
|
|
40
24
|
const specificStyle = typeof containerFocusStyle === 'function' ? containerFocusStyle({
|
|
41
25
|
focused
|
|
42
26
|
}) : containerFocusStyle;
|
|
43
27
|
return focused ? specificStyle : undefined;
|
|
44
|
-
}, [containerFocusStyle, focused
|
|
45
|
-
const
|
|
28
|
+
}, [containerFocusStyle, focused]);
|
|
29
|
+
const defaultComponentStyle = useMemo(() => pressedStyleSignature ? undefined : [style, componentFocusedStyle], [pressedStyleSignature, style, componentFocusedStyle]);
|
|
46
30
|
const styleHandlerPressable = useCallback(({
|
|
47
31
|
pressed
|
|
48
32
|
}) => {
|
|
@@ -54,13 +38,12 @@ export const useFocusStyle = ({
|
|
|
54
38
|
return [style, componentFocusedStyle];
|
|
55
39
|
}
|
|
56
40
|
}, [componentFocusedStyle, style]);
|
|
57
|
-
const componentStyleViewStyle =
|
|
41
|
+
const componentStyleViewStyle = pressedStyleSignature ? styleHandlerPressable : defaultComponentStyle;
|
|
58
42
|
return {
|
|
59
43
|
componentStyleViewStyle,
|
|
60
44
|
componentFocusedStyle,
|
|
61
45
|
containerFocusedStyle,
|
|
62
46
|
onFocusChangeHandler,
|
|
63
|
-
hoverColor,
|
|
64
47
|
focused
|
|
65
48
|
};
|
|
66
49
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useState","useMemo","useCallback","
|
|
1
|
+
{"version":3,"names":["useState","useMemo","useCallback","useFocusStyle","focusStyle","onFocusChange","containerFocusStyle","style","pressedStyleSignature","focused","setFocusStatus","onFocusChangeHandler","isFocused","componentFocusedStyle","specificStyle","undefined","containerFocusedStyle","defaultComponentStyle","styleHandlerPressable","pressed","componentStyleViewStyle"],"sourceRoot":"../../../src","sources":["utils/useFocusStyle.tsx"],"mappings":";;AAAA,SAASA,QAAQ,EAAEC,OAAO,EAAEC,WAAW,QAAQ,OAAO;AAYtD,OAAO,MAAMC,aAAa,GAAGA,CAAC;EAC5BC,UAAU;EACVC,aAAa;EACbC,mBAAmB;EACnBC,KAAK;EACLC,qBAAqB,GAAG;AACN,CAAC,KAAK;EACxB,MAAM,CAACC,OAAO,EAAEC,cAAc,CAAC,GAAGV,QAAQ,CAAC,KAAK,CAAC;EAEjD,MAAMW,oBAAoB,GAAGT,WAAW,CACrCU,SAAkB,IAAK;IACtBF,cAAc,CAACE,SAAS,CAAC;IACzBP,aAAa,GAAGO,SAAS,CAAC;EAC5B,CAAC,EACD,CAACP,aAAa,CAChB,CAAC;EAED,MAAMQ,qBAAqB,GAAGZ,OAAO,CAAC,MAAM;IAC1C,MAAMa,aAAa,GACjB,OAAOV,UAAU,KAAK,UAAU,GAAGA,UAAU,CAAC;MAAEK;IAAQ,CAAC,CAAC,GAAGL,UAAU;IACzE,OAAOK,OAAO,GAAGK,aAAa,GAAGC,SAAS;EAC5C,CAAC,EAAE,CAACX,UAAU,EAAEK,OAAO,CAAC,CAAC;EAEzB,MAAMO,qBAAqB,GAAGf,OAAO,CAAC,MAAM;IAC1C,IAAI,CAACK,mBAAmB,EAAE,OAAOS,SAAS;IAE1C,MAAMD,aAAa,GACjB,OAAOR,mBAAmB,KAAK,UAAU,GACrCA,mBAAmB,CAAC;MAAEG;IAAQ,CAAC,CAAC,GAChCH,mBAAmB;IAEzB,OAAOG,OAAO,GAAGK,aAAa,GAAGC,SAAS;EAC5C,CAAC,EAAE,CAACT,mBAAmB,EAAEG,OAAO,CAAC,CAAC;EAElC,MAAMQ,qBAAqB,GAAGhB,OAAO,CACnC,MAAOO,qBAAqB,GAAGO,SAAS,GAAG,CAACR,KAAK,EAAEM,qBAAqB,CAAE,EAC1E,CAACL,qBAAqB,EAAED,KAAK,EAAEM,qBAAqB,CACtD,CAAC;EACD,MAAMK,qBAAqB,GAAGhB,WAAW,CACvC,CAAC;IAAEiB;EAA8B,CAAC,KAAK;IACrC,IAAI,OAAOZ,KAAK,KAAK,UAAU,EAAE;MAC/B,OAAO,CAACA,KAAK,CAAC;QAAEY;MAAQ,CAAC,CAAC,EAAEN,qBAAqB,CAAC;IACpD,CAAC,MAAM;MACL,OAAO,CAACN,KAAK,EAAEM,qBAAqB,CAAC;IACvC;EACF,CAAC,EACD,CAACA,qBAAqB,EAAEN,KAAK,CAC/B,CAAC;EAED,MAAMa,uBAAuB,GAAGZ,qBAAqB,GACjDU,qBAAqB,GACrBD,qBAAqB;EAEzB,OAAO;IACLG,uBAAuB;IACvBP,qBAAqB;IACrBG,qBAAqB;IACrBL,oBAAoB;IACpBF;EACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useMemo } from 'react';
|
|
4
|
+
import { useFocusStyle } from './useFocusStyle';
|
|
5
|
+
import { useKeyboardPress } from './useKeyboardPress/useKeyboardPress';
|
|
6
|
+
import { useKeyboardPressState } from './useKeyboardPressState';
|
|
7
|
+
export const useKeyboardFocusContainer = ({
|
|
8
|
+
focusStyle,
|
|
9
|
+
containerFocusStyle,
|
|
10
|
+
onFocusChange,
|
|
11
|
+
style,
|
|
12
|
+
pressedStyleSignature,
|
|
13
|
+
onKeyUpPress,
|
|
14
|
+
onKeyDownPress,
|
|
15
|
+
onPress,
|
|
16
|
+
onLongPress,
|
|
17
|
+
onPressIn,
|
|
18
|
+
onPressOut,
|
|
19
|
+
triggerCodes,
|
|
20
|
+
androidKeyboardPressState = false
|
|
21
|
+
}) => {
|
|
22
|
+
const keyboardPress = useKeyboardPressState({
|
|
23
|
+
enabled: androidKeyboardPressState,
|
|
24
|
+
onPressIn,
|
|
25
|
+
onPressOut,
|
|
26
|
+
onFocusChange
|
|
27
|
+
});
|
|
28
|
+
const {
|
|
29
|
+
focused,
|
|
30
|
+
containerFocusedStyle,
|
|
31
|
+
componentStyleViewStyle,
|
|
32
|
+
onFocusChangeHandler
|
|
33
|
+
} = useFocusStyle({
|
|
34
|
+
onFocusChange: keyboardPress.onFocusChange,
|
|
35
|
+
focusStyle,
|
|
36
|
+
containerFocusStyle,
|
|
37
|
+
style,
|
|
38
|
+
pressedStyleSignature
|
|
39
|
+
});
|
|
40
|
+
const {
|
|
41
|
+
onKeyUpPressHandler,
|
|
42
|
+
onKeyDownPressHandler,
|
|
43
|
+
onPressHandler
|
|
44
|
+
} = useKeyboardPress({
|
|
45
|
+
onKeyUpPress,
|
|
46
|
+
onKeyDownPress,
|
|
47
|
+
onPress,
|
|
48
|
+
onLongPress,
|
|
49
|
+
onPressIn: keyboardPress.onPressIn,
|
|
50
|
+
onPressOut: keyboardPress.onPressOut,
|
|
51
|
+
triggerCodes
|
|
52
|
+
});
|
|
53
|
+
const {
|
|
54
|
+
applyPressedStyle
|
|
55
|
+
} = keyboardPress;
|
|
56
|
+
const componentStyle = useMemo(() => applyPressedStyle(componentStyleViewStyle), [applyPressedStyle, componentStyleViewStyle]);
|
|
57
|
+
const onContextMenuHandler = useCallback(() => {
|
|
58
|
+
onLongPress?.();
|
|
59
|
+
}, [onLongPress]);
|
|
60
|
+
const enableContextMenu = Boolean(onLongPress);
|
|
61
|
+
return {
|
|
62
|
+
focused,
|
|
63
|
+
keyboardPressed: keyboardPress.pressed,
|
|
64
|
+
containerFocusedStyle,
|
|
65
|
+
componentStyleViewStyle: componentStyle,
|
|
66
|
+
onFocusChangeHandler,
|
|
67
|
+
onKeyUpPressHandler,
|
|
68
|
+
onKeyDownPressHandler,
|
|
69
|
+
onPressHandler,
|
|
70
|
+
onContextMenuHandler,
|
|
71
|
+
enableContextMenu
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=useKeyboardFocusContainer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","useMemo","useFocusStyle","useKeyboardPress","useKeyboardPressState","useKeyboardFocusContainer","focusStyle","containerFocusStyle","onFocusChange","style","pressedStyleSignature","onKeyUpPress","onKeyDownPress","onPress","onLongPress","onPressIn","onPressOut","triggerCodes","androidKeyboardPressState","keyboardPress","enabled","focused","containerFocusedStyle","componentStyleViewStyle","onFocusChangeHandler","onKeyUpPressHandler","onKeyDownPressHandler","onPressHandler","applyPressedStyle","componentStyle","onContextMenuHandler","enableContextMenu","Boolean","keyboardPressed","pressed"],"sourceRoot":"../../../src","sources":["utils/useKeyboardFocusContainer.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAE5C,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,gBAAgB,QAAQ,qCAAqC;AACtE,SAASC,qBAAqB,QAAQ,yBAAyB;AAwB/D,OAAO,MAAMC,yBAAyB,GAAGA,CAGvC;EACAC,UAAU;EACVC,mBAAmB;EACnBC,aAAa;EACbC,KAAK;EACLC,qBAAqB;EACrBC,YAAY;EACZC,cAAc;EACdC,OAAO;EACP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@ export const ANDROID_DPAD_CENTER_CODE = 23;
|
|
|
6
6
|
export const ANDROID_ENTER_CODE = 66;
|
|
7
7
|
export const ANDROID_TRIGGER_CODES = [ANDROID_SPACE_KEY_CODE, ANDROID_DPAD_CENTER_CODE, ANDROID_ENTER_CODE];
|
|
8
8
|
const useDebouncedCallback = (callback, delay) => {
|
|
9
|
-
const timeoutRef = useRef(
|
|
9
|
+
const timeoutRef = useRef(null);
|
|
10
10
|
return useCallback((...args) => {
|
|
11
11
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
12
12
|
timeoutRef.current = setTimeout(() => {
|
|
@@ -21,8 +21,7 @@ export const useKeyboardPress = ({
|
|
|
21
21
|
onPressOut,
|
|
22
22
|
onPress,
|
|
23
23
|
onLongPress,
|
|
24
|
-
triggerCodes = ANDROID_TRIGGER_CODES
|
|
25
|
-
disabled = false
|
|
24
|
+
triggerCodes = ANDROID_TRIGGER_CODES
|
|
26
25
|
}) => {
|
|
27
26
|
const isLongPressRef = useRef(false);
|
|
28
27
|
const debouncedOnPress = useDebouncedCallback(event => {
|
|
@@ -42,24 +41,22 @@ export const useKeyboardPress = ({
|
|
|
42
41
|
} = e;
|
|
43
42
|
onPressOut?.(e);
|
|
44
43
|
onKeyUpPress?.(e);
|
|
45
|
-
if (disabled) return;
|
|
46
44
|
if (triggerCodes.includes(keyCode)) {
|
|
47
45
|
if (isLongPress) {
|
|
48
46
|
isLongPressRef.current = true;
|
|
49
47
|
debouncedOnPress();
|
|
50
48
|
}
|
|
51
49
|
}
|
|
52
|
-
}, [onPressOut, onKeyUpPress, triggerCodes, debouncedOnPress
|
|
50
|
+
}, [onPressOut, onKeyUpPress, triggerCodes, debouncedOnPress]);
|
|
53
51
|
const onKeyDownPressHandler = useMemo(() => {
|
|
54
52
|
if (!onPressIn) return onKeyDownPress;
|
|
55
53
|
return e => {
|
|
56
54
|
onKeyDownPress?.(e);
|
|
57
|
-
if (disabled) return;
|
|
58
55
|
if (triggerCodes.includes(e.nativeEvent.keyCode)) {
|
|
59
56
|
onPressIn?.(e);
|
|
60
57
|
}
|
|
61
58
|
};
|
|
62
|
-
}, [onKeyDownPress, onPressIn, triggerCodes
|
|
59
|
+
}, [onKeyDownPress, onPressIn, triggerCodes]);
|
|
63
60
|
const onPressHandler = useCallback(event => {
|
|
64
61
|
debouncedOnPress(event);
|
|
65
62
|
}, [debouncedOnPress]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useCallback","useMemo","useRef","ANDROID_SPACE_KEY_CODE","ANDROID_DPAD_CENTER_CODE","ANDROID_ENTER_CODE","ANDROID_TRIGGER_CODES","useDebouncedCallback","callback","delay","timeoutRef","
|
|
1
|
+
{"version":3,"names":["useCallback","useMemo","useRef","ANDROID_SPACE_KEY_CODE","ANDROID_DPAD_CENTER_CODE","ANDROID_ENTER_CODE","ANDROID_TRIGGER_CODES","useDebouncedCallback","callback","delay","timeoutRef","args","current","clearTimeout","setTimeout","useKeyboardPress","onKeyUpPress","onKeyDownPress","onPressIn","onPressOut","onPress","onLongPress","triggerCodes","isLongPressRef","debouncedOnPress","event","onKeyUpPressHandler","e","nativeEvent","keyCode","isLongPress","includes","onKeyDownPressHandler","onPressHandler","hasHandler","undefined"],"sourceRoot":"../../../../src","sources":["utils/useKeyboardPress/useKeyboardPress.android.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAKpD,OAAO,MAAMC,sBAAsB,GAAG,EAAE;AACxC,OAAO,MAAMC,wBAAwB,GAAG,EAAE;AAC1C,OAAO,MAAMC,kBAAkB,GAAG,EAAE;AAEpC,OAAO,MAAMC,qBAAqB,GAAG,CACnCH,sBAAsB,EACtBC,wBAAwB,EACxBC,kBAAkB,CACnB;AAED,MAAME,oBAAoB,GAAGA,CAC3BC,QAAW,EACXC,KAAa,KACV;EACH,MAAMC,UAAU,GAAGR,MAAM,CAAuC,IAAI,CAAC;EACrE,OAAOF,WAAW,CAChB,C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1C,IAAI,CAACiB,SAAS,EAAE,OAAOD,cAAc;IACrC,OAAQU,CAAa,IAAK;MACxBV,cAAc,GAAGU,CAAC,CAAC;MACnB,IAAIL,YAAY,CAACS,QAAQ,CAACJ,CAAC,CAACC,WAAW,CAACC,OAAO,CAAC,EAAE;QAChDX,SAAS,GAAGS,CAAqC,CAAC;MACpD;IACF,CAAC;EACH,CAAC,EAAE,CAACV,cAAc,EAAEC,SAAS,EAAEI,YAAY,CAAC,CAAC;EAE7C,MAAMW,cAAc,GAAGjC,WAAW,CAC/ByB,KAA4B,IAAK;IAChCD,gBAAgB,CAACC,KAAK,CAAC;EACzB,CAAC,EACD,CAACD,gBAAgB,CACnB,CAAC;EAED,MAAMU,UAAU,GAAGf,UAAU,IAAIH,YAAY,IAAIK,WAAW,IAAID,OAAO;EACvE,OAAO;IACLM,mBAAmB,EAAEQ,UAAU,GAAGR,mBAAmB,GAAGS,SAAS;IACjEH,qBAAqB;IACrBC,cAAc,EAAEb,OAAO,GAAGa,cAAc,GAAGE;EAC7C,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -11,13 +11,11 @@ export const useKeyboardPress = ({
|
|
|
11
11
|
onPressIn,
|
|
12
12
|
onPressOut,
|
|
13
13
|
onLongPress,
|
|
14
|
-
triggerCodes = IOS_TRIGGER_CODES
|
|
15
|
-
disabled = false
|
|
14
|
+
triggerCodes = IOS_TRIGGER_CODES
|
|
16
15
|
}) => {
|
|
17
16
|
const onKeyUpPressHandler = useMemo(() => {
|
|
18
17
|
return e => {
|
|
19
18
|
onKeyUpPress?.(e);
|
|
20
|
-
if (disabled) return;
|
|
21
19
|
if (triggerCodes.includes(e.nativeEvent.keyCode)) {
|
|
22
20
|
onPressOut?.(e);
|
|
23
21
|
if (e.nativeEvent.isLongPress) {
|
|
@@ -27,17 +25,16 @@ export const useKeyboardPress = ({
|
|
|
27
25
|
}
|
|
28
26
|
}
|
|
29
27
|
};
|
|
30
|
-
}, [onKeyUpPress, onLongPress, onPress, onPressOut, triggerCodes
|
|
28
|
+
}, [onKeyUpPress, onLongPress, onPress, onPressOut, triggerCodes]);
|
|
31
29
|
const onKeyDownPressHandler = useMemo(() => {
|
|
32
30
|
if (!onPressIn) return onKeyDownPress;
|
|
33
31
|
return e => {
|
|
34
32
|
onKeyDownPress?.(e);
|
|
35
|
-
if (disabled) return;
|
|
36
33
|
if (triggerCodes.includes(e.nativeEvent.keyCode)) {
|
|
37
34
|
onPressIn?.(e);
|
|
38
35
|
}
|
|
39
36
|
};
|
|
40
|
-
}, [onKeyDownPress, onPressIn, triggerCodes
|
|
37
|
+
}, [onKeyDownPress, onPressIn, triggerCodes]);
|
|
41
38
|
return {
|
|
42
39
|
onKeyUpPressHandler,
|
|
43
40
|
onKeyDownPressHandler,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useMemo","IOS_SPACE_KEY","IOS_RETURN_OR_ENTER","IOS_TRIGGER_CODES","useKeyboardPress","onKeyUpPress","onKeyDownPress","onPress","onPressIn","onPressOut","onLongPress","triggerCodes","
|
|
1
|
+
{"version":3,"names":["useMemo","IOS_SPACE_KEY","IOS_RETURN_OR_ENTER","IOS_TRIGGER_CODES","useKeyboardPress","onKeyUpPress","onKeyDownPress","onPress","onPressIn","onPressOut","onLongPress","triggerCodes","onKeyUpPressHandler","e","includes","nativeEvent","keyCode","isLongPress","onKeyDownPressHandler","onPressHandler"],"sourceRoot":"../../../../src","sources":["utils/useKeyboardPress/useKeyboardPress.ios.ts"],"mappings":";;AAAA,SAASA,OAAO,QAAQ,OAAO;AAK/B,MAAMC,aAAa,GAAG,EAAE;AACxB,MAAMC,mBAAmB,GAAG,EAAE;AAE9B,MAAMC,iBAAiB,GAAG,CAACF,aAAa,EAAEC,mBAAmB,CAAC;AAE9D,OAAO,MAAME,gBAAgB,GAAGA,CAG9B;EACAC,YAAY;EACZC,cAAc;EACdC,OAAO;EACPC,SAAS;EACTC,UAAU;EACVC,WAAW;EACXC,YAAY,GAAGR;AACY,CAAC,KAAK;EACjC,MAAMS,mBAAmB,GAAGZ,OAAO,CAAC,MAAM;IACxC,OAAQa,CAAa,IAAK;MACxBR,YAAY,GAAGQ,CAAC,CAAC;MAEjB,IAAIF,YAAY,CAACG,QAAQ,CAACD,CAAC,CAACE,WAAW,CAACC,OAAO,CAAC,EAAE;QAChDP,UAAU,GAAGI,CAAC,CAAC;QACf,IAAIA,CAAC,CAACE,WAAW,CAACE,WAAW,EAAE;UAC7BP,WAAW,GAAG,CAAC,CAA0B,CAAC;QAC5C,CAAC,MAAM;UACLH,OAAO,GAAG,CAAC,CAA0B,CAAC;QACxC;MACF;IACF,CAAC;EACH,CAAC,EAAE,CAACF,YAAY,EAAEK,WAAW,EAAEH,OAAO,EAAEE,UAAU,EAAEE,YAAY,CAAC,CAAC;EAElE,MAAMO,qBAAqB,GAAGlB,OAAO,CAAC,MAAM;IAC1C,IAAI,CAACQ,SAAS,EAAE,OAAOF,cAAc;IACrC,OAAQO,CAAa,IAAK;MACxBP,cAAc,GAAGO,CAAC,CAAC;MACnB,IAAIF,YAAY,CAACG,QAAQ,CAACD,CAAC,CAACE,WAAW,CAACC,OAAO,CAAC,EAAE;QAChDR,SAAS,GAAGK,CAAC,CAAC;MAChB;IACF,CAAC;EACH,CAAC,EAAE,CAACP,cAAc,EAAEE,SAAS,EAAEG,YAAY,CAAC,CAAC;EAE7C,OAAO;IACLC,mBAAmB;IACnBM,qBAAqB;IACrBC,cAAc,EAAEZ;EAClB,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -8,31 +8,33 @@ export const useKeyboardPress = ({
|
|
|
8
8
|
onKeyUpPress,
|
|
9
9
|
onKeyDownPress,
|
|
10
10
|
onPress,
|
|
11
|
+
onLongPress,
|
|
11
12
|
onPressIn,
|
|
12
13
|
onPressOut,
|
|
13
|
-
triggerCodes = IOS_TRIGGER_CODES
|
|
14
|
-
disabled = false
|
|
14
|
+
triggerCodes = IOS_TRIGGER_CODES
|
|
15
15
|
}) => {
|
|
16
16
|
const onKeyUpPressHandler = useMemo(() => {
|
|
17
|
-
if (!onPressOut) return onKeyUpPress;
|
|
18
17
|
return e => {
|
|
19
18
|
onKeyUpPress?.(e);
|
|
20
|
-
if (disabled) return;
|
|
21
19
|
if (triggerCodes.includes(e.nativeEvent.keyCode)) {
|
|
22
20
|
onPressOut?.(e);
|
|
21
|
+
if (e.nativeEvent.isLongPress) {
|
|
22
|
+
onLongPress?.({});
|
|
23
|
+
} else {
|
|
24
|
+
onPress?.({});
|
|
25
|
+
}
|
|
23
26
|
}
|
|
24
27
|
};
|
|
25
|
-
}, [onKeyUpPress, onPressOut, triggerCodes
|
|
28
|
+
}, [onKeyUpPress, onLongPress, onPress, onPressOut, triggerCodes]);
|
|
26
29
|
const onKeyDownPressHandler = useMemo(() => {
|
|
27
30
|
if (!onPressIn) return onKeyDownPress;
|
|
28
31
|
return e => {
|
|
29
32
|
onKeyDownPress?.(e);
|
|
30
|
-
if (disabled) return;
|
|
31
33
|
if (triggerCodes.includes(e.nativeEvent.keyCode)) {
|
|
32
34
|
onPressIn?.(e);
|
|
33
35
|
}
|
|
34
36
|
};
|
|
35
|
-
}, [onKeyDownPress, onPressIn, triggerCodes
|
|
37
|
+
}, [onKeyDownPress, onPressIn, triggerCodes]);
|
|
36
38
|
return {
|
|
37
39
|
onKeyUpPressHandler,
|
|
38
40
|
onKeyDownPressHandler,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useMemo","IOS_SPACE_KEY","IOS_RETURN_OR_ENTER","IOS_TRIGGER_CODES","useKeyboardPress","onKeyUpPress","onKeyDownPress","onPress","onPressIn","onPressOut","triggerCodes","
|
|
1
|
+
{"version":3,"names":["useMemo","IOS_SPACE_KEY","IOS_RETURN_OR_ENTER","IOS_TRIGGER_CODES","useKeyboardPress","onKeyUpPress","onKeyDownPress","onPress","onLongPress","onPressIn","onPressOut","triggerCodes","onKeyUpPressHandler","e","includes","nativeEvent","keyCode","isLongPress","onKeyDownPressHandler","onPress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IACnBM,qBAAqB;IACrBC,cAAc,EAAEZ;EAClB,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useState } from 'react';
|
|
4
|
+
import { Platform } from 'react-native';
|
|
5
|
+
/**
|
|
6
|
+
* Android only. Physical-keyboard activation (Enter / Space / DPad-center) never
|
|
7
|
+
* reaches the touch responder, so a wrapped component's `pressed` stays false.
|
|
8
|
+
* This derives a press state from the key down/up events and returns composable
|
|
9
|
+
* pieces to thread it through focus, press handlers, and function styles.
|
|
10
|
+
*
|
|
11
|
+
* Everything is a no-op unless `enabled` and running on Android, so callers can
|
|
12
|
+
* always wire the returned values unconditionally.
|
|
13
|
+
*/
|
|
14
|
+
export const useKeyboardPressState = ({
|
|
15
|
+
enabled = false,
|
|
16
|
+
onPressIn,
|
|
17
|
+
onPressOut,
|
|
18
|
+
onFocusChange
|
|
19
|
+
}) => {
|
|
20
|
+
const active = enabled && Platform.OS === 'android';
|
|
21
|
+
const [pressed, setPressed] = useState(false);
|
|
22
|
+
const handlePressIn = useCallback(e => {
|
|
23
|
+
setPressed(true);
|
|
24
|
+
onPressIn?.(e);
|
|
25
|
+
}, [onPressIn]);
|
|
26
|
+
const handlePressOut = useCallback(e => {
|
|
27
|
+
setPressed(false);
|
|
28
|
+
onPressOut?.(e);
|
|
29
|
+
}, [onPressOut]);
|
|
30
|
+
const handleFocusChange = useCallback(isFocused => {
|
|
31
|
+
// Drop a stuck press if focus leaves before the key-up arrives.
|
|
32
|
+
if (!isFocused && active) setPressed(false);
|
|
33
|
+
onFocusChange?.(isFocused);
|
|
34
|
+
}, [onFocusChange, active]);
|
|
35
|
+
|
|
36
|
+
// Fold the keyboard press into a `style({ pressed })` function so visual
|
|
37
|
+
// press feedback (`withPressedStyle`, function styles) reacts to the keyboard.
|
|
38
|
+
// Non-function styles and the inactive case are returned untouched.
|
|
39
|
+
const applyPressedStyle = useCallback(style => {
|
|
40
|
+
if (!active || typeof style !== 'function') return style;
|
|
41
|
+
const styleFn = style;
|
|
42
|
+
return ({
|
|
43
|
+
pressed: touchPressed
|
|
44
|
+
}) => styleFn({
|
|
45
|
+
pressed: touchPressed || pressed
|
|
46
|
+
});
|
|
47
|
+
}, [active, pressed]);
|
|
48
|
+
return {
|
|
49
|
+
/** A keyboard-driven press is currently held. */
|
|
50
|
+
pressed: active && pressed,
|
|
51
|
+
/** Pass to the keyboard press hook; the original handlers when inactive. */
|
|
52
|
+
onPressIn: active ? handlePressIn : onPressIn,
|
|
53
|
+
onPressOut: active ? handlePressOut : onPressOut,
|
|
54
|
+
/** Wrap `onFocusChange` to clear a stuck press on blur. */
|
|
55
|
+
onFocusChange: handleFocusChange,
|
|
56
|
+
/** Fold the keyboard press into a function style. */
|
|
57
|
+
applyPressedStyle
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=useKeyboardPressState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","useState","Platform","useKeyboardPressState","enabled","onPressIn","onPressOut","onFocusChange","active","OS","pressed","setPressed","handlePressIn","e","handlePressOut","handleFocusChange","isFocused","applyPressedStyle","style","styleFn","touchPressed"],"sourceRoot":"../../../src","sources":["utils/useKeyboardPressState.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,QAAQ,QAAQ,OAAO;AAC7C,SAASC,QAAQ,QAAQ,cAAc;AAYvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,qBAAqB,GAAGA,CAAC;EACpCC,OAAO,GAAG,KAAK;EACfC,SAAS;EACTC,UAAU;EACVC;AAC2B,CAAC,KAAK;EACjC,MAAMC,MAAM,GAAGJ,OAAO,IAAIF,QAAQ,CAACO,EAAE,KAAK,SAAS;EACnD,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGV,QAAQ,CAAC,KAAK,CAAC;EAE7C,MAAMW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e => {
|
|
9
|
-
onFocusChange?.(e.nativeEvent.isFocused, e
|
|
9
|
+
onFocusChange?.(e.nativeEvent.isFocused, e.nativeEvent.target);
|
|
10
10
|
if (e.nativeEvent.isFocused) {
|
|
11
11
|
onFocus?.();
|
|
12
12
|
} else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useCallback","useOnFocusChange","onFocusChange","onFocus","onBlur","e","nativeEvent","isFocused","target"],"sourceRoot":"../../../src","sources":["utils/useOnFocusChange.ts"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,OAAO;AASnC,OAAO,MAAMC,gBAAgB,GAAGA,CAAC;EAC/BC,aAAa;EACbC,OAAO;EACPC;AACc,CAAC,KACfJ,WAAW,CACRK,CAAC,IAAK;EACLH,aAAa,
|
|
1
|
+
{"version":3,"names":["useCallback","useOnFocusChange","onFocusChange","onFocus","onBlur","e","nativeEvent","isFocused","target"],"sourceRoot":"../../../src","sources":["utils/useOnFocusChange.ts"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,OAAO;AASnC,OAAO,MAAMC,gBAAgB,GAAGA,CAAC;EAC/BC,aAAa;EACbC,OAAO;EACPC;AACc,CAAC,KACfJ,WAAW,CACRK,CAAC,IAAK;EACLH,aAAa,GAAGG,CAAC,CAACC,WAAW,CAACC,SAAS,EAAEF,CAAC,CAACC,WAAW,CAACE,MAAM,CAAC;EAC9D,IAAIH,CAAC,CAACC,WAAW,CAACC,SAAS,EAAE;IAC3BJ,OAAO,GAAG,CAAC;EACb,CAAC,MAAM;IACLC,MAAM,GAAG,CAAC;EACZ;AACF,CAAC,EACD,CAACA,MAAM,EAAED,OAAO,EAAED,aAAa,CACjC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
export const useOrderValidation = ({
|
|
5
|
+
groupId,
|
|
6
|
+
orderIndex,
|
|
7
|
+
orderPrefix,
|
|
8
|
+
orderId,
|
|
9
|
+
orderForward,
|
|
10
|
+
orderBackward,
|
|
11
|
+
orderFirst,
|
|
12
|
+
orderLast,
|
|
13
|
+
orderLeft,
|
|
14
|
+
orderRight,
|
|
15
|
+
orderUp,
|
|
16
|
+
orderDown
|
|
17
|
+
}) => {
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (!__DEV__) return;
|
|
20
|
+
if (orderIndex !== undefined && !groupId) console.warn('`orderIndex` must be declared alongside `orderGroup` for proper functionality. Ensure components are wrapped with `KeyboardOrderFocusGroup` or provide `orderGroup` directly.');
|
|
21
|
+
}, [groupId, orderIndex]);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (!__DEV__) return;
|
|
24
|
+
const hasOrderLinkProp = orderId !== undefined || orderForward !== undefined || orderBackward !== undefined || orderFirst !== undefined || orderLast !== undefined || orderLeft !== undefined || orderRight !== undefined || orderUp !== undefined || orderDown !== undefined;
|
|
25
|
+
if (hasOrderLinkProp && orderPrefix === '') {
|
|
26
|
+
console.warn('[react-native-external-keyboard] orderId, orderForward, orderBackward, orderFirst, orderLast, ' + 'orderLeft, orderRight, orderUp, and orderDown are global IDs. ' + 'Wrap the component in <KeyboardOrderFocusGroup> or pass orderPrefix to avoid ID collisions across screens.');
|
|
27
|
+
}
|
|
28
|
+
}, [orderId, orderForward, orderBackward, orderFirst, orderLast, orderLeft, orderRight, orderUp, orderDown, orderPrefix]);
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=useOrderValidation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","useOrderValidation","groupId","orderIndex","orderPrefix","orderId","orderForward","orderBackward","orderFirst","orderLast","orderLeft","orderRight","orderUp","orderDown","__DEV__","undefined","console","warn","hasOrderLinkProp"],"sourceRoot":"../../../src","sources":["utils/useOrderValidation.ts"],"mappings":";;AAAA,SAASA,SAAS,QAAQ,OAAO;AAoBjC,OAAO,MAAMC,kBAAkB,GAAGA,CAAC;EACjCC,OAAO;EACPC,UAAU;EACVC,WAAW;EACXC,OAAO;EACPC,YAAY;EACZC,aAAa;EACbC,UAAU;EACVC,SAAS;EACTC,SAAS;EACTC,UAAU;EACVC,OAAO;EACPC;AACuB,CAAC,KAAK;EAC7Bb,SAAS,CAAC,MAAM;IACd,IAAI,CAACc,OAAO,EAAE;IACd,IAAIX,UAAU,KAAKY,SAAS,IAAI,CAACb,OAAO,EACtCc,OAAO,CAACC,IAAI,CACV,+KACF,CAAC;EACL,CAAC,EAAE,CAACf,OAAO,EAAEC,UAAU,CAAC,CAAC;EAEzBH,SAAS,CAAC,MAAM;IACd,IAAI,CAACc,OAAO,EAAE;IACd,MAAMI,gBAAgB,GACpBb,OAAO,KAAKU,SAAS,IACrBT,YAAY,KAAKS,SAAS,IAC1BR,aAAa,KAAKQ,SAAS,IAC3BP,UAAU,KAAKO,SAAS,IACxBN,SAAS,KAAKM,SAAS,IACvBL,SAAS,KAAKK,SAAS,IACvBJ,UAAU,KAAKI,SAAS,IACxBH,OAAO,KAAKG,SAAS,IACrBF,SAAS,KAAKE,SAAS;IACzB,IAAIG,gBAAgB,IAAId,WAAW,KAAK,EAAE,EAAE;MAC1CY,OAAO,CAACC,IAAI,CACV,gGAAgG,GAC9F,gEAAgE,GAChE,4GACJ,CAAC;IACH;EACF,CAAC,EAAE,CACDZ,OAAO,EACPC,YAAY,EACZC,aAAa,EACbC,UAAU,EACVC,SAAS,EACTC,SAAS,EACTC,UAAU,EACVC,OAAO,EACPC,SAAS,EACTT,WAAW,CACZ,CAAC;AACJ,CAAC","ignoreList":[]}
|