react-native-external-keyboard 0.8.4 → 0.8.5-rc

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.

Potentially problematic release.


This version of react-native-external-keyboard might be problematic. Click here for more details.

Files changed (26) hide show
  1. package/android/src/main/java/com/externalkeyboard/delegates/FocusOrderDelegate.java +2 -4
  2. package/android/src/main/java/com/externalkeyboard/delegates/FocusOrderDelegateHost.java +14 -0
  3. package/android/src/main/java/com/externalkeyboard/views/ExternalKeyboardView/ExternalKeyboardView.java +2 -1
  4. package/android/src/main/java/com/externalkeyboard/views/TextInputFocusWrapper/TextInputFocusWrapper.java +150 -3
  5. package/android/src/main/java/com/externalkeyboard/views/TextInputFocusWrapper/TextInputFocusWrapperManager.java +92 -0
  6. package/android/src/oldarch/TextInputFocusWrapperManagerSpec.java +24 -0
  7. package/ios/Delegates/RNCEKVFocusOrderDelegate/RNCEKVFocusOrderDelegate.mm +2 -2
  8. package/ios/Views/RNCEKVExternalKeyboardView/RNCEKVExternalKeyboardView.mm +5 -6
  9. package/ios/Views/RNCEKVTextInputFocusWrapper/RNCEKVTextInputFocusWrapper.h +38 -2
  10. package/ios/Views/RNCEKVTextInputFocusWrapper/RNCEKVTextInputFocusWrapper.mm +167 -10
  11. package/ios/Views/RNCEKVTextInputFocusWrapper/RNCEKVTextInputFocusWrapperManager.mm +69 -0
  12. package/lib/commonjs/components/KeyboardExtendedInput/KeyboardExtendedInput.js +51 -0
  13. package/lib/commonjs/components/KeyboardExtendedInput/KeyboardExtendedInput.js.map +1 -1
  14. package/lib/commonjs/nativeSpec/TextInputFocusWrapperNativeComponent.ts +12 -0
  15. package/lib/module/components/KeyboardExtendedInput/KeyboardExtendedInput.js +51 -0
  16. package/lib/module/components/KeyboardExtendedInput/KeyboardExtendedInput.js.map +1 -1
  17. package/lib/module/nativeSpec/TextInputFocusWrapperNativeComponent.ts +12 -0
  18. package/lib/typescript/src/components/KeyboardExtendedInput/KeyboardExtendedInput.d.ts.map +1 -1
  19. package/lib/typescript/src/components/KeyboardExtendedInput/KeyboardExtendedInput.types.d.ts +11 -0
  20. package/lib/typescript/src/components/KeyboardExtendedInput/KeyboardExtendedInput.types.d.ts.map +1 -1
  21. package/lib/typescript/src/nativeSpec/TextInputFocusWrapperNativeComponent.d.ts +12 -0
  22. package/lib/typescript/src/nativeSpec/TextInputFocusWrapperNativeComponent.d.ts.map +1 -1
  23. package/package.json +1 -1
  24. package/src/components/KeyboardExtendedInput/KeyboardExtendedInput.tsx +56 -0
  25. package/src/components/KeyboardExtendedInput/KeyboardExtendedInput.types.ts +11 -0
  26. package/src/nativeSpec/TextInputFocusWrapperNativeComponent.ts +12 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-external-keyboard",
3
- "version": "0.8.4",
3
+ "version": "0.8.5-rc",
4
4
  "description": "Toolkit for improving physical keyboard support in React Native",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -6,8 +6,43 @@ import { useFocusStyle } from '../../utils/useFocusStyle';
6
6
  import { focusEventMapper } from '../../utils/focusEventMapper';
7
7
  import { RenderPropComponent } from '../RenderPropComponent/RenderPropComponent';
8
8
  import { useGroupIdentifierContext } from '../../context/GroupIdentifierContext';
9
+ import { useOrderFocusGroup } from '../../context/OrderFocusContext';
9
10
  import type { KeyboardInputProps } from './KeyboardExtendedInput.types';
10
11
  import { blurMap, focusMap } from './KeyboardExtendedInput.consts';
12
+ import {
13
+ LockFocusEnum,
14
+ type LockFocusType,
15
+ } from '../../types/BaseKeyboardView';
16
+
17
+ enum BITS {
18
+ BIT_01 = 0b1,
19
+ BIT_02 = 0b10,
20
+ BIT_03 = 0b100,
21
+ BIT_04 = 0b1000,
22
+ BIT_05 = 0b10000,
23
+ BIT_06 = 0b100000,
24
+ BIT_07 = 0b1000000,
25
+ BIT_08 = 0b10000000,
26
+ BIT_09 = 0b100000000,
27
+ BIT_10 = 0b1000000000,
28
+ }
29
+
30
+ const focusBinaryValue: Record<LockFocusEnum, number> = {
31
+ [LockFocusEnum.Up]: BITS.BIT_01,
32
+ [LockFocusEnum.Down]: BITS.BIT_02,
33
+ [LockFocusEnum.Left]: BITS.BIT_03,
34
+ [LockFocusEnum.Right]: BITS.BIT_04,
35
+ [LockFocusEnum.Forward]: BITS.BIT_05,
36
+ [LockFocusEnum.Backward]: BITS.BIT_06,
37
+ [LockFocusEnum.First]: BITS.BIT_09,
38
+ [LockFocusEnum.Last]: BITS.BIT_10,
39
+ };
40
+
41
+ const mapLockFocus = (values: LockFocusType[] | undefined): number => {
42
+ if (!values || !values.length) return 0;
43
+ // eslint-disable-next-line no-bitwise
44
+ return values.reduce((acc, item) => acc | focusBinaryValue[item], 0);
45
+ };
11
46
 
12
47
  const isIOS = Platform.OS === 'ios';
13
48
 
@@ -33,6 +68,16 @@ export const KeyboardExtendedInput = React.forwardRef<
33
68
  onSubmitEditing,
34
69
  submitBehavior,
35
70
  groupIdentifier,
71
+ lockFocus,
72
+ orderGroup,
73
+ orderIndex,
74
+ orderId,
75
+ orderForward,
76
+ orderBackward,
77
+ orderLeft,
78
+ orderRight,
79
+ orderUp,
80
+ orderDown,
36
81
  rejectResponderTermination,
37
82
  selectionHandleColor,
38
83
  cursorColor,
@@ -56,6 +101,7 @@ export const KeyboardExtendedInput = React.forwardRef<
56
101
  });
57
102
 
58
103
  const contextIdentifier = useGroupIdentifierContext();
104
+ const contextOrderGroup = useOrderFocusGroup();
59
105
 
60
106
  const withHaloEffect = tintType === 'default' && haloEffect;
61
107
 
@@ -89,6 +135,16 @@ export const KeyboardExtendedInput = React.forwardRef<
89
135
  canBeFocused={canBeFocusable && focusable}
90
136
  tintColor={isIOS ? tintColor : undefined}
91
137
  groupIdentifier={groupIdentifier ?? contextIdentifier}
138
+ lockFocus={mapLockFocus(lockFocus)}
139
+ orderGroup={orderGroup ?? contextOrderGroup}
140
+ orderIndex={orderIndex}
141
+ orderId={orderId}
142
+ orderForward={orderForward}
143
+ orderBackward={orderBackward}
144
+ orderLeft={orderLeft}
145
+ orderRight={orderRight}
146
+ orderUp={orderUp}
147
+ orderDown={orderDown}
92
148
  >
93
149
  <TextInput
94
150
  ref={ref as React.RefObject<any>}
@@ -9,6 +9,7 @@ import type { FocusStyle } from '../../types/FocusStyle';
9
9
  import type { TintType } from '../../types/WithKeyboardFocus';
10
10
  import { type RenderProp } from '../RenderPropComponent/RenderPropComponent';
11
11
  import type { blurMap, focusMap } from './KeyboardExtendedInput.consts';
12
+ import type { LockFocusType } from '../../types/BaseKeyboardView';
12
13
 
13
14
  export type ExtraKeyboardProps = {
14
15
  focusType?: keyof typeof focusMap;
@@ -25,6 +26,16 @@ export type ExtraKeyboardProps = {
25
26
  FocusHoverComponent?: RenderProp;
26
27
  submitBehavior?: string;
27
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;
28
39
  };
29
40
 
30
41
  type IgnoreForCompatibility =
@@ -25,6 +25,18 @@ export interface TextInputFocusWrapperNativeComponent extends ViewProps {
25
25
  blurOnSubmit?: boolean;
26
26
  multiline?: boolean;
27
27
  groupIdentifier?: string;
28
+ lockFocus?: Int32;
29
+ orderGroup?: string;
30
+ orderIndex?: Int32;
31
+ orderId?: string;
32
+ orderLeft?: string;
33
+ orderRight?: string;
34
+ orderUp?: string;
35
+ orderDown?: string;
36
+ orderForward?: string;
37
+ orderBackward?: string;
38
+ orderFirst?: string;
39
+ orderLast?: string;
28
40
  }
29
41
 
30
42
  export default codegenNativeComponent<TextInputFocusWrapperNativeComponent>(