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,49 +1,16 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import {
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { TextInput, Platform } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { TextInputFocusWrapperNative } from '../../nativeSpec';
|
|
5
5
|
import { useFocusStyle } from '../../utils/useFocusStyle';
|
|
6
6
|
import { focusEventMapper } from '../../utils/focusEventMapper';
|
|
7
|
-
import { RenderPropComponent } from '../RenderPropComponent/RenderPropComponent';
|
|
8
7
|
import { useGroupIdentifierContext } from '../../context/GroupIdentifierContext';
|
|
9
8
|
import { useOrderFocusGroup } from '../../context/OrderFocusContext';
|
|
10
|
-
import
|
|
9
|
+
import { mapLockFocus } from '../../utils/mapLockFocus';
|
|
10
|
+
import { useOrderValidation } from '../../utils/useOrderValidation';
|
|
11
|
+
import { useWrappedOrderProps } from '../../utils/useWrappedOrderProps';
|
|
12
|
+
import type { KeyboardInputProps } from '../../types';
|
|
11
13
|
import { blurMap, focusMap } from './KeyboardExtendedInput.consts';
|
|
12
|
-
import { wrapOrderPrefix } from '../../utils/wrapOrderPrefix';
|
|
13
|
-
import {
|
|
14
|
-
LockFocusEnum,
|
|
15
|
-
type LockFocusType,
|
|
16
|
-
} from '../../types/BaseKeyboardView';
|
|
17
|
-
|
|
18
|
-
enum BITS {
|
|
19
|
-
BIT_01 = 0b1,
|
|
20
|
-
BIT_02 = 0b10,
|
|
21
|
-
BIT_03 = 0b100,
|
|
22
|
-
BIT_04 = 0b1000,
|
|
23
|
-
BIT_05 = 0b10000,
|
|
24
|
-
BIT_06 = 0b100000,
|
|
25
|
-
BIT_07 = 0b1000000,
|
|
26
|
-
BIT_08 = 0b10000000,
|
|
27
|
-
BIT_09 = 0b100000000,
|
|
28
|
-
BIT_10 = 0b1000000000,
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const focusBinaryValue: Record<LockFocusEnum, number> = {
|
|
32
|
-
[LockFocusEnum.Up]: BITS.BIT_01,
|
|
33
|
-
[LockFocusEnum.Down]: BITS.BIT_02,
|
|
34
|
-
[LockFocusEnum.Left]: BITS.BIT_03,
|
|
35
|
-
[LockFocusEnum.Right]: BITS.BIT_04,
|
|
36
|
-
[LockFocusEnum.Forward]: BITS.BIT_05,
|
|
37
|
-
[LockFocusEnum.Backward]: BITS.BIT_06,
|
|
38
|
-
[LockFocusEnum.First]: BITS.BIT_09,
|
|
39
|
-
[LockFocusEnum.Last]: BITS.BIT_10,
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const mapLockFocus = (values: LockFocusType[] | undefined): number => {
|
|
43
|
-
if (!values || !values.length) return 0;
|
|
44
|
-
// eslint-disable-next-line no-bitwise
|
|
45
|
-
return values.reduce((acc, item) => acc | focusBinaryValue[item], 0);
|
|
46
|
-
};
|
|
47
14
|
|
|
48
15
|
const isIOS = Platform.OS === 'ios';
|
|
49
16
|
|
|
@@ -60,12 +27,10 @@ export const KeyboardExtendedInput = React.forwardRef<
|
|
|
60
27
|
focusStyle,
|
|
61
28
|
style,
|
|
62
29
|
haloEffect = true,
|
|
63
|
-
|
|
30
|
+
roundedHaloFix = false,
|
|
64
31
|
focusable = true,
|
|
65
32
|
containerFocusStyle,
|
|
66
33
|
tintColor,
|
|
67
|
-
tintType = 'default',
|
|
68
|
-
FocusHoverComponent,
|
|
69
34
|
onSubmitEditing,
|
|
70
35
|
submitBehavior,
|
|
71
36
|
groupIdentifier,
|
|
@@ -79,88 +44,51 @@ export const KeyboardExtendedInput = React.forwardRef<
|
|
|
79
44
|
orderRight,
|
|
80
45
|
orderUp,
|
|
81
46
|
orderDown,
|
|
47
|
+
orderFirst,
|
|
48
|
+
orderLast,
|
|
82
49
|
rejectResponderTermination,
|
|
83
50
|
selectionHandleColor,
|
|
84
51
|
cursorColor,
|
|
85
52
|
maxFontSizeMultiplier,
|
|
86
|
-
orderFirst,
|
|
87
|
-
orderLast,
|
|
88
53
|
defaultFocusHighlightEnabled = true,
|
|
54
|
+
tintType,
|
|
89
55
|
orderPrefix: _orderPrefix,
|
|
90
56
|
...props
|
|
91
57
|
},
|
|
92
58
|
ref
|
|
93
59
|
) => {
|
|
94
60
|
const {
|
|
95
|
-
focused,
|
|
96
61
|
containerFocusedStyle,
|
|
97
62
|
componentFocusedStyle,
|
|
98
63
|
onFocusChangeHandler,
|
|
99
|
-
hoverColor,
|
|
100
64
|
} = useFocusStyle({
|
|
101
65
|
onFocusChange,
|
|
102
|
-
tintColor,
|
|
103
66
|
focusStyle,
|
|
104
67
|
containerFocusStyle,
|
|
105
|
-
tintType,
|
|
106
68
|
});
|
|
107
69
|
|
|
108
70
|
const contextIdentifier = useGroupIdentifierContext();
|
|
109
71
|
const contextGroupId = useOrderFocusGroup();
|
|
110
72
|
const groupId = orderGroup ?? contextGroupId;
|
|
111
|
-
|
|
112
73
|
const orderPrefix = _orderPrefix ?? contextGroupId ?? '';
|
|
113
74
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
75
|
+
useOrderValidation({
|
|
76
|
+
groupId,
|
|
77
|
+
orderPrefix,
|
|
78
|
+
orderIndex,
|
|
79
|
+
orderId,
|
|
80
|
+
orderForward,
|
|
81
|
+
orderBackward,
|
|
82
|
+
orderFirst,
|
|
83
|
+
orderLast,
|
|
84
|
+
orderLeft,
|
|
85
|
+
orderRight,
|
|
86
|
+
orderUp,
|
|
87
|
+
orderDown,
|
|
117
88
|
});
|
|
118
89
|
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
[onFocusChangeHandler]
|
|
122
|
-
);
|
|
123
|
-
|
|
124
|
-
const HoverComonent = useMemo(() => {
|
|
125
|
-
if (FocusHoverComponent) return FocusHoverComponent;
|
|
126
|
-
if (tintType === 'hover')
|
|
127
|
-
return <View style={[hoverColor, styles.absolute, styles.opacity]} />;
|
|
128
|
-
|
|
129
|
-
return undefined;
|
|
130
|
-
}, [FocusHoverComponent, hoverColor, tintType]);
|
|
131
|
-
|
|
132
|
-
const blurOnSubmit = submitBehavior
|
|
133
|
-
? submitBehavior === 'blurAndSubmit'
|
|
134
|
-
: props.blurOnSubmit ?? true;
|
|
135
|
-
|
|
136
|
-
useEffect(() => {
|
|
137
|
-
if (!__DEV__) return;
|
|
138
|
-
if (orderIndex !== undefined && !groupId)
|
|
139
|
-
console.warn(
|
|
140
|
-
'`orderIndex` must be declared alongside `orderGroup` for proper functionality. Ensure components are wrapped with `KeyboardOrderFocusGroup` or provide `orderGroup` directly.'
|
|
141
|
-
);
|
|
142
|
-
}, [groupId, orderIndex]);
|
|
143
|
-
|
|
144
|
-
useEffect(() => {
|
|
145
|
-
if (!__DEV__) return;
|
|
146
|
-
const hasOrderLinkProp =
|
|
147
|
-
orderId !== undefined ||
|
|
148
|
-
orderForward !== undefined ||
|
|
149
|
-
orderBackward !== undefined ||
|
|
150
|
-
orderFirst !== undefined ||
|
|
151
|
-
orderLast !== undefined ||
|
|
152
|
-
orderLeft !== undefined ||
|
|
153
|
-
orderRight !== undefined ||
|
|
154
|
-
orderUp !== undefined ||
|
|
155
|
-
orderDown !== undefined;
|
|
156
|
-
if (hasOrderLinkProp && orderPrefix === '') {
|
|
157
|
-
console.warn(
|
|
158
|
-
'[react-native-external-keyboard] orderId, orderForward, orderBackward, orderFirst, orderLast, ' +
|
|
159
|
-
'orderLeft, orderRight, orderUp, and orderDown are global IDs. ' +
|
|
160
|
-
'Wrap the component in <KeyboardOrderFocusGroup> or pass orderPrefix to avoid ID collisions across screens.'
|
|
161
|
-
);
|
|
162
|
-
}
|
|
163
|
-
}, [
|
|
90
|
+
const wrappedOrderProps = useWrappedOrderProps({
|
|
91
|
+
orderPrefix,
|
|
164
92
|
orderId,
|
|
165
93
|
orderForward,
|
|
166
94
|
orderBackward,
|
|
@@ -170,55 +98,43 @@ export const KeyboardExtendedInput = React.forwardRef<
|
|
|
170
98
|
orderRight,
|
|
171
99
|
orderUp,
|
|
172
100
|
orderDown,
|
|
173
|
-
|
|
174
|
-
]);
|
|
101
|
+
});
|
|
175
102
|
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
[orderPrefix]
|
|
103
|
+
const hasFocusListener = Boolean(
|
|
104
|
+
onFocusChange || focusStyle || containerFocusStyle
|
|
179
105
|
);
|
|
180
106
|
|
|
181
|
-
const
|
|
182
|
-
() => (
|
|
183
|
-
|
|
184
|
-
orderForward: wrapPrefix(orderForward),
|
|
185
|
-
orderBackward: wrapPrefix(orderBackward),
|
|
186
|
-
orderLeft: wrapPrefix(orderLeft),
|
|
187
|
-
orderRight: wrapPrefix(orderRight),
|
|
188
|
-
orderUp: wrapPrefix(orderUp),
|
|
189
|
-
orderDown: wrapPrefix(orderDown),
|
|
190
|
-
orderFirst: wrapPrefix(
|
|
191
|
-
orderFirst === null ? undefined : orderFirst ?? orderForward
|
|
192
|
-
),
|
|
193
|
-
orderLast: wrapPrefix(
|
|
194
|
-
orderLast === null ? undefined : orderLast ?? orderBackward
|
|
195
|
-
),
|
|
196
|
-
}),
|
|
197
|
-
[
|
|
198
|
-
wrapPrefix,
|
|
199
|
-
orderId,
|
|
200
|
-
orderForward,
|
|
201
|
-
orderBackward,
|
|
202
|
-
orderLeft,
|
|
203
|
-
orderRight,
|
|
204
|
-
orderUp,
|
|
205
|
-
orderDown,
|
|
206
|
-
orderFirst,
|
|
207
|
-
orderLast,
|
|
208
|
-
]
|
|
107
|
+
const nativeFocusHandler = useMemo(
|
|
108
|
+
() => focusEventMapper(onFocusChangeHandler),
|
|
109
|
+
[onFocusChangeHandler]
|
|
209
110
|
);
|
|
210
111
|
|
|
112
|
+
const blurOnSubmit = submitBehavior
|
|
113
|
+
? submitBehavior === 'blurAndSubmit'
|
|
114
|
+
: props.blurOnSubmit ?? true;
|
|
115
|
+
|
|
116
|
+
const withHaloEffect =
|
|
117
|
+
tintType !== 'none' &&
|
|
118
|
+
Platform.select({
|
|
119
|
+
ios: haloEffect,
|
|
120
|
+
android: defaultFocusHighlightEnabled,
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
const isContainerFocusable = !isIOS && focusable ? undefined : false;
|
|
124
|
+
|
|
211
125
|
return (
|
|
212
126
|
<TextInputFocusWrapperNative
|
|
213
|
-
onFocusChange={
|
|
127
|
+
onFocusChange={hasFocusListener ? nativeFocusHandler : undefined}
|
|
128
|
+
hasOnFocusChanged={hasFocusListener}
|
|
214
129
|
focusType={focusMap[focusType]}
|
|
215
130
|
blurType={blurMap[blurType]}
|
|
216
131
|
style={[containerStyle, containerFocusedStyle]}
|
|
217
132
|
haloEffect={withHaloEffect}
|
|
133
|
+
roundedHaloFix={withHaloEffect === false && roundedHaloFix}
|
|
218
134
|
multiline={props.multiline}
|
|
219
135
|
blurOnSubmit={blurOnSubmit}
|
|
220
136
|
onMultiplyTextSubmit={onSubmitEditing}
|
|
221
|
-
canBeFocused={
|
|
137
|
+
canBeFocused={isContainerFocusable}
|
|
222
138
|
tintColor={isIOS ? tintColor : undefined}
|
|
223
139
|
groupIdentifier={groupIdentifier ?? contextIdentifier}
|
|
224
140
|
lockFocus={mapLockFocus(lockFocus)}
|
|
@@ -228,7 +144,7 @@ export const KeyboardExtendedInput = React.forwardRef<
|
|
|
228
144
|
>
|
|
229
145
|
<TextInput
|
|
230
146
|
ref={ref as React.RefObject<any>}
|
|
231
|
-
editable={
|
|
147
|
+
editable={focusable}
|
|
232
148
|
style={[style, componentFocusedStyle]}
|
|
233
149
|
onSubmitEditing={onSubmitEditing}
|
|
234
150
|
submitBehavior={submitBehavior}
|
|
@@ -238,23 +154,7 @@ export const KeyboardExtendedInput = React.forwardRef<
|
|
|
238
154
|
maxFontSizeMultiplier={maxFontSizeMultiplier ?? undefined}
|
|
239
155
|
{...props}
|
|
240
156
|
/>
|
|
241
|
-
{focused && HoverComonent && (
|
|
242
|
-
<RenderPropComponent render={HoverComonent} />
|
|
243
|
-
)}
|
|
244
157
|
</TextInputFocusWrapperNative>
|
|
245
158
|
);
|
|
246
159
|
}
|
|
247
160
|
);
|
|
248
|
-
|
|
249
|
-
const styles = StyleSheet.create({
|
|
250
|
-
absolute: {
|
|
251
|
-
position: 'absolute',
|
|
252
|
-
top: 0,
|
|
253
|
-
left: 0,
|
|
254
|
-
right: 0,
|
|
255
|
-
bottom: 0,
|
|
256
|
-
},
|
|
257
|
-
opacity: {
|
|
258
|
-
opacity: 0.3,
|
|
259
|
-
},
|
|
260
|
-
});
|
|
@@ -1,39 +1,30 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { type ColorValue, type ViewProps } from 'react-native';
|
|
1
|
+
import React from 'react';
|
|
3
2
|
import { KeyboardFocusGroupNative } from '../../nativeSpec';
|
|
4
3
|
import { useOnFocusChange } from '../../utils/useOnFocusChange';
|
|
5
4
|
import { useFocusStyle } from '../../utils/useFocusStyle';
|
|
6
|
-
import type {
|
|
5
|
+
import type { KeyboardFocusGroupProps } from './KeyboardFocusGroup.types';
|
|
7
6
|
|
|
8
|
-
export type KeyboardFocusGroupProps
|
|
9
|
-
groupIdentifier?: string;
|
|
10
|
-
tintColor?: ColorValue;
|
|
11
|
-
onFocus?: () => void;
|
|
12
|
-
onBlur?: () => void;
|
|
13
|
-
onFocusChange?: (isFocused: boolean) => void;
|
|
14
|
-
orderGroup?: string;
|
|
15
|
-
focusStyle?: FocusStyle;
|
|
16
|
-
}>;
|
|
7
|
+
export type { KeyboardFocusGroupProps };
|
|
17
8
|
|
|
18
|
-
export const KeyboardFocusGroup = React.memo<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
});
|
|
9
|
+
export const KeyboardFocusGroup = React.memo<KeyboardFocusGroupProps>(
|
|
10
|
+
(props) => {
|
|
11
|
+
const { containerFocusedStyle: focusStyle, onFocusChangeHandler } =
|
|
12
|
+
useFocusStyle({
|
|
13
|
+
onFocusChange: props.onFocusChange,
|
|
14
|
+
containerFocusStyle: props.focusStyle,
|
|
15
|
+
});
|
|
26
16
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
17
|
+
const onGroupFocusChangeHandler = useOnFocusChange({
|
|
18
|
+
...props,
|
|
19
|
+
onFocusChange: onFocusChangeHandler,
|
|
20
|
+
});
|
|
31
21
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
22
|
+
return (
|
|
23
|
+
<KeyboardFocusGroupNative
|
|
24
|
+
{...props}
|
|
25
|
+
style={[props.style, focusStyle]}
|
|
26
|
+
onGroupFocusChange={onGroupFocusChangeHandler}
|
|
27
|
+
/>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
);
|
|
@@ -1,53 +1,44 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { type ColorValue, type ViewProps } from 'react-native';
|
|
1
|
+
import React from 'react';
|
|
3
2
|
import { KeyboardFocusGroupNative } from '../../nativeSpec';
|
|
4
3
|
import { GroupIdentifierContext } from '../../context/GroupIdentifierContext';
|
|
5
4
|
import { useOnFocusChange } from '../../utils/useOnFocusChange';
|
|
6
5
|
import { useFocusStyle } from '../../utils/useFocusStyle';
|
|
7
|
-
import type {
|
|
6
|
+
import type { KeyboardFocusGroupProps } from './KeyboardFocusGroup.types';
|
|
8
7
|
|
|
9
|
-
export type KeyboardFocusGroupProps
|
|
10
|
-
groupIdentifier?: string;
|
|
11
|
-
tintColor?: ColorValue;
|
|
12
|
-
onFocus?: () => void;
|
|
13
|
-
onBlur?: () => void;
|
|
14
|
-
onFocusChange?: (isFocused: boolean) => void;
|
|
15
|
-
focusStyle?: FocusStyle;
|
|
16
|
-
orderGroup?: string;
|
|
17
|
-
}>;
|
|
8
|
+
export type { KeyboardFocusGroupProps };
|
|
18
9
|
|
|
19
|
-
export const KeyboardFocusGroup = React.memo<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const { groupIdentifier } = props;
|
|
10
|
+
export const KeyboardFocusGroup = React.memo<KeyboardFocusGroupProps>(
|
|
11
|
+
(props) => {
|
|
12
|
+
const { groupIdentifier } = props;
|
|
23
13
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
14
|
+
const { containerFocusedStyle: focusStyle, onFocusChangeHandler } =
|
|
15
|
+
useFocusStyle({
|
|
16
|
+
onFocusChange: props.onFocusChange,
|
|
17
|
+
containerFocusStyle: props.focusStyle,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const onGroupFocusChangeHandler = useOnFocusChange({
|
|
21
|
+
...props,
|
|
22
|
+
onFocusChange: onFocusChangeHandler,
|
|
28
23
|
});
|
|
29
24
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
if (!groupIdentifier)
|
|
26
|
+
return (
|
|
27
|
+
<KeyboardFocusGroupNative
|
|
28
|
+
{...props}
|
|
29
|
+
style={[props.style, focusStyle]}
|
|
30
|
+
onGroupFocusChange={onGroupFocusChangeHandler}
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
34
33
|
|
|
35
|
-
if (!groupIdentifier)
|
|
36
34
|
return (
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
<GroupIdentifierContext.Provider value={groupIdentifier}>
|
|
36
|
+
<KeyboardFocusGroupNative
|
|
37
|
+
{...props}
|
|
38
|
+
style={[props.style, focusStyle]}
|
|
39
|
+
onGroupFocusChange={onGroupFocusChangeHandler}
|
|
40
|
+
/>
|
|
41
|
+
</GroupIdentifierContext.Provider>
|
|
42
42
|
);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
<GroupIdentifierContext.Provider value={groupIdentifier}>
|
|
46
|
-
<KeyboardFocusGroupNative
|
|
47
|
-
{...props}
|
|
48
|
-
style={[props.style, focusStyle]}
|
|
49
|
-
onGroupFocusChange={onGroupFocusChangeHandler}
|
|
50
|
-
/>
|
|
51
|
-
</GroupIdentifierContext.Provider>
|
|
52
|
-
);
|
|
53
|
-
});
|
|
43
|
+
}
|
|
44
|
+
);
|
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import type { FocusStyle } from '../../types';
|
|
1
|
+
import { View } from 'react-native';
|
|
2
|
+
import type { KeyboardFocusGroupProps } from './KeyboardFocusGroup.types';
|
|
4
3
|
|
|
5
|
-
export type KeyboardFocusGroupProps
|
|
6
|
-
ViewProps & {
|
|
7
|
-
groupIdentifier?: string;
|
|
8
|
-
tintColor?: ColorValue;
|
|
9
|
-
onFocus?: () => void;
|
|
10
|
-
onBlur?: () => void;
|
|
11
|
-
onFocusChange?: (isFocused: boolean) => void;
|
|
12
|
-
focusStyle?: FocusStyle;
|
|
13
|
-
orderGroup?: string;
|
|
14
|
-
}
|
|
15
|
-
>;
|
|
4
|
+
export type { KeyboardFocusGroupProps };
|
|
16
5
|
|
|
17
6
|
export const KeyboardFocusGroup =
|
|
18
7
|
View as unknown as React.FC<KeyboardFocusGroupProps>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { PropsWithChildren } from 'react';
|
|
2
|
+
import type { ColorValue, ViewProps } from 'react-native';
|
|
3
|
+
import type { FocusStyle } from '../../types';
|
|
4
|
+
|
|
5
|
+
export type KeyboardFocusGroupProps = PropsWithChildren<
|
|
6
|
+
ViewProps & {
|
|
7
|
+
groupIdentifier?: string;
|
|
8
|
+
tintColor?: ColorValue;
|
|
9
|
+
onFocus?: () => void;
|
|
10
|
+
onBlur?: () => void;
|
|
11
|
+
onFocusChange?: (isFocused: boolean) => void;
|
|
12
|
+
focusStyle?: FocusStyle;
|
|
13
|
+
orderGroup?: string;
|
|
14
|
+
}
|
|
15
|
+
>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FrameProvider } from '../../../context/FocusFrameProviderContext';
|
|
3
3
|
import { KeyboardFocusLockBase } from '../KeyboardFocusLockBase/KeyboardFocusLockBase';
|
|
4
|
-
import type
|
|
4
|
+
import { LockComponentType, type KeyboardFocusLockProps } from '../../../types';
|
|
5
5
|
|
|
6
6
|
export const FocusFrame = React.memo<KeyboardFocusLockProps>(
|
|
7
7
|
({ lockDisabled = false, ...props }) => {
|
|
@@ -9,7 +9,7 @@ export const FocusFrame = React.memo<KeyboardFocusLockProps>(
|
|
|
9
9
|
<FrameProvider>
|
|
10
10
|
<KeyboardFocusLockBase
|
|
11
11
|
{...props}
|
|
12
|
-
componentType={
|
|
12
|
+
componentType={LockComponentType.Frame}
|
|
13
13
|
lockDisabled={lockDisabled}
|
|
14
14
|
/>
|
|
15
15
|
</FrameProvider>
|
|
@@ -2,14 +2,14 @@ import React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { FocusTrapMountWrapper } from './FocusTrapMountWrapper';
|
|
4
4
|
import { KeyboardFocusLockBase } from '../KeyboardFocusLockBase/KeyboardFocusLockBase';
|
|
5
|
-
import type
|
|
5
|
+
import { LockComponentType, type KeyboardFocusLockProps } from '../../../types';
|
|
6
6
|
|
|
7
7
|
export const FocusTrap = React.memo<KeyboardFocusLockProps>(
|
|
8
8
|
({ lockDisabled = false, ...props }) => (
|
|
9
9
|
<FocusTrapMountWrapper>
|
|
10
10
|
<KeyboardFocusLockBase
|
|
11
11
|
{...props}
|
|
12
|
-
componentType={
|
|
12
|
+
componentType={LockComponentType.Trap}
|
|
13
13
|
lockDisabled={lockDisabled}
|
|
14
14
|
/>
|
|
15
15
|
</FocusTrapMountWrapper>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { View } from 'react-native';
|
|
2
2
|
import { FocusTrapMountWrapper } from './FocusTrapMountWrapper';
|
|
3
|
-
import type { KeyboardFocusLockProps } from '../../../types
|
|
3
|
+
import type { KeyboardFocusLockProps } from '../../../types';
|
|
4
4
|
import { KeyboardFocusLockBase } from '../KeyboardFocusLockBase/KeyboardFocusLockBase';
|
|
5
5
|
|
|
6
6
|
export const FocusTrap = ({
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import ExternalKeyboardLockView from '../../../nativeSpec/ExternalKeyboardLockViewNativeComponent';
|
|
3
3
|
|
|
4
|
-
import type
|
|
4
|
+
import { LockComponentType, type KeyboardFocusLockProps } from '../../../types';
|
|
5
5
|
|
|
6
6
|
export const KeyboardFocusLockBase = React.memo<KeyboardFocusLockProps>(
|
|
7
7
|
({
|
|
8
8
|
lockDisabled = false,
|
|
9
|
-
componentType =
|
|
9
|
+
componentType = LockComponentType.Trap,
|
|
10
10
|
forceLock = false,
|
|
11
11
|
...props
|
|
12
12
|
}) => {
|