react-native-external-keyboard 0.9.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +95 -600
- package/android/build.gradle +0 -18
- package/android/src/main/java/com/externalkeyboard/ExternalKeyboardViewPackage.java +24 -22
- package/android/src/main/java/com/externalkeyboard/events/EventHelper.java +10 -13
- package/android/src/main/java/com/externalkeyboard/helper/FocusHelper.java +1 -2
- package/android/src/main/java/com/externalkeyboard/services/FocusMemoryService.java +64 -0
- package/android/src/main/java/com/externalkeyboard/services/KeyboardFocusService.java +41 -0
- package/android/src/main/java/com/externalkeyboard/services/KeyboardService.java +4 -13
- package/android/src/main/java/com/externalkeyboard/views/ExternalKeyboardView/ExternalKeyboardView.java +2 -8
- package/android/src/main/java/com/externalkeyboard/views/ExternalKeyboardView/ExternalKeyboardViewManager.java +20 -13
- package/android/src/main/java/com/externalkeyboard/views/TextInputFocusWrapper/TextInputFocusWrapper.java +99 -21
- package/android/src/main/java/com/externalkeyboard/views/TextInputFocusWrapper/TextInputFocusWrapperManager.java +11 -0
- package/android/src/main/java/com/externalkeyboard/views/base/FocusHighlightBase.java +11 -5
- package/android/src/main/java/com/externalkeyboard/views/base/FocusableBase.java +36 -0
- package/android/src/main/java/com/externalkeyboard/views/base/keyboard/ViewFocusChangeBase.java +2 -3
- package/android/src/main/java/com/externalkeyboard/views/base/keyboard/ViewFocusRequestBase.java +10 -61
- package/android/src/newarch/ExternalKeyboardLockViewManagerInterface.java +11 -0
- package/android/src/newarch/ExternalKeyboardLockViewManagerSpec.java +0 -1
- package/android/src/newarch/ExternalKeyboardViewManagerInterface.java +42 -0
- package/android/src/newarch/ExternalKeyboardViewManagerSpec.java +0 -1
- package/android/src/newarch/KeyboardFocusGroupManagerInterface.java +12 -0
- package/android/src/newarch/KeyboardFocusGroupManagerSpec.java +0 -1
- package/android/src/newarch/TextInputFocusWrapperManagerInterface.java +34 -0
- package/android/src/newarch/TextInputFocusWrapperManagerSpec.java +0 -10
- package/android/src/newarch/helper/ReactNativeEventDispatcher.java +28 -0
- package/android/src/oldarch/ExternalKeyboardViewManagerSpec.java +6 -4
- package/android/src/oldarch/TextInputFocusWrapperManagerSpec.java +4 -0
- package/android/src/oldarch/helper/ReactNativeEventDispatcher.java +15 -0
- package/ios/Delegates/RNCEKVFocusDelegate/RNCEKVFocusDelegate.mm +1 -1
- package/ios/Delegates/RNCEKVFocusDelegate/RNCEKVFocusProtocol.h +1 -1
- package/ios/Delegates/RNCEKVHaloDelegate/RNCEKVHaloDelegate.h +2 -1
- package/ios/Delegates/RNCEKVHaloDelegate/RNCEKVHaloDelegate.mm +41 -5
- package/ios/Delegates/RNCEKVHaloDelegate/RNCEKVHaloProtocol.h +1 -0
- package/ios/Extensions/RCTCustomScrollView+RNCEKVExternalKeyboard.mm +5 -6
- package/ios/Extensions/RCTEnhancedScrollView+RNCEKVExternalKeyboard.mm +8 -9
- package/ios/Extensions/RCTTextInputComponentView+RNCEKVExternalKeyboard.mm +1 -1
- package/ios/Extensions/RCTViewComponentView+RNCEKVExternalKeyboard.h +0 -1
- package/ios/Extensions/RCTViewComponentView+RNCEKVExternalKeyboard.mm +16 -4
- package/ios/Extensions/UIViewController+RNCEKVExternalKeyboard.mm +7 -10
- package/ios/Helpers/RNCEKVNativeProps/RNCEKVNativeProps.h +4 -4
- package/ios/Helpers/RNCEKVSwizzleInstanceMethod/RNCEKVSwizzleInstanceMethod.h +19 -0
- package/ios/Protocols/RNCEKVCustomFocusEffectProtocol.h +1 -1
- package/ios/Services/RNCEKVFocusMemoryService.h +39 -0
- package/ios/Services/RNCEKVFocusMemoryService.mm +42 -0
- package/ios/Services/RNCEKVKeyboardFocusService.h +28 -0
- package/ios/Services/RNCEKVKeyboardFocusService.mm +54 -0
- package/ios/Views/Base/FocusChange/RNCEKVViewFocusChangeBase.h +2 -0
- package/ios/Views/Base/FocusChange/RNCEKVViewFocusChangeBase.mm +12 -10
- package/ios/Views/Base/FocusRequest/RNCEKVViewFocusRequestBase.h +1 -1
- package/ios/Views/Base/FocusRequest/RNCEKVViewFocusRequestBase.mm +6 -17
- package/ios/Views/Base/KeyboardHallo/RNCEKVExternalKeyboardHalloBase.h +1 -0
- package/ios/Views/Base/KeyboardHallo/RNCEKVExternalKeyboardHalloBase.mm +146 -6
- package/ios/Views/Base/ViewGroup/RNCEKVViewGroupBase.h +2 -0
- package/ios/Views/Base/ViewGroup/RNCEKVViewGroupBase.mm +4 -0
- package/ios/Views/RNCEKVExternalKeyboardView/RNCEKVExternalKeyboardView.h +1 -1
- package/ios/Views/RNCEKVExternalKeyboardView/RNCEKVExternalKeyboardView.mm +8 -4
- package/ios/Views/RNCEKVExternalKeyboardView/RNCEKVExternalKeyboardViewManager.mm +22 -11
- package/ios/Views/RNCEKVTextInputFocusWrapper/RNCEKVTextInputFocusWrapper.mm +17 -0
- package/ios/Views/RNCEKVTextInputFocusWrapper/RNCEKVTextInputFocusWrapperManager.mm +12 -0
- package/lib/commonjs/components/BaseKeyboardView/BaseKeyboardView.js +67 -65
- package/lib/commonjs/components/BaseKeyboardView/BaseKeyboardView.js.map +1 -1
- package/lib/commonjs/components/KeyboardExtendedInput/KeyboardExtendedInput.js +49 -97
- package/lib/commonjs/components/KeyboardExtendedInput/KeyboardExtendedInput.js.map +1 -1
- package/lib/commonjs/components/KeyboardFocusGroup/KeyboardFocusGroup.android.js.map +1 -1
- package/lib/commonjs/components/KeyboardFocusGroup/KeyboardFocusGroup.ios.js.map +1 -1
- package/lib/commonjs/components/KeyboardFocusGroup/KeyboardFocusGroup.js.map +1 -1
- package/lib/commonjs/components/{KeyboardExtendedInput/KeyboardExtendedInput.types.js → KeyboardFocusGroup/KeyboardFocusGroup.types.js} +1 -1
- package/lib/commonjs/components/KeyboardFocusGroup/KeyboardFocusGroup.types.js.map +1 -0
- package/lib/commonjs/components/KeyboardFocusLock/FocusFrame/FocusFrame.android.js +2 -1
- package/lib/commonjs/components/KeyboardFocusLock/FocusFrame/FocusFrame.android.js.map +1 -1
- package/lib/commonjs/components/KeyboardFocusLock/FocusTrap/FocusTrap.android.js +2 -1
- package/lib/commonjs/components/KeyboardFocusLock/FocusTrap/FocusTrap.android.js.map +1 -1
- package/lib/commonjs/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.js +2 -1
- package/lib/commonjs/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.js.map +1 -1
- package/lib/commonjs/components/KeyboardFocusView/KeyboardFocusView.js +14 -51
- package/lib/commonjs/components/KeyboardFocusView/KeyboardFocusView.js.map +1 -1
- package/lib/commonjs/components/index.js +47 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/index.js +37 -19
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/nativeSpec/ExternalKeyboardLockViewNativeComponent.ts +1 -3
- package/lib/commonjs/nativeSpec/ExternalKeyboardViewNativeComponent.ts +12 -9
- package/lib/commonjs/nativeSpec/KeyboardFocusGroupNativeComponent.ts +5 -3
- package/lib/commonjs/nativeSpec/TextInputFocusWrapperNativeComponent.ts +7 -3
- package/lib/commonjs/types/KeyboardFocusLock.types.js +13 -0
- package/lib/commonjs/types/KeyboardFocusLock.types.js.map +1 -1
- package/lib/commonjs/types/baseKeyboardView.types.js +6 -0
- package/lib/commonjs/types/baseKeyboardView.types.js.map +1 -0
- package/lib/commonjs/types/{FocusStyle.js → focus.types.js} +1 -1
- package/lib/commonjs/types/{FocusStyle.js.map → focus.types.js.map} +1 -1
- package/lib/commonjs/types/focusOrder.types.js +33 -0
- package/lib/commonjs/types/focusOrder.types.js.map +1 -0
- package/lib/commonjs/types/{WithKeyboardFocus.js → focusStyle.types.js} +1 -1
- package/lib/commonjs/types/{WithKeyboardFocus.js.map → focusStyle.types.js.map} +1 -1
- package/lib/commonjs/types/index.js +18 -0
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/commonjs/types/keyPress.types.js +6 -0
- package/lib/{module/types/WithKeyboardFocus.js.map → commonjs/types/keyPress.types.js.map} +1 -1
- package/lib/commonjs/types/keyboardInput.types.js +6 -0
- package/lib/commonjs/types/keyboardInput.types.js.map +1 -0
- package/lib/commonjs/types/withKeyboardFocus.types.js +6 -0
- package/lib/commonjs/types/withKeyboardFocus.types.js.map +1 -0
- package/lib/commonjs/utils/mapLockFocus.js +37 -0
- package/lib/commonjs/utils/mapLockFocus.js.map +1 -0
- package/lib/commonjs/utils/useFocusStyle.js +4 -21
- package/lib/commonjs/utils/useFocusStyle.js.map +1 -1
- package/lib/commonjs/utils/useKeyboardFocusContainer.js +79 -0
- package/lib/commonjs/utils/useKeyboardFocusContainer.js.map +1 -0
- package/lib/commonjs/utils/useKeyboardPress/useKeyboardPress.android.js +4 -7
- package/lib/commonjs/utils/useKeyboardPress/useKeyboardPress.android.js.map +1 -1
- package/lib/commonjs/utils/useKeyboardPress/useKeyboardPress.ios.js +3 -6
- package/lib/commonjs/utils/useKeyboardPress/useKeyboardPress.ios.js.map +1 -1
- package/lib/commonjs/utils/useKeyboardPress/useKeyboardPress.js +9 -7
- package/lib/commonjs/utils/useKeyboardPress/useKeyboardPress.js.map +1 -1
- package/lib/commonjs/utils/useKeyboardPressState.js +65 -0
- package/lib/commonjs/utils/useKeyboardPressState.js.map +1 -0
- package/lib/commonjs/utils/useOnFocusChange.js +1 -1
- package/lib/commonjs/utils/useOnFocusChange.js.map +1 -1
- package/lib/commonjs/utils/useOrderValidation.js +35 -0
- package/lib/commonjs/utils/useOrderValidation.js.map +1 -0
- package/lib/commonjs/utils/useRenderedChildren.js +34 -0
- package/lib/commonjs/utils/useRenderedChildren.js.map +1 -0
- package/lib/commonjs/utils/useWrappedOrderProps.js +35 -0
- package/lib/commonjs/utils/useWrappedOrderProps.js.map +1 -0
- package/lib/commonjs/utils/withKeyboardFocus.js +81 -96
- package/lib/commonjs/utils/withKeyboardFocus.js.map +1 -1
- package/lib/module/components/BaseKeyboardView/BaseKeyboardView.js +57 -55
- package/lib/module/components/BaseKeyboardView/BaseKeyboardView.js.map +1 -1
- package/lib/module/components/KeyboardExtendedInput/KeyboardExtendedInput.js +51 -99
- package/lib/module/components/KeyboardExtendedInput/KeyboardExtendedInput.js.map +1 -1
- package/lib/module/components/KeyboardFocusGroup/KeyboardFocusGroup.android.js.map +1 -1
- package/lib/module/components/KeyboardFocusGroup/KeyboardFocusGroup.ios.js.map +1 -1
- package/lib/module/components/KeyboardFocusGroup/KeyboardFocusGroup.js.map +1 -1
- package/lib/module/components/KeyboardFocusGroup/KeyboardFocusGroup.types.js +4 -0
- package/lib/module/components/KeyboardFocusGroup/KeyboardFocusGroup.types.js.map +1 -0
- package/lib/module/components/KeyboardFocusLock/FocusFrame/FocusFrame.android.js +2 -1
- package/lib/module/components/KeyboardFocusLock/FocusFrame/FocusFrame.android.js.map +1 -1
- package/lib/module/components/KeyboardFocusLock/FocusTrap/FocusTrap.android.js +2 -1
- package/lib/module/components/KeyboardFocusLock/FocusTrap/FocusTrap.android.js.map +1 -1
- package/lib/module/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.js +2 -1
- package/lib/module/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.js.map +1 -1
- package/lib/module/components/KeyboardFocusView/KeyboardFocusView.js +16 -53
- package/lib/module/components/KeyboardFocusView/KeyboardFocusView.js.map +1 -1
- package/lib/module/components/index.js +5 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/index.js +20 -7
- package/lib/module/index.js.map +1 -1
- package/lib/module/nativeSpec/ExternalKeyboardLockViewNativeComponent.ts +1 -3
- package/lib/module/nativeSpec/ExternalKeyboardViewNativeComponent.ts +12 -9
- package/lib/module/nativeSpec/KeyboardFocusGroupNativeComponent.ts +5 -3
- package/lib/module/nativeSpec/TextInputFocusWrapperNativeComponent.ts +7 -3
- package/lib/module/types/KeyboardFocusLock.types.js +12 -1
- package/lib/module/types/KeyboardFocusLock.types.js.map +1 -1
- package/lib/module/types/baseKeyboardView.types.js +4 -0
- package/lib/module/types/baseKeyboardView.types.js.map +1 -0
- package/lib/module/types/focus.types.js +4 -0
- package/lib/module/types/{FocusStyle.js.map → focus.types.js.map} +1 -1
- package/lib/module/types/focusOrder.types.js +31 -0
- package/lib/module/types/focusOrder.types.js.map +1 -0
- package/lib/module/types/focusStyle.types.js +4 -0
- package/lib/module/types/focusStyle.types.js.map +1 -0
- package/lib/module/types/index.js +3 -0
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/types/keyPress.types.js +4 -0
- package/lib/module/types/keyPress.types.js.map +1 -0
- package/lib/module/types/keyboardInput.types.js +4 -0
- package/lib/module/types/keyboardInput.types.js.map +1 -0
- package/lib/module/types/withKeyboardFocus.types.js +4 -0
- package/lib/module/types/withKeyboardFocus.types.js.map +1 -0
- package/lib/module/utils/mapLockFocus.js +32 -0
- package/lib/module/utils/mapLockFocus.js.map +1 -0
- package/lib/module/utils/useFocusStyle.js +4 -21
- package/lib/module/utils/useFocusStyle.js.map +1 -1
- package/lib/module/utils/useKeyboardFocusContainer.js +74 -0
- package/lib/module/utils/useKeyboardFocusContainer.js.map +1 -0
- package/lib/module/utils/useKeyboardPress/useKeyboardPress.android.js +4 -7
- package/lib/module/utils/useKeyboardPress/useKeyboardPress.android.js.map +1 -1
- package/lib/module/utils/useKeyboardPress/useKeyboardPress.ios.js +3 -6
- package/lib/module/utils/useKeyboardPress/useKeyboardPress.ios.js.map +1 -1
- package/lib/module/utils/useKeyboardPress/useKeyboardPress.js +9 -7
- package/lib/module/utils/useKeyboardPress/useKeyboardPress.js.map +1 -1
- package/lib/module/utils/useKeyboardPressState.js +60 -0
- package/lib/module/utils/useKeyboardPressState.js.map +1 -0
- package/lib/module/utils/useOnFocusChange.js +1 -1
- package/lib/module/utils/useOnFocusChange.js.map +1 -1
- package/lib/module/utils/useOrderValidation.js +30 -0
- package/lib/module/utils/useOrderValidation.js.map +1 -0
- package/lib/module/utils/useRenderedChildren.js +29 -0
- package/lib/module/utils/useRenderedChildren.js.map +1 -0
- package/lib/module/utils/useWrappedOrderProps.js +30 -0
- package/lib/module/utils/useWrappedOrderProps.js.map +1 -0
- package/lib/module/utils/withKeyboardFocus.js +84 -99
- package/lib/module/utils/withKeyboardFocus.js.map +1 -1
- package/lib/typescript/src/components/BaseKeyboardView/BaseKeyboardView.d.ts +30 -10
- package/lib/typescript/src/components/BaseKeyboardView/BaseKeyboardView.d.ts.map +1 -1
- package/lib/typescript/src/components/KeyboardExtendedInput/KeyboardExtendedInput.d.ts +187 -12
- package/lib/typescript/src/components/KeyboardExtendedInput/KeyboardExtendedInput.d.ts.map +1 -1
- package/lib/typescript/src/components/KeyboardFocusGroup/KeyboardFocusGroup.android.d.ts +4 -146
- package/lib/typescript/src/components/KeyboardFocusGroup/KeyboardFocusGroup.android.d.ts.map +1 -1
- package/lib/typescript/src/components/KeyboardFocusGroup/KeyboardFocusGroup.d.ts +2 -12
- package/lib/typescript/src/components/KeyboardFocusGroup/KeyboardFocusGroup.d.ts.map +1 -1
- package/lib/typescript/src/components/KeyboardFocusGroup/KeyboardFocusGroup.ios.d.ts +4 -146
- package/lib/typescript/src/components/KeyboardFocusGroup/KeyboardFocusGroup.ios.d.ts.map +1 -1
- package/lib/typescript/src/components/KeyboardFocusGroup/KeyboardFocusGroup.types.d.ts +13 -0
- package/lib/typescript/src/components/KeyboardFocusGroup/KeyboardFocusGroup.types.d.ts.map +1 -0
- package/lib/typescript/src/components/KeyboardFocusLock/FocusFrame/FocusFrame.android.d.ts +1 -1
- package/lib/typescript/src/components/KeyboardFocusLock/FocusFrame/FocusFrame.android.d.ts.map +1 -1
- package/lib/typescript/src/components/KeyboardFocusLock/FocusTrap/FocusTrap.android.d.ts +1 -1
- package/lib/typescript/src/components/KeyboardFocusLock/FocusTrap/FocusTrap.android.d.ts.map +1 -1
- package/lib/typescript/src/components/KeyboardFocusLock/FocusTrap/FocusTrap.d.ts +1 -1
- package/lib/typescript/src/components/KeyboardFocusLock/FocusTrap/FocusTrap.d.ts.map +1 -1
- package/lib/typescript/src/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.d.ts +1 -1
- package/lib/typescript/src/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.d.ts.map +1 -1
- package/lib/typescript/src/components/KeyboardFocusView/KeyboardFocusView.d.ts +28 -18
- package/lib/typescript/src/components/KeyboardFocusView/KeyboardFocusView.d.ts.map +1 -1
- package/lib/typescript/src/components/Touchable/Pressable.d.ts +14 -14
- package/lib/typescript/src/components/Touchable/Pressable.d.ts.map +1 -1
- package/lib/typescript/src/components/index.d.ts +5 -0
- package/lib/typescript/src/components/index.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +694 -9
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/nativeSpec/ExternalKeyboardLockViewNativeComponent.d.ts +2 -4
- package/lib/typescript/src/nativeSpec/ExternalKeyboardLockViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/nativeSpec/ExternalKeyboardViewNativeComponent.d.ts +6 -7
- package/lib/typescript/src/nativeSpec/ExternalKeyboardViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/nativeSpec/KeyboardFocusGroupNativeComponent.d.ts +2 -4
- package/lib/typescript/src/nativeSpec/KeyboardFocusGroupNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/nativeSpec/TextInputFocusWrapperNativeComponent.d.ts +4 -4
- package/lib/typescript/src/nativeSpec/TextInputFocusWrapperNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/types/KeyboardFocusLock.types.d.ts +15 -1
- package/lib/typescript/src/types/KeyboardFocusLock.types.d.ts.map +1 -1
- package/lib/typescript/src/types/KeyboardFocusView.types.d.ts +16 -14
- package/lib/typescript/src/types/KeyboardFocusView.types.d.ts.map +1 -1
- package/lib/typescript/src/types/baseKeyboardView.types.d.ts +119 -0
- package/lib/typescript/src/types/baseKeyboardView.types.d.ts.map +1 -0
- package/lib/typescript/src/types/focus.types.d.ts +35 -0
- package/lib/typescript/src/types/focus.types.d.ts.map +1 -0
- package/lib/typescript/src/types/focusOrder.types.d.ts +57 -0
- package/lib/typescript/src/types/focusOrder.types.d.ts.map +1 -0
- package/lib/typescript/src/types/focusStyle.types.d.ts +11 -0
- package/lib/typescript/src/types/focusStyle.types.d.ts.map +1 -0
- package/lib/typescript/src/types/index.d.ts +11 -2
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/lib/typescript/src/types/keyPress.types.d.ts +7 -0
- package/lib/typescript/src/types/keyPress.types.d.ts.map +1 -0
- package/lib/typescript/src/types/keyboardInput.types.d.ts +53 -0
- package/lib/typescript/src/types/keyboardInput.types.d.ts.map +1 -0
- package/lib/typescript/src/types/withKeyboardFocus.types.d.ts +109 -0
- package/lib/typescript/src/types/withKeyboardFocus.types.d.ts.map +1 -0
- package/lib/typescript/src/utils/mapLockFocus.d.ts +3 -0
- package/lib/typescript/src/utils/mapLockFocus.d.ts.map +1 -0
- package/lib/typescript/src/utils/useFocusStyle.d.ts +26 -34
- package/lib/typescript/src/utils/useFocusStyle.d.ts.map +1 -1
- package/lib/typescript/src/utils/useKeyboardFocusContainer.d.ts +898 -0
- package/lib/typescript/src/utils/useKeyboardFocusContainer.d.ts.map +1 -0
- package/lib/typescript/src/utils/useKeyboardPress/useKeyboardPress.android.d.ts +2 -2
- package/lib/typescript/src/utils/useKeyboardPress/useKeyboardPress.android.d.ts.map +1 -1
- package/lib/typescript/src/utils/useKeyboardPress/useKeyboardPress.d.ts +4 -3
- package/lib/typescript/src/utils/useKeyboardPress/useKeyboardPress.d.ts.map +1 -1
- package/lib/typescript/src/utils/useKeyboardPress/useKeyboardPress.ios.d.ts +3 -3
- package/lib/typescript/src/utils/useKeyboardPress/useKeyboardPress.ios.d.ts.map +1 -1
- package/lib/typescript/src/utils/useKeyboardPress/useKeyboardPress.types.d.ts +1 -2
- package/lib/typescript/src/utils/useKeyboardPress/useKeyboardPress.types.d.ts.map +1 -1
- package/lib/typescript/src/utils/useKeyboardPressState.d.ts +29 -0
- package/lib/typescript/src/utils/useKeyboardPressState.d.ts.map +1 -0
- package/lib/typescript/src/utils/useOnFocusChange.d.ts +3 -3
- package/lib/typescript/src/utils/useOnFocusChange.d.ts.map +1 -1
- package/lib/typescript/src/utils/useOrderValidation.d.ts +8 -0
- package/lib/typescript/src/utils/useOrderValidation.d.ts.map +1 -0
- package/lib/typescript/src/utils/useRenderedChildren.d.ts +18 -0
- package/lib/typescript/src/utils/useRenderedChildren.d.ts.map +1 -0
- package/lib/typescript/src/utils/useWrappedOrderProps.d.ts +13 -0
- package/lib/typescript/src/utils/useWrappedOrderProps.d.ts.map +1 -0
- package/lib/typescript/src/utils/withKeyboardFocus.d.ts +3 -4
- package/lib/typescript/src/utils/withKeyboardFocus.d.ts.map +1 -1
- package/package.json +4 -2
- package/src/components/BaseKeyboardView/BaseKeyboardView.tsx +74 -94
- package/src/components/KeyboardExtendedInput/KeyboardExtendedInput.tsx +49 -149
- package/src/components/KeyboardFocusGroup/KeyboardFocusGroup.android.tsx +23 -32
- package/src/components/KeyboardFocusGroup/KeyboardFocusGroup.ios.tsx +32 -41
- package/src/components/KeyboardFocusGroup/KeyboardFocusGroup.tsx +3 -14
- package/src/components/KeyboardFocusGroup/KeyboardFocusGroup.types.ts +15 -0
- package/src/components/KeyboardFocusLock/FocusFrame/FocusFrame.android.tsx +2 -2
- package/src/components/KeyboardFocusLock/FocusTrap/FocusTrap.android.tsx +2 -2
- package/src/components/KeyboardFocusLock/FocusTrap/FocusTrap.tsx +1 -1
- package/src/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.tsx +2 -2
- package/src/components/KeyboardFocusView/KeyboardFocusView.tsx +29 -68
- package/src/components/Touchable/Pressable.tsx +2 -2
- package/src/components/index.ts +12 -0
- package/src/index.tsx +44 -32
- package/src/nativeSpec/ExternalKeyboardLockViewNativeComponent.ts +1 -3
- package/src/nativeSpec/ExternalKeyboardViewNativeComponent.ts +12 -9
- package/src/nativeSpec/KeyboardFocusGroupNativeComponent.ts +5 -3
- package/src/nativeSpec/TextInputFocusWrapperNativeComponent.ts +7 -3
- package/src/types/KeyboardFocusLock.types.ts +16 -1
- package/src/types/KeyboardFocusView.types.ts +17 -18
- package/src/types/baseKeyboardView.types.ts +122 -0
- package/src/types/focus.types.ts +40 -0
- package/src/types/focusOrder.types.ts +59 -0
- package/src/types/{FocusStyle.ts → focusStyle.types.ts} +5 -0
- package/src/types/index.ts +32 -2
- package/src/types/keyPress.types.ts +8 -0
- package/src/types/keyboardInput.types.ts +81 -0
- package/src/types/withKeyboardFocus.types.ts +178 -0
- package/src/utils/mapLockFocus.ts +31 -0
- package/src/utils/useFocusStyle.tsx +13 -41
- package/src/utils/useKeyboardFocusContainer.ts +102 -0
- package/src/utils/useKeyboardPress/useKeyboardPress.android.ts +4 -7
- package/src/utils/useKeyboardPress/useKeyboardPress.ios.ts +3 -6
- package/src/utils/useKeyboardPress/useKeyboardPress.ts +9 -7
- package/src/utils/useKeyboardPress/useKeyboardPress.types.ts +1 -2
- package/src/utils/useKeyboardPressState.ts +81 -0
- package/src/utils/useOnFocusChange.ts +4 -7
- package/src/utils/useOrderValidation.ts +74 -0
- package/src/utils/useRenderedChildren.ts +42 -0
- package/src/utils/useWrappedOrderProps.ts +48 -0
- package/src/utils/withKeyboardFocus.tsx +105 -125
- package/lib/commonjs/components/KeyboardExtendedInput/KeyboardExtendedInput.types.js.map +0 -1
- package/lib/commonjs/components/KeyboardFocusView/hooks/index.js +0 -13
- package/lib/commonjs/components/KeyboardFocusView/hooks/index.js.map +0 -1
- package/lib/commonjs/components/KeyboardFocusView/hooks/useFocusStyle/index.js +0 -13
- package/lib/commonjs/components/KeyboardFocusView/hooks/useFocusStyle/index.js.map +0 -1
- package/lib/commonjs/components/KeyboardFocusView/hooks/useFocusStyle/useFocusStyle.js +0 -33
- package/lib/commonjs/components/KeyboardFocusView/hooks/useFocusStyle/useFocusStyle.js.map +0 -1
- package/lib/commonjs/components/KeyboardFocusView/hooks/useFocusStyle/useTintStyle.js +0 -39
- package/lib/commonjs/components/KeyboardFocusView/hooks/useFocusStyle/useTintStyle.js.map +0 -1
- package/lib/commonjs/components/RenderPropComponent/RenderPropComponent.js +0 -23
- package/lib/commonjs/components/RenderPropComponent/RenderPropComponent.js.map +0 -1
- package/lib/commonjs/types/BaseKeyboardView.js +0 -18
- package/lib/commonjs/types/BaseKeyboardView.js.map +0 -1
- package/lib/module/components/KeyboardExtendedInput/KeyboardExtendedInput.types.js +0 -4
- package/lib/module/components/KeyboardExtendedInput/KeyboardExtendedInput.types.js.map +0 -1
- package/lib/module/components/KeyboardFocusView/hooks/index.js +0 -4
- package/lib/module/components/KeyboardFocusView/hooks/index.js.map +0 -1
- package/lib/module/components/KeyboardFocusView/hooks/useFocusStyle/index.js +0 -4
- package/lib/module/components/KeyboardFocusView/hooks/useFocusStyle/index.js.map +0 -1
- package/lib/module/components/KeyboardFocusView/hooks/useFocusStyle/useFocusStyle.js +0 -28
- package/lib/module/components/KeyboardFocusView/hooks/useFocusStyle/useFocusStyle.js.map +0 -1
- package/lib/module/components/KeyboardFocusView/hooks/useFocusStyle/useTintStyle.js +0 -34
- package/lib/module/components/KeyboardFocusView/hooks/useFocusStyle/useTintStyle.js.map +0 -1
- package/lib/module/components/RenderPropComponent/RenderPropComponent.js +0 -17
- package/lib/module/components/RenderPropComponent/RenderPropComponent.js.map +0 -1
- package/lib/module/types/BaseKeyboardView.js +0 -14
- package/lib/module/types/BaseKeyboardView.js.map +0 -1
- package/lib/module/types/FocusStyle.js +0 -4
- package/lib/module/types/WithKeyboardFocus.js +0 -4
- package/lib/typescript/src/components/KeyboardExtendedInput/KeyboardExtendedInput.types.d.ts +0 -45
- package/lib/typescript/src/components/KeyboardExtendedInput/KeyboardExtendedInput.types.d.ts.map +0 -1
- package/lib/typescript/src/components/KeyboardFocusView/hooks/index.d.ts +0 -2
- package/lib/typescript/src/components/KeyboardFocusView/hooks/index.d.ts.map +0 -1
- package/lib/typescript/src/components/KeyboardFocusView/hooks/useFocusStyle/index.d.ts +0 -2
- package/lib/typescript/src/components/KeyboardFocusView/hooks/useFocusStyle/index.d.ts.map +0 -1
- package/lib/typescript/src/components/KeyboardFocusView/hooks/useFocusStyle/useFocusStyle.d.ts +0 -175
- package/lib/typescript/src/components/KeyboardFocusView/hooks/useFocusStyle/useFocusStyle.d.ts.map +0 -1
- package/lib/typescript/src/components/KeyboardFocusView/hooks/useFocusStyle/useTintStyle.d.ts +0 -181
- package/lib/typescript/src/components/KeyboardFocusView/hooks/useFocusStyle/useTintStyle.d.ts.map +0 -1
- package/lib/typescript/src/components/RenderPropComponent/RenderPropComponent.d.ts +0 -6
- package/lib/typescript/src/components/RenderPropComponent/RenderPropComponent.d.ts.map +0 -1
- package/lib/typescript/src/types/BaseKeyboardView.d.ts +0 -70
- package/lib/typescript/src/types/BaseKeyboardView.d.ts.map +0 -1
- package/lib/typescript/src/types/FocusStyle.d.ts +0 -6
- package/lib/typescript/src/types/FocusStyle.d.ts.map +0 -1
- package/lib/typescript/src/types/WithKeyboardFocus.d.ts +0 -47
- package/lib/typescript/src/types/WithKeyboardFocus.d.ts.map +0 -1
- package/src/components/KeyboardExtendedInput/KeyboardExtendedInput.types.ts +0 -73
- package/src/components/KeyboardFocusView/hooks/index.ts +0 -1
- package/src/components/KeyboardFocusView/hooks/useFocusStyle/index.ts +0 -1
- package/src/components/KeyboardFocusView/hooks/useFocusStyle/useFocusStyle.ts +0 -34
- package/src/components/KeyboardFocusView/hooks/useFocusStyle/useTintStyle.ts +0 -41
- package/src/components/RenderPropComponent/RenderPropComponent.tsx +0 -18
- package/src/types/BaseKeyboardView.ts +0 -74
- package/src/types/WithKeyboardFocus.ts +0 -115
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WithKeyboardFocus.d.ts","sourceRoot":"","sources":["../../../../src/types/WithKeyboardFocus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,IA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C,CAAC,cAAc,EAAE,aAAa,EAAE,QAAQ,CAAC,CAC1E,GACD,KAAK,CAAC,yBAAyB,CAC7B,gCAAgC,CAAC,cAAc,EAAE,aAAa,EAAE,QAAQ,CAAC,CAC1E,CAAC;AAEN,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,YAAY,GAAG,MAAM,CAAC"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type TextInputProps,
|
|
3
|
-
type StyleProp,
|
|
4
|
-
type ViewStyle,
|
|
5
|
-
type ColorValue,
|
|
6
|
-
} from 'react-native';
|
|
7
|
-
|
|
8
|
-
import type { FocusStyle } from '../../types/FocusStyle';
|
|
9
|
-
import type { TintType } from '../../types/WithKeyboardFocus';
|
|
10
|
-
import { type RenderProp } from '../RenderPropComponent/RenderPropComponent';
|
|
11
|
-
import type { blurMap, focusMap } from './KeyboardExtendedInput.consts';
|
|
12
|
-
import type { LockFocusType } from '../../types/BaseKeyboardView';
|
|
13
|
-
|
|
14
|
-
export type ExtraKeyboardProps = {
|
|
15
|
-
focusType?: keyof typeof focusMap;
|
|
16
|
-
blurType?: keyof typeof blurMap;
|
|
17
|
-
containerStyle?: StyleProp<ViewStyle>;
|
|
18
|
-
onFocusChange?: (isFocused: boolean) => void;
|
|
19
|
-
focusStyle?: FocusStyle;
|
|
20
|
-
haloEffect?: boolean;
|
|
21
|
-
canBeFocusable?: boolean;
|
|
22
|
-
focusable?: boolean;
|
|
23
|
-
tintColor?: ColorValue;
|
|
24
|
-
tintType?: TintType;
|
|
25
|
-
containerFocusStyle?: FocusStyle;
|
|
26
|
-
FocusHoverComponent?: RenderProp;
|
|
27
|
-
submitBehavior?: string;
|
|
28
|
-
groupIdentifier?: string;
|
|
29
|
-
lockFocus?: LockFocusType[];
|
|
30
|
-
orderGroup?: string;
|
|
31
|
-
orderIndex?: number;
|
|
32
|
-
orderId?: string;
|
|
33
|
-
orderForward?: string;
|
|
34
|
-
orderBackward?: string;
|
|
35
|
-
orderLeft?: string;
|
|
36
|
-
orderRight?: string;
|
|
37
|
-
orderUp?: string;
|
|
38
|
-
orderDown?: string;
|
|
39
|
-
orderFirst?: string | null;
|
|
40
|
-
orderLast?: string | null;
|
|
41
|
-
orderPrefix?: string;
|
|
42
|
-
defaultFocusHighlightEnabled?: boolean;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
type IgnoreForCompatibility =
|
|
46
|
-
| 'rejectResponderTermination'
|
|
47
|
-
| 'selectionHandleColor'
|
|
48
|
-
| 'cursorColor'
|
|
49
|
-
| 'maxFontSizeMultiplier';
|
|
50
|
-
|
|
51
|
-
type CompatibleInputProp<
|
|
52
|
-
TextInputPropsType extends object,
|
|
53
|
-
CompatibilityProp extends IgnoreForCompatibility
|
|
54
|
-
> = CompatibilityProp extends keyof TextInputPropsType
|
|
55
|
-
? TextInputPropsType[CompatibilityProp]
|
|
56
|
-
: CompatibilityProp extends keyof TextInputProps
|
|
57
|
-
? TextInputProps[CompatibilityProp]
|
|
58
|
-
: never;
|
|
59
|
-
|
|
60
|
-
type ReactNativeInputCompatibility<
|
|
61
|
-
TextInputPropsType extends object = TextInputProps
|
|
62
|
-
> = Omit<TextInputPropsType, IgnoreForCompatibility> & {
|
|
63
|
-
[CompatibilityProp in IgnoreForCompatibility]?: CompatibleInputProp<
|
|
64
|
-
TextInputPropsType,
|
|
65
|
-
CompatibilityProp
|
|
66
|
-
> | null;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export type KeyboardInputPropsDeclaration<
|
|
70
|
-
TextInputPropsType extends object = TextInputProps
|
|
71
|
-
> = ReactNativeInputCompatibility<TextInputPropsType> & ExtraKeyboardProps;
|
|
72
|
-
|
|
73
|
-
export type KeyboardInputProps = KeyboardInputPropsDeclaration<TextInputProps>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useFocusStyle } from './useFocusStyle';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useFocusStyle } from './useFocusStyle';
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { useState, useMemo, useCallback } from 'react';
|
|
2
|
-
import { StyleSheet } from 'react-native';
|
|
3
|
-
import type { FocusStyle } from '../../../../types';
|
|
4
|
-
|
|
5
|
-
export const useFocusStyle = (
|
|
6
|
-
focusStyle?: FocusStyle,
|
|
7
|
-
onFocusChange?: (isFocused: boolean) => void
|
|
8
|
-
) => {
|
|
9
|
-
const [focused, setFocusStatus] = useState(false);
|
|
10
|
-
|
|
11
|
-
const onFocusChangeHandler = useCallback(
|
|
12
|
-
(isFocused: boolean) => {
|
|
13
|
-
setFocusStatus(isFocused);
|
|
14
|
-
onFocusChange?.(isFocused);
|
|
15
|
-
},
|
|
16
|
-
[onFocusChange]
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
const fStyle = useMemo(() => {
|
|
20
|
-
if (!focusStyle) return focused ? styles.defaultHighlight : undefined;
|
|
21
|
-
const specificStyle =
|
|
22
|
-
typeof focusStyle === 'function' ? focusStyle({ focused }) : focusStyle;
|
|
23
|
-
return focused ? specificStyle : undefined;
|
|
24
|
-
}, [focused, focusStyle]);
|
|
25
|
-
|
|
26
|
-
return {
|
|
27
|
-
onFocusChangeHandler,
|
|
28
|
-
fStyle,
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const styles = StyleSheet.create({
|
|
33
|
-
defaultHighlight: { backgroundColor: '#dce3f9' },
|
|
34
|
-
});
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { useState, useMemo, useCallback } from 'react';
|
|
2
|
-
import type { FocusStyle } from '../../../../types';
|
|
3
|
-
|
|
4
|
-
export const useTintStyle = ({
|
|
5
|
-
focusStyle,
|
|
6
|
-
haloEffect,
|
|
7
|
-
onFocusChange,
|
|
8
|
-
tintBackground = '#dce3f9',
|
|
9
|
-
}: {
|
|
10
|
-
haloEffect?: boolean;
|
|
11
|
-
focusStyle?: FocusStyle;
|
|
12
|
-
tintBackground?: string;
|
|
13
|
-
onFocusChange?: (isFocused: boolean) => void;
|
|
14
|
-
}) => {
|
|
15
|
-
const [focused, setFocusStatus] = useState(false);
|
|
16
|
-
|
|
17
|
-
const onFocusChangeHandler = useCallback(
|
|
18
|
-
(isFocused: boolean) => {
|
|
19
|
-
setFocusStatus(isFocused);
|
|
20
|
-
onFocusChange?.(isFocused);
|
|
21
|
-
},
|
|
22
|
-
[onFocusChange]
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
const fStyle = useMemo(() => {
|
|
26
|
-
if (!focusStyle) return undefined;
|
|
27
|
-
const specificStyle =
|
|
28
|
-
typeof focusStyle === 'function' ? focusStyle({ focused }) : focusStyle;
|
|
29
|
-
return focused ? specificStyle : undefined;
|
|
30
|
-
}, [focused, focusStyle]);
|
|
31
|
-
|
|
32
|
-
const tintStyle = useMemo(() => {
|
|
33
|
-
if (haloEffect) return;
|
|
34
|
-
return focused ? { backgroundColor: tintBackground } : undefined;
|
|
35
|
-
}, [haloEffect, focused, tintBackground]);
|
|
36
|
-
return {
|
|
37
|
-
onFocusChangeHandler,
|
|
38
|
-
tintStyle,
|
|
39
|
-
fStyle,
|
|
40
|
-
};
|
|
41
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React, { type FunctionComponent, type ReactElement } from 'react';
|
|
2
|
-
|
|
3
|
-
export type RenderProp =
|
|
4
|
-
| ReactElement
|
|
5
|
-
| FunctionComponent
|
|
6
|
-
| FunctionComponent<{}>
|
|
7
|
-
| (() => ReactElement);
|
|
8
|
-
|
|
9
|
-
export const RenderPropComponent = ({ render }: { render: RenderProp }) => {
|
|
10
|
-
if (React.isValidElement(render)) {
|
|
11
|
-
return render;
|
|
12
|
-
} else if (typeof render === 'function') {
|
|
13
|
-
const Component = render;
|
|
14
|
-
return <Component />;
|
|
15
|
-
} else {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
View,
|
|
3
|
-
ViewProps,
|
|
4
|
-
NativeSyntheticEvent,
|
|
5
|
-
ColorValue,
|
|
6
|
-
} from 'react-native';
|
|
7
|
-
import type { KeyPress } from '../nativeSpec/ExternalKeyboardViewNativeComponent';
|
|
8
|
-
import type { RefObject } from 'react';
|
|
9
|
-
import type { Int32 } from 'react-native/Libraries/Types/CodegenTypes';
|
|
10
|
-
|
|
11
|
-
export type OnKeyPress = NativeSyntheticEvent<KeyPress> & {
|
|
12
|
-
nativeEvent?: { target?: number };
|
|
13
|
-
currentTarget?: { _nativeTag?: number };
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export type OnKeyPressFn = (e: OnKeyPress) => void;
|
|
17
|
-
export type KeyboardFocus = { focus: () => void };
|
|
18
|
-
export type BaseKeyboardViewType = Partial<View> & KeyboardFocus;
|
|
19
|
-
|
|
20
|
-
export enum LockFocusEnum {
|
|
21
|
-
Up = 'up',
|
|
22
|
-
Down = 'down',
|
|
23
|
-
Right = 'right',
|
|
24
|
-
Left = 'left',
|
|
25
|
-
Forward = 'forward',
|
|
26
|
-
Backward = 'backward',
|
|
27
|
-
First = 'first',
|
|
28
|
-
Last = 'last',
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export type LockFocusType = `${LockFocusEnum}`;
|
|
32
|
-
|
|
33
|
-
export type BaseFocusViewProps = {
|
|
34
|
-
viewRef?: RefObject<View>;
|
|
35
|
-
group?: boolean;
|
|
36
|
-
onFocusChange?: (isFocused: boolean, tag?: number) => void;
|
|
37
|
-
onKeyUpPress?: OnKeyPressFn;
|
|
38
|
-
onKeyDownPress?: OnKeyPressFn;
|
|
39
|
-
onContextMenuPress?: () => void;
|
|
40
|
-
onBubbledContextMenuPress?: () => void;
|
|
41
|
-
haloEffect?: boolean;
|
|
42
|
-
autoFocus?: boolean;
|
|
43
|
-
canBeFocused?: boolean;
|
|
44
|
-
focusable?: boolean;
|
|
45
|
-
onFocus?: () => void;
|
|
46
|
-
onBlur?: () => void;
|
|
47
|
-
tintColor?: ColorValue;
|
|
48
|
-
haloCornerRadius?: number;
|
|
49
|
-
haloExpendX?: number;
|
|
50
|
-
haloExpendY?: number;
|
|
51
|
-
groupIdentifier?: string;
|
|
52
|
-
ignoreGroupFocusHint?: boolean;
|
|
53
|
-
exposeMethods?: string[];
|
|
54
|
-
enableA11yFocus?: boolean;
|
|
55
|
-
enableContextMenu?: boolean;
|
|
56
|
-
screenAutoA11yFocus?: boolean;
|
|
57
|
-
screenAutoA11yFocusDelay?: number;
|
|
58
|
-
orderGroup?: string;
|
|
59
|
-
orderIndex?: Int32;
|
|
60
|
-
lockFocus?: LockFocusType[];
|
|
61
|
-
orderId?: string;
|
|
62
|
-
orderLeft?: string;
|
|
63
|
-
orderRight?: string;
|
|
64
|
-
orderUp?: string;
|
|
65
|
-
orderDown?: string;
|
|
66
|
-
orderForward?: string;
|
|
67
|
-
orderBackward?: string;
|
|
68
|
-
orderFirst?: string | null;
|
|
69
|
-
orderLast?: string | null;
|
|
70
|
-
orderPrefix?: string;
|
|
71
|
-
defaultFocusHighlightEnabled?: boolean;
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export type BaseKeyboardViewProps = ViewProps & BaseFocusViewProps;
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import type { PressableProps, View, ViewProps } from 'react-native';
|
|
2
|
-
import type { FocusStyle } from './FocusStyle';
|
|
3
|
-
import type { KeyboardFocus, OnKeyPress } from './BaseKeyboardView';
|
|
4
|
-
import type { FocusViewProps } from './KeyboardFocusView.types';
|
|
5
|
-
import type { RefAttributes } from 'react';
|
|
6
|
-
|
|
7
|
-
export type RenderProp =
|
|
8
|
-
| React.ReactElement
|
|
9
|
-
| React.FunctionComponent
|
|
10
|
-
| (() => React.ReactElement);
|
|
11
|
-
|
|
12
|
-
type KeyboardPressHandler = (e?: OnKeyPress) => void;
|
|
13
|
-
|
|
14
|
-
type PressHandlerProp<
|
|
15
|
-
ComponentProps extends object,
|
|
16
|
-
PropName extends 'onPress' | 'onLongPress' | 'onPressIn' | 'onPressOut'
|
|
17
|
-
> = PropName extends keyof ComponentProps
|
|
18
|
-
? ComponentProps[PropName]
|
|
19
|
-
: KeyboardPressHandler;
|
|
20
|
-
|
|
21
|
-
type PickProp<
|
|
22
|
-
ComponentProps extends object,
|
|
23
|
-
PropName extends string
|
|
24
|
-
> = PropName extends keyof ComponentProps ? ComponentProps[PropName] : unknown;
|
|
25
|
-
|
|
26
|
-
export type WithKeyboardFocusComponent<ComponentProps extends object> =
|
|
27
|
-
| React.JSXElementConstructor<ComponentProps>
|
|
28
|
-
| React.ForwardRefExoticComponent<ComponentProps>;
|
|
29
|
-
|
|
30
|
-
export type KeyboardPressType<ComponentProps extends object> = {
|
|
31
|
-
onPress?: PressHandlerProp<ComponentProps, 'onPress'>;
|
|
32
|
-
onLongPress?: PressHandlerProp<ComponentProps, 'onLongPress'>;
|
|
33
|
-
onPressIn?: PressHandlerProp<ComponentProps, 'onPressIn'>;
|
|
34
|
-
onPressOut?: PressHandlerProp<ComponentProps, 'onPressOut'>;
|
|
35
|
-
onComponentFocus?: PickProp<ComponentProps, 'onFocus'>;
|
|
36
|
-
onComponentBlur?: PickProp<ComponentProps, 'onBlur'>;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
/** Extracts the state argument from a component's children render prop, or `never`. */
|
|
40
|
-
type ExtractRenderPropState<T> = T extends (state: infer S) => any ? S : never;
|
|
41
|
-
|
|
42
|
-
export type ChildrenRenderState<CP extends object> = 'children' extends keyof CP
|
|
43
|
-
? ExtractRenderPropState<NonNullable<CP['children']>>
|
|
44
|
-
: never;
|
|
45
|
-
|
|
46
|
-
export type WithKeyboardProps<
|
|
47
|
-
ViewType = View,
|
|
48
|
-
ViewStyleType = unknown,
|
|
49
|
-
ComponentProps extends object = {}
|
|
50
|
-
> = {
|
|
51
|
-
withPressedStyle?: boolean;
|
|
52
|
-
containerStyle?: ViewStyleType | ViewProps['style'];
|
|
53
|
-
containerFocusStyle?: FocusStyle;
|
|
54
|
-
tintType?: TintType;
|
|
55
|
-
componentRef?: React.RefObject<ViewType>;
|
|
56
|
-
FocusHoverComponent?: RenderProp;
|
|
57
|
-
style?: PressableProps['style'];
|
|
58
|
-
onBlur?: (() => void) | ((e: any) => void) | null;
|
|
59
|
-
onFocus?: (() => void) | ((e: any) => void) | null;
|
|
60
|
-
renderContent?: ChildrenRenderState<ComponentProps> extends never
|
|
61
|
-
? never
|
|
62
|
-
: (
|
|
63
|
-
state: ChildrenRenderState<ComponentProps> & { focused: boolean }
|
|
64
|
-
) => React.ReactNode;
|
|
65
|
-
renderFocusable?: (state: { focused: boolean }) => React.ReactNode;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
type KeyboardFocusBaseProps = Omit<
|
|
69
|
-
FocusViewProps,
|
|
70
|
-
'onPress' | 'onLongPress' | 'onBlur' | 'onFocus'
|
|
71
|
-
>;
|
|
72
|
-
|
|
73
|
-
type MergeProps<BaseProps extends object, OverrideProps extends object> = Omit<
|
|
74
|
-
BaseProps,
|
|
75
|
-
keyof OverrideProps
|
|
76
|
-
> &
|
|
77
|
-
OverrideProps;
|
|
78
|
-
|
|
79
|
-
type KeyboardFocusOverrideProps<
|
|
80
|
-
ComponentProps extends object,
|
|
81
|
-
ViewStyleType,
|
|
82
|
-
ViewType = View
|
|
83
|
-
> = KeyboardPressType<ComponentProps> &
|
|
84
|
-
KeyboardFocusBaseProps &
|
|
85
|
-
WithKeyboardProps<ViewType, ViewStyleType, ComponentProps>;
|
|
86
|
-
|
|
87
|
-
export type WithKeyboardFocus<
|
|
88
|
-
ComponentProps extends object,
|
|
89
|
-
ViewStyleType,
|
|
90
|
-
ViewType = View
|
|
91
|
-
> = MergeProps<
|
|
92
|
-
ComponentProps,
|
|
93
|
-
KeyboardFocusOverrideProps<ComponentProps, ViewStyleType, ViewType>
|
|
94
|
-
>;
|
|
95
|
-
|
|
96
|
-
export type WithKeyboardPropsTypeDeclaration<
|
|
97
|
-
ComponentProps extends object,
|
|
98
|
-
ViewStyleType,
|
|
99
|
-
ViewType = View
|
|
100
|
-
> = WithKeyboardFocus<ComponentProps, ViewStyleType, ViewType> &
|
|
101
|
-
RefAttributes<KeyboardFocus>;
|
|
102
|
-
|
|
103
|
-
export type WithKeyboardFocusDeclaration<
|
|
104
|
-
ComponentProps extends object,
|
|
105
|
-
ViewStyleType,
|
|
106
|
-
ViewType = View
|
|
107
|
-
> =
|
|
108
|
-
| React.JSXElementConstructor<
|
|
109
|
-
WithKeyboardPropsTypeDeclaration<ComponentProps, ViewStyleType, ViewType>
|
|
110
|
-
>
|
|
111
|
-
| React.ForwardRefExoticComponent<
|
|
112
|
-
WithKeyboardPropsTypeDeclaration<ComponentProps, ViewStyleType, ViewType>
|
|
113
|
-
>;
|
|
114
|
-
|
|
115
|
-
export type TintType = 'default' | 'hover' | 'background' | 'none';
|