react-native-external-keyboard 0.2.3 → 0.2.4
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 +87 -20
- package/lib/commonjs/components/Pressable/Pressable.android.js +9 -2
- package/lib/commonjs/components/Pressable/Pressable.android.js.map +1 -1
- package/lib/module/components/Pressable/Pressable.android.js +9 -2
- package/lib/module/components/Pressable/Pressable.android.js.map +1 -1
- package/lib/typescript/components/Pressable/Pressable.android.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Pressable/Pressable.android.tsx +8 -2
package/README.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
### react-native-external-keyboard
|
|
3
3
|
|
|
4
4
|
React Native library for extended external keyboard support.
|
|
5
|
+
The `new` and `old` architectures are compatible!
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
| iOS | Android |
|
|
9
|
+
| ------------- | -------------- |
|
|
10
|
+
| <img src="/.github/images/ios_example.gif" height="500" />| <img src="/.github/images/android_example.gif" height="500" />|
|
|
5
11
|
|
|
6
12
|
|
|
7
13
|
|
|
@@ -26,7 +32,7 @@ cd ios && pod install && cd ..
|
|
|
26
32
|
### Pressable
|
|
27
33
|
Updated pressable component with handling long press events on a keyboard
|
|
28
34
|
```js
|
|
29
|
-
import { Pressable
|
|
35
|
+
import { Pressable } from "react-native-external-keyboard";
|
|
30
36
|
|
|
31
37
|
// ...
|
|
32
38
|
|
|
@@ -41,6 +47,18 @@ import { Pressable, } from "react-native-external-keyboard";
|
|
|
41
47
|
</Pressable>
|
|
42
48
|
```
|
|
43
49
|
|
|
50
|
+
You can pass the default ReactNative `PressableProps` and some extra:
|
|
51
|
+
|
|
52
|
+
| Props | Description | Type |
|
|
53
|
+
| ------------- | ------------- | ---- |
|
|
54
|
+
| canBeFocused?: | Boolean property whether component can be focused by keyboard | `boolean \| undefined` default `true` |
|
|
55
|
+
| onFocusChange?: | Callback for focus change handling | `(e:NativeSyntheticEvent<{ isFocused: boolean; }>) => void \| undefined` |
|
|
56
|
+
| focusStyle?: | Style for selected by keyboard component | `((state: { focused: boolean}) => StyleProp<ViewStyle> | StyleProp<ViewStyle> \| undefined` |
|
|
57
|
+
| onPress?: | Default `onPress` or `keyboard` handled `onPress` | `(e: GestureResponderEvent \| OnKeyPress) => void; \| undefined` |
|
|
58
|
+
| onLongPress?: | Default `onLongPress` or `keyboard` handled `onLongPress` | `(e: GestureResponderEvent \| OnKeyPress) => void; \| undefined`|
|
|
59
|
+
| withView?: | Android only prop, it is used for wrapping children in `<View accessible/>` | `boolean \| undefined` default `true` |
|
|
60
|
+
|
|
61
|
+
|
|
44
62
|
### KeyboardFocusView
|
|
45
63
|
The KeyboardFocusView component is core component for keyboard handling, it is used for force focusing and handling `onFocusChange` event
|
|
46
64
|
```js
|
|
@@ -55,8 +73,50 @@ import { KeyboardFocusView } from "react-native-external-keyboard";
|
|
|
55
73
|
</KeyboardFocusView>
|
|
56
74
|
```
|
|
57
75
|
|
|
58
|
-
|
|
76
|
+
You can pass the default ReactNative view props and some extra:
|
|
77
|
+
| Props | Description | Type |
|
|
78
|
+
| ------------- | ------------- | ---- |
|
|
79
|
+
| canBeFocused?: | Boolean property whether component can be focused by keyboard | `boolean \| undefined` default `true` |
|
|
80
|
+
| onFocusChange?: | Callback for focus change handling | `(e:NativeSyntheticEvent<{ isFocused: boolean; }>) => void` |
|
|
81
|
+
| onKeyUpPress?: | Callback for handling key up event | `(e: OnKeyPress) => void` |
|
|
82
|
+
| onKeyDownPress?: | Callback for handling key down event | `(e: OnKeyPress) => void`|
|
|
83
|
+
| focusStyle?: | Style for selected by keyboard component | `((state: { focused: boolean}) => StyleProp<ViewStyle> \| StyleProp<ViewStyle>` |
|
|
84
|
+
|
|
85
|
+
### ExternalKeyboardView
|
|
86
|
+
It is a bare `Native` component. It is better to use `KeyboardFocusView` if you don't need your own specific implementation.
|
|
87
|
+
|
|
88
|
+
Important: If you use `KeyboardFocusView` on Android, you need to use a children component with the `accessible` prop.
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
```js
|
|
92
|
+
import { ExternalKeyboardView } from 'react-native-external-keyboard';
|
|
93
|
+
// ...
|
|
94
|
+
<ExternalKeyboardView
|
|
95
|
+
onKeyDownPress={...}
|
|
96
|
+
onKeyUpPress={...}
|
|
97
|
+
canBeFocused
|
|
98
|
+
>
|
|
99
|
+
<View accessible>
|
|
100
|
+
<Text>Content</Text>
|
|
101
|
+
</View>
|
|
102
|
+
</ExternalKeyboardView>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
| Props | Description | Type |
|
|
106
|
+
| ------------- | ------------- | ---- |
|
|
107
|
+
| canBeFocused?: | Boolean property whether component can be focused by keyboard | `boolean \| undefined` default `true` |
|
|
108
|
+
| onFocusChange?: | Callback for focus change handling | `(e:NativeSyntheticEvent<{ isFocused: boolean; }>) => void` |
|
|
109
|
+
| onKeyUpPress?: | Callback for handling key up event | `(e: OnKeyPress) => void` |
|
|
110
|
+
| onKeyDownPress?: | Callback for handling key down event | `(e: OnKeyPress) => void`|
|
|
111
|
+
|
|
112
|
+
### A11yModule
|
|
59
113
|
|
|
114
|
+
The `A11yModule` API is used to move the `keyboard focus` to a target component.
|
|
115
|
+
Component's `ref` is needed to move keyboard focus. On iOS keyboard focus will work properly only with `KeyboardFocusView` or `Pressable` (from library one), because iOS has specific work around for moving keyboard focus.
|
|
116
|
+
|
|
117
|
+
```js
|
|
118
|
+
A11yModule.setKeyboardFocus(ref)
|
|
119
|
+
```
|
|
60
120
|
|
|
61
121
|
```js
|
|
62
122
|
import {
|
|
@@ -75,26 +135,21 @@ import {
|
|
|
75
135
|
</KeyboardFocusView>
|
|
76
136
|
```
|
|
77
137
|
|
|
78
|
-
|
|
79
|
-
|
|
138
|
+
```ts
|
|
139
|
+
export interface IA11yModule {
|
|
140
|
+
currentFocusedTag?: number;
|
|
80
141
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
```js
|
|
85
|
-
import { ExternalKeyboardView } from 'react-native-external-keyboard';
|
|
86
|
-
// ...
|
|
87
|
-
<ExternalKeyboardView
|
|
88
|
-
onKeyDownPress={...}
|
|
89
|
-
onKeyUpPress={...}
|
|
90
|
-
canBeFocused
|
|
91
|
-
>
|
|
92
|
-
<View accessible>
|
|
93
|
-
<Text>Content</Text>
|
|
94
|
-
</View>
|
|
95
|
-
</ExternalKeyboardView>
|
|
142
|
+
setPreferredKeyboardFocus: (nativeTag: number, nextTag: number) => void;
|
|
143
|
+
setKeyboardFocus: (ref: RefObjType) => void;
|
|
144
|
+
}
|
|
96
145
|
```
|
|
97
146
|
|
|
147
|
+
| Props | Description | Type |
|
|
148
|
+
| ------------- | ------------- | ---- |
|
|
149
|
+
| currentFocusedTag?: | iOS only, it is used for the keyboard focus moving feature | `number` |
|
|
150
|
+
| setPreferredKeyboardFocus: | iOS only, you can define default focus redirect from a component to a target | `(nativeTag: number, nextTag: number) => void;` |
|
|
151
|
+
| setKeyboardFocus: | Move focus to the target by ref | `(ref: RefObjType) => void` |
|
|
152
|
+
|
|
98
153
|
# Important
|
|
99
154
|
## iOS
|
|
100
155
|
New versions of iOS have specific `commands` for `physical keyboards`. If you can't handle a `long press event` on iOS, it may be that the `space` key is bound to an `Activate` command. Clearing the `Activate` command will help with handling of the `long press` event. There is no known way to handle this (if you have any ideas, please share).
|
|
@@ -102,7 +157,19 @@ New versions of iOS have specific `commands` for `physical keyboards`. If you ca
|
|
|
102
157
|
User can change `Commands` in:
|
|
103
158
|
`Settings` -> `Accessibility` -> `Keyboards` -> `Full Keyboard Access` -> `Commands`
|
|
104
159
|
|
|
105
|
-
|
|
160
|
+
# API
|
|
161
|
+
|
|
162
|
+
```ts
|
|
163
|
+
export type OnKeyPress = NativeSyntheticEvent<{
|
|
164
|
+
keyCode: number;
|
|
165
|
+
isLongPress: boolean;
|
|
166
|
+
isAltPressed: boolean;
|
|
167
|
+
isShiftPressed: boolean;
|
|
168
|
+
isCtrlPressed: boolean;
|
|
169
|
+
isCapsLockOn: boolean;
|
|
170
|
+
hasNoModifiers: boolean;
|
|
171
|
+
}>;
|
|
172
|
+
```
|
|
106
173
|
|
|
107
174
|
## License
|
|
108
175
|
|
|
@@ -53,8 +53,15 @@ const Pressable = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
const onKeyDownHandler = _react.default.useCallback(e => {
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
const {
|
|
57
|
+
nativeEvent: {
|
|
58
|
+
keyCode
|
|
59
|
+
}
|
|
60
|
+
} = e;
|
|
61
|
+
if (keyCode === ANDROID_SPACE_KEY_CODE) {
|
|
62
|
+
onKeyDownPress === null || onKeyDownPress === void 0 ? void 0 : onKeyDownPress(e);
|
|
63
|
+
onPressIn === null || onPressIn === void 0 ? void 0 : onPressIn(e);
|
|
64
|
+
}
|
|
58
65
|
}, [onKeyDownPress, onPressIn]);
|
|
59
66
|
return /*#__PURE__*/_react.default.createElement(_KeyboardFocusView.KeyboardFocusView, {
|
|
60
67
|
style: style,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_KeyboardFocusView","obj","__esModule","default","_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","ANDROID_SPACE_KEY_CODE","Pressable","React","forwardRef","_ref","ref","canBeFocused","focusStyle","style","onFocusChange","onPress","onLongPress","onKeyDownPress","onPressOut","onPressIn","props","onKeyUpPressHandler","useCallback","e","nativeEvent","keyCode","isLongPress","onPressablePressHandler","event","identifier","undefined","onKeyDownHandler","createElement","KeyboardFocusView","withView","onKeyUpPress","exports"],"sourceRoot":"../../../../src","sources":["components/Pressable/Pressable.android.tsx"],"mappings":";;;;;;AAUA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAOA,IAAAE,kBAAA,GAAAF,OAAA;AAAy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,OAAO,uBAAPA,OAAO,CAAGQ,CAAC,CAAC;MACd;IACF;EACF,CAAC,EACD,CAACP,WAAW,EAAED,OAAO,EAAEG,UAAU,CACnC,CAAC;EAED,MAAMS,uBAAuB,GAAIC,KAA4B,IAAK;IAChE,IAAIA,KAAK,CAACJ,WAAW,CAACK,UAAU,KAAKC,SAAS,EAAE;MAC9Cf,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAGa,KAAK,CAAC;IAClB;EACF,CAAC;EAED,MAAMG,gBAAgB,GAAGxB,cAAK,CAACe,WAAW,CACvCC,CAAC,IAAK;
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_KeyboardFocusView","obj","__esModule","default","_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","ANDROID_SPACE_KEY_CODE","Pressable","React","forwardRef","_ref","ref","canBeFocused","focusStyle","style","onFocusChange","onPress","onLongPress","onKeyDownPress","onPressOut","onPressIn","props","onKeyUpPressHandler","useCallback","e","nativeEvent","keyCode","isLongPress","onPressablePressHandler","event","identifier","undefined","onKeyDownHandler","createElement","KeyboardFocusView","withView","onKeyUpPress","exports"],"sourceRoot":"../../../../src","sources":["components/Pressable/Pressable.android.tsx"],"mappings":";;;;;;AAUA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAOA,IAAAE,kBAAA,GAAAF,OAAA;AAAyD,SAAAD,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,SAAA,IAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,GAAAF,SAAA,CAAAD,CAAA,YAAAI,G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cAAK,CAACe,WAAW,CACvCC,CAAC,IAAK;IACL,MAAM;MACJC,WAAW,EAAE;QAAEC;MAAQ;IACzB,CAAC,GAAGF,CAAC;IAEL,IAAIE,OAAO,KAAKpB,sBAAsB,EAAE;MACtCY,cAAc,aAAdA,cAAc,uBAAdA,cAAc,CAAGM,CAAC,CAAC;MACnBJ,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAGI,CAAqC,CAAC;IACpD;EACF,CAAC,EACD,CAACN,cAAc,EAAEE,SAAS,CAC5B,CAAC;EAED,oBACEpC,MAAA,CAAAO,OAAA,CAAA0C,aAAA,CAAC7C,kBAAA,CAAA8C,iBAAiB;IAChBpB,KAAK,EAAEA,KAAM;IACbD,UAAU,EAAEA,UAAW;IACvBF,GAAG,EAAEA,GAAI;IACTwB,QAAQ,EAAE,KAAM;IAChBC,YAAY,EAAEd,mBAAoB;IAClCJ,cAAc,EAAEc,gBAAiB;IACjCpB,YAAY,EAAEA,YAAa;IAC3BG,aAAa,EAAEA;EAAc,gBAE7B/B,MAAA,CAAAO,OAAA,CAAA0C,aAAA,CAAC9C,YAAA,CAAAoB,SAAW,EAAAf,QAAA;IACV2B,UAAU,EAAEA,UAAW;IACvBC,SAAS,EAAEA,SAAU;IACrBJ,OAAO,EAAEY,uBAAwB;IACjCX,WAAW,EAAEA;EAAY,GACrBI,KAAK,CACV,CACgB,CAAC;AAExB,CACF,CAAC;AAACgB,OAAA,CAAA9B,SAAA,GAAAA,SAAA"}
|
|
@@ -48,8 +48,15 @@ export const Pressable = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
const onKeyDownHandler = React.useCallback(e => {
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
const {
|
|
52
|
+
nativeEvent: {
|
|
53
|
+
keyCode
|
|
54
|
+
}
|
|
55
|
+
} = e;
|
|
56
|
+
if (keyCode === ANDROID_SPACE_KEY_CODE) {
|
|
57
|
+
onKeyDownPress === null || onKeyDownPress === void 0 ? void 0 : onKeyDownPress(e);
|
|
58
|
+
onPressIn === null || onPressIn === void 0 ? void 0 : onPressIn(e);
|
|
59
|
+
}
|
|
53
60
|
}, [onKeyDownPress, onPressIn]);
|
|
54
61
|
return /*#__PURE__*/React.createElement(KeyboardFocusView, {
|
|
55
62
|
style: style,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Pressable","RNPressable","KeyboardFocusView","ANDROID_SPACE_KEY_CODE","forwardRef","_ref","ref","canBeFocused","focusStyle","style","onFocusChange","onPress","onLongPress","onKeyDownPress","onPressOut","onPressIn","props","onKeyUpPressHandler","useCallback","e","nativeEvent","keyCode","isLongPress","onPressablePressHandler","event","identifier","undefined","onKeyDownHandler","createElement","withView","onKeyUpPress","_extends"],"sourceRoot":"../../../../src","sources":["components/Pressable/Pressable.android.tsx"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAEEC,SAAS,IAAIC,WAAW,QAGnB,cAAc;AAErB,SAASC,iBAAiB,QAAQ,sBAAsB;AAExD,MAAMC,sBAAsB,GAAG,EAAE;AAEjC,OAAO,MAAMH,SAAS,gBAAGD,KAAK,CAACK,UAAU,CAIvC,CAAAC,IAAA,EAaEC,GAAG,KACA;EAAA,IAbH;IACEC,YAAY;IACZC,UAAU;IACVC,KAAK;IACLC,aAAa;IACbC,OAAO;IACPC,WAAW;IACXC,cAAc;IACdC,UAAU;IACVC,SAAS;IACT,GAAGC;EACL,CAAC,GAAAX,IAAA;EAGD,MAAMY,mBAAmB,GAAGlB,KAAK,CAACmB,WAAW,CAC1CC,CAAC,IAAK;IACL,MAAM;MACJC,WAAW,EAAE;QAAEC,OAAO;QAAEC;MAAY;IACtC,CAAC,GAAGH,CAAC;IAEL,IAAIE,OAAO,KAAKlB,sBAAsB,EAAE;MACtCW,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAGK,CAAqC,CAAC;MACnD,IAAIG,WAAW,EAAE;QACfV,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAGO,CAAC,CAAC;MAClB,CAAC,MAAM;QACLR,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAGQ,CAAC,CAAC;MACd;IACF;EACF,CAAC,EACD,CAACP,WAAW,EAAED,OAAO,EAAEG,UAAU,CACnC,CAAC;EAED,MAAMS,uBAAuB,GAAIC,KAA4B,IAAK;IAChE,IAAIA,KAAK,CAACJ,WAAW,CAACK,UAAU,KAAKC,SAAS,EAAE;MAC9Cf,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAGa,KAAK,CAAC;IAClB;EACF,CAAC;EAED,MAAMG,gBAAgB,GAAG5B,KAAK,CAACmB,WAAW,CACvCC,CAAC,IAAK;
|
|
1
|
+
{"version":3,"names":["React","Pressable","RNPressable","KeyboardFocusView","ANDROID_SPACE_KEY_CODE","forwardRef","_ref","ref","canBeFocused","focusStyle","style","onFocusChange","onPress","onLongPress","onKeyDownPress","onPressOut","onPressIn","props","onKeyUpPressHandler","useCallback","e","nativeEvent","keyCode","isLongPress","onPressablePressHandler","event","identifier","undefined","onKeyDownHandler","createElement","withView","onKeyUpPress","_extends"],"sourceRoot":"../../../../src","sources":["components/Pressable/Pressable.android.tsx"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAEEC,SAAS,IAAIC,WAAW,QAGnB,cAAc;AAErB,SAASC,iBAAiB,QAAQ,sBAAsB;AAExD,MAAMC,sBAAsB,GAAG,EAAE;AAEjC,OAAO,MAAMH,SAAS,gBAAGD,KAAK,CAACK,UAAU,CAIvC,CAAAC,IAAA,EAaEC,GAAG,KACA;EAAA,IAbH;IACEC,YAAY;IACZC,UAAU;IACVC,KAAK;IACLC,aAAa;IACbC,OAAO;IACPC,WAAW;IACXC,cAAc;IACdC,UAAU;IACVC,SAAS;IACT,GAAGC;EAC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BAAoB;IAClCJ,cAAc,EAAEc,gBAAiB;IACjCpB,YAAY,EAAEA,YAAa;IAC3BG,aAAa,EAAEA;EAAc,gBAE7BX,KAAA,CAAA6B,aAAA,CAAC3B,WAAW,EAAA8B,QAAA;IACVjB,UAAU,EAAEA,UAAW;IACvBC,SAAS,EAAEA,SAAU;IACrBJ,OAAO,EAAEY,uBAAwB;IACjCX,WAAW,EAAEA;EAAY,GACrBI,KAAK,CACV,CACgB,CAAC;AAExB,CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pressable.android.d.ts","sourceRoot":"","sources":["../../../../src/components/Pressable/Pressable.android.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,qBAAqB,EAErB,IAAI,EACJ,cAAc,EACf,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAA0B,YAAY,EAAE,MAAM,aAAa,CAAC;AAKxE,eAAO,MAAM,SAAS;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"Pressable.android.d.ts","sourceRoot":"","sources":["../../../../src/components/Pressable/Pressable.android.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,qBAAqB,EAErB,IAAI,EACJ,cAAc,EACf,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAA0B,YAAY,EAAE,MAAM,aAAa,CAAC;AAKxE,eAAO,MAAM,SAAS;;;;;;;;;;8BA8ErB,CAAC"}
|
package/package.json
CHANGED
|
@@ -65,8 +65,14 @@ export const Pressable = React.forwardRef<
|
|
|
65
65
|
|
|
66
66
|
const onKeyDownHandler = React.useCallback<OnKeyPressFn>(
|
|
67
67
|
(e) => {
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
const {
|
|
69
|
+
nativeEvent: { keyCode },
|
|
70
|
+
} = e;
|
|
71
|
+
|
|
72
|
+
if (keyCode === ANDROID_SPACE_KEY_CODE) {
|
|
73
|
+
onKeyDownPress?.(e);
|
|
74
|
+
onPressIn?.(e as unknown as GestureResponderEvent);
|
|
75
|
+
}
|
|
70
76
|
},
|
|
71
77
|
[onKeyDownPress, onPressIn]
|
|
72
78
|
);
|