react-native-external-keyboard 0.8.0 → 0.8.2-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.
- package/README.md +31 -0
- package/ios/Views/RNCEKVExternalKeyboardView/Helpers/RNCEKVFabricEventHelper/RNCEKVFabricEventHelper.mm +6 -4
- package/lib/commonjs/components/Touchable/Pressable.js.map +1 -1
- package/lib/module/components/Touchable/Pressable.js.map +1 -1
- package/lib/typescript/src/components/Touchable/Pressable.d.ts +3 -3
- package/lib/typescript/src/components/Touchable/Pressable.d.ts.map +1 -1
- package/lib/typescript/src/types/WithKeyboardFocus.d.ts +7 -7
- package/lib/typescript/src/types/WithKeyboardFocus.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Touchable/Pressable.tsx +3 -1
- package/src/types/WithKeyboardFocus.ts +16 -12
package/README.md
CHANGED
|
@@ -506,6 +506,37 @@ The map of aliases is provided below: <br />
|
|
|
506
506
|
`KeyboardFocusView` -> `KeyboardExtendedView` <br />
|
|
507
507
|
`ExternalKeyboardView` -> `KeyboardExtendedBaseView` <br />
|
|
508
508
|
|
|
509
|
+
# Migration 0.7.x to 0.8.0
|
|
510
|
+
|
|
511
|
+
React and React Native packages have been updated in `react-native-external-keyboard@0.8.0`.
|
|
512
|
+
|
|
513
|
+
Unfortunately, the latest React Native versions (0.83.x and 0.84.x) have different types compared to previous versions, and the Pressable as well as KeyboardExtendedPressable props could be incompatible with local types because they have static TypeScript declarations based on the React Native 0.83.4 dependency.
|
|
514
|
+
|
|
515
|
+
In some cases, you may experience the following TypeScript problem:
|
|
516
|
+
<img width="759" height="81" alt="image" src="https://github.com/user-attachments/assets/d47992ce-d3df-473b-bd96-5f2ba53ab889" />
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
It can be resolved by using a HOC, as it provides dynamic typing.
|
|
520
|
+
```tsx
|
|
521
|
+
const KeyboardPressable = withKeyboardFocus(Pressable)
|
|
522
|
+
|
|
523
|
+
export const K = (props: PressableProps) => {
|
|
524
|
+
return <KeyboardPressable {...props} />;
|
|
525
|
+
}
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
As well, it could be resolved by component redeclaration:
|
|
529
|
+
```ts
|
|
530
|
+
export {};
|
|
531
|
+
|
|
532
|
+
declare module 'react-native-external-keyboard' {
|
|
533
|
+
import type { PressableProps, ViewProps } from 'react-native';
|
|
534
|
+
import type { WithKeyboardFocusDeclaration } from 'react-native-external-keyboard/lib/typescript/src/types/WithKeyboardFocus';
|
|
535
|
+
|
|
536
|
+
export const Pressable: WithKeyboardFocusDeclaration<PressableProps, ViewProps['style']>
|
|
537
|
+
export const KeyboardExtendedPressable: WithKeyboardFocusDeclaration<PressableProps, ViewProps['style']>
|
|
538
|
+
}
|
|
539
|
+
```
|
|
509
540
|
|
|
510
541
|
# API
|
|
511
542
|
ToDo
|
|
@@ -21,7 +21,8 @@ using namespace facebook::react;
|
|
|
21
21
|
+ (void)onKeyDownPressEventEmmiter:(NSDictionary*) dictionary withEmitter:(facebook::react::SharedViewEventEmitter) _eventEmitter {
|
|
22
22
|
if (_eventEmitter) {
|
|
23
23
|
auto viewEventEmitter = std::static_pointer_cast<ExternalKeyboardViewEventEmitter const>(_eventEmitter);
|
|
24
|
-
|
|
24
|
+
|
|
25
|
+
NSString* unicodeChar = [dictionary valueForKey:@"unicodeChar"];
|
|
25
26
|
facebook::react::ExternalKeyboardViewEventEmitter::OnKeyDownPress data = {
|
|
26
27
|
.keyCode = [[dictionary valueForKey:@"keyCode"] intValue],
|
|
27
28
|
.isLongPress = [[dictionary valueForKey:@"isLongPress"] boolValue],
|
|
@@ -31,7 +32,7 @@ using namespace facebook::react;
|
|
|
31
32
|
.isCapsLockOn = [[dictionary valueForKey:@"isCapsLockOn"] boolValue],
|
|
32
33
|
.hasNoModifiers = [[dictionary valueForKey:@"hasNoModifiers"] boolValue],
|
|
33
34
|
.unicode = [[dictionary valueForKey:@"unicode"] intValue],
|
|
34
|
-
.unicodeChar = [
|
|
35
|
+
.unicodeChar = [unicodeChar UTF8String],
|
|
35
36
|
};
|
|
36
37
|
viewEventEmitter->onKeyDownPress(data);
|
|
37
38
|
};
|
|
@@ -40,7 +41,8 @@ using namespace facebook::react;
|
|
|
40
41
|
+ (void)onKeyUpPressEventEmmiter:(NSDictionary*) dictionary withEmitter:(facebook::react::SharedViewEventEmitter) _eventEmitter {
|
|
41
42
|
if (_eventEmitter) {
|
|
42
43
|
auto viewEventEmitter = std::static_pointer_cast<ExternalKeyboardViewEventEmitter const>(_eventEmitter);
|
|
43
|
-
|
|
44
|
+
|
|
45
|
+
NSString* unicodeChar = [dictionary valueForKey:@"unicodeChar"];
|
|
44
46
|
facebook::react::ExternalKeyboardViewEventEmitter::OnKeyUpPress data = {
|
|
45
47
|
.keyCode = [[dictionary valueForKey:@"keyCode"] intValue],
|
|
46
48
|
.isLongPress = [[dictionary valueForKey:@"isLongPress"] boolValue],
|
|
@@ -50,7 +52,7 @@ using namespace facebook::react;
|
|
|
50
52
|
.isCapsLockOn = [[dictionary valueForKey:@"isCapsLockOn"] boolValue],
|
|
51
53
|
.hasNoModifiers = [[dictionary valueForKey:@"hasNoModifiers"] boolValue],
|
|
52
54
|
.unicode = [[dictionary valueForKey:@"unicode"] intValue],
|
|
53
|
-
.unicodeChar = [
|
|
55
|
+
.unicodeChar = [unicodeChar UTF8String],
|
|
54
56
|
};
|
|
55
57
|
viewEventEmitter->onKeyUpPress(data);
|
|
56
58
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_withKeyboardFocus","Pressable","exports","withKeyboardFocus","RNPressable"],"sourceRoot":"../../../../src","sources":["components/Touchable/Pressable.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_withKeyboardFocus","Pressable","exports","withKeyboardFocus","RNPressable"],"sourceRoot":"../../../../src","sources":["components/Touchable/Pressable.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAOA,IAAAC,kBAAA,GAAAD,OAAA;AAGO,MAAME,SAAS,GAAAC,OAAA,CAAAD,SAAA,GAAG,IAAAE,oCAAiB,EAACC,sBAAW,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Pressable","RNPressable","withKeyboardFocus"],"sourceRoot":"../../../../src","sources":["components/Touchable/Pressable.tsx"],"mappings":";;AAAA,SACEA,SAAS,IAAIC,WAAW,
|
|
1
|
+
{"version":3,"names":["Pressable","RNPressable","withKeyboardFocus"],"sourceRoot":"../../../../src","sources":["components/Touchable/Pressable.tsx"],"mappings":";;AAAA,SACEA,SAAS,IAAIC,WAAW,QAInB,cAAc;AAErB,SAASC,iBAAiB,QAAQ,+BAA+B;AAGjE,OAAO,MAAMF,SAAS,GAAGE,iBAAiB,CAACD,WAAW,CAAC","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type PressableProps, type ViewProps } from 'react-native';
|
|
1
|
+
import { type PressableProps, type ViewProps, type View } from 'react-native';
|
|
2
2
|
import type { WithKeyboardPropsTypeDeclaration } from '../../types/WithKeyboardFocus';
|
|
3
3
|
export declare const Pressable: import("react").NamedExoticComponent<Omit<import("../..").WithKeyboardFocus<Omit<Readonly<Omit<Omit<Readonly<Omit<Readonly<{
|
|
4
4
|
onAccessibilityAction?: ((event: import("react-native").AccessibilityActionEvent) => unknown) | undefined;
|
|
@@ -148,11 +148,11 @@ export declare const Pressable: import("react").NamedExoticComponent<Omit<import
|
|
|
148
148
|
testOnly_pressed?: boolean | undefined;
|
|
149
149
|
unstable_pressDelay?: number | undefined;
|
|
150
150
|
}>, never>>, "ref"> & {
|
|
151
|
-
ref?: React.Ref<React.ComponentRef<typeof
|
|
151
|
+
ref?: React.Ref<React.ComponentRef<typeof View>>;
|
|
152
152
|
}, unknown>, "ref"> & import("react").RefAttributes<((props: Omit<ViewProps, keyof {
|
|
153
153
|
ref?: React.Ref<React.ComponentRef<typeof import("react-native").unstable_NativeView>>;
|
|
154
154
|
}> & {
|
|
155
155
|
ref?: React.Ref<React.ComponentRef<typeof import("react-native").unstable_NativeView>>;
|
|
156
156
|
}) => React.ReactNode) | import("../..").KeyboardFocus>>;
|
|
157
|
-
export type KeyboardPressableProps = WithKeyboardPropsTypeDeclaration<PressableProps, ViewProps['style']>;
|
|
157
|
+
export type KeyboardPressableProps = WithKeyboardPropsTypeDeclaration<PressableProps, ViewProps['style'], View>;
|
|
158
158
|
//# sourceMappingURL=Pressable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pressable.d.ts","sourceRoot":"","sources":["../../../../../src/components/Touchable/Pressable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"Pressable.d.ts","sourceRoot":"","sources":["../../../../../src/components/Touchable/Pressable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,IAAI,EACV,MAAM,cAAc,CAAC;AAGtB,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,+BAA+B,CAAC;AAEtF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAO0W,CAAC;;OAAyE,CAAC;wDAPpZ,CAAC;AAExD,MAAM,MAAM,sBAAsB,GAAG,gCAAgC,CACnE,cAAc,EACd,SAAS,CAAC,OAAO,CAAC,EAClB,IAAI,CACL,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PressableProps, ViewProps } from 'react-native';
|
|
1
|
+
import type { PressableProps, View, ViewProps } from 'react-native';
|
|
2
2
|
import type { FocusStyle } from './FocusStyle';
|
|
3
3
|
import type { KeyboardFocus, OnKeyPress } from './BaseKeyboardView';
|
|
4
4
|
import type { FocusViewProps } from './KeyboardFocusView.types';
|
|
@@ -16,12 +16,12 @@ export type KeyboardPressType<ComponentProps extends object> = {
|
|
|
16
16
|
onComponentFocus?: PickProp<ComponentProps, 'onFocus'>;
|
|
17
17
|
onComponentBlur?: PickProp<ComponentProps, 'onBlur'>;
|
|
18
18
|
};
|
|
19
|
-
export type WithKeyboardProps<
|
|
19
|
+
export type WithKeyboardProps<ViewType = View, ViewStyleType = unknown> = {
|
|
20
20
|
withPressedStyle?: boolean;
|
|
21
21
|
containerStyle?: ViewStyleType | ViewProps['style'];
|
|
22
22
|
containerFocusStyle?: FocusStyle;
|
|
23
23
|
tintType?: TintType;
|
|
24
|
-
componentRef?: React.RefObject<
|
|
24
|
+
componentRef?: React.RefObject<ViewType>;
|
|
25
25
|
FocusHoverComponent?: RenderProp;
|
|
26
26
|
style?: PressableProps['style'];
|
|
27
27
|
onBlur?: (() => void) | ((e: any) => void) | null;
|
|
@@ -29,10 +29,10 @@ export type WithKeyboardProps<R = unknown, ViewStyleType = unknown> = {
|
|
|
29
29
|
};
|
|
30
30
|
type KeyboardFocusBaseProps = Omit<FocusViewProps, 'onPress' | 'onLongPress' | 'onBlur' | 'onFocus'>;
|
|
31
31
|
type MergeProps<BaseProps extends object, OverrideProps extends object> = Omit<BaseProps, keyof OverrideProps> & OverrideProps;
|
|
32
|
-
type KeyboardFocusOverrideProps<ComponentProps extends object, ViewStyleType> = KeyboardPressType<ComponentProps> & KeyboardFocusBaseProps & WithKeyboardProps<
|
|
33
|
-
export type WithKeyboardFocus<ComponentProps extends object, ViewStyleType> = MergeProps<ComponentProps, KeyboardFocusOverrideProps<ComponentProps, ViewStyleType>>;
|
|
34
|
-
export type WithKeyboardPropsTypeDeclaration<ComponentProps extends object, ViewStyleType> = WithKeyboardFocus<ComponentProps, ViewStyleType> & RefAttributes<KeyboardFocus>;
|
|
35
|
-
export type WithKeyboardFocusDeclaration<ComponentProps extends object, ViewStyleType> = React.JSXElementConstructor<WithKeyboardPropsTypeDeclaration<ComponentProps, ViewStyleType>> | React.ForwardRefExoticComponent<WithKeyboardPropsTypeDeclaration<ComponentProps, ViewStyleType>>;
|
|
32
|
+
type KeyboardFocusOverrideProps<ComponentProps extends object, ViewStyleType, ViewType = View> = KeyboardPressType<ComponentProps> & KeyboardFocusBaseProps & WithKeyboardProps<ViewType, ViewStyleType>;
|
|
33
|
+
export type WithKeyboardFocus<ComponentProps extends object, ViewStyleType, ViewType = View> = MergeProps<ComponentProps, KeyboardFocusOverrideProps<ComponentProps, ViewStyleType, ViewType>>;
|
|
34
|
+
export type WithKeyboardPropsTypeDeclaration<ComponentProps extends object, ViewStyleType, ViewType = View> = WithKeyboardFocus<ComponentProps, ViewStyleType, ViewType> & RefAttributes<KeyboardFocus>;
|
|
35
|
+
export type WithKeyboardFocusDeclaration<ComponentProps extends object, ViewStyleType, ViewType = View> = React.JSXElementConstructor<WithKeyboardPropsTypeDeclaration<ComponentProps, ViewStyleType, ViewType>> | React.ForwardRefExoticComponent<WithKeyboardPropsTypeDeclaration<ComponentProps, ViewStyleType, ViewType>>;
|
|
36
36
|
export type TintType = 'default' | 'hover' | 'background' | 'none';
|
|
37
37
|
export {};
|
|
38
38
|
//# sourceMappingURL=WithKeyboardFocus.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WithKeyboardFocus.d.ts","sourceRoot":"","sources":["../../../../src/types/WithKeyboardFocus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"WithKeyboardFocus.d.ts","sourceRoot":"","sources":["../../../../src/types/WithKeyboardFocus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,cA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ACtB,iBAAiB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;AAE7C,MAAM,MAAM,iBAAiB,CAC3B,cAAc,SAAS,MAAM,EAC7B,aAAa,EACb,QAAQ,GAAG,IAAI,IACb,UAAU,CACZ,cAAc,EACd,0BAA0B,CAAC,cAAc,EAAE,aAAa,EAAE,QAAQ,CAAC,CACpE,CAAC;AAEF,MAAM,MAAM,gCAAgC,CAC1C,cAAc,SAAS,MAAM,EAC7B,aAAa,EACb,QAAQ,GAAG,IAAI,IACb,iBAAiB,CAAC,cAAc,EAAE,aAAa,EAAE,QAAQ,CAAC,GAC5D,aAAa,CAAC,aAAa,CAAC,CAAC;AAE/B,MAAM,MAAM,4BAA4B,CACtC,cAAc,SAAS,MAAM,EAC7B,aAAa,EACb,QAAQ,GAAG,IAAI,IAEb,KAAK,CAAC,qBAAqB,CACzB,gCAAgC,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"}
|
package/package.json
CHANGED
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
Pressable as RNPressable,
|
|
3
3
|
type PressableProps,
|
|
4
4
|
type ViewProps,
|
|
5
|
+
type View,
|
|
5
6
|
} from 'react-native';
|
|
6
7
|
|
|
7
8
|
import { withKeyboardFocus } from '../../utils/withKeyboardFocus';
|
|
@@ -11,5 +12,6 @@ export const Pressable = withKeyboardFocus(RNPressable);
|
|
|
11
12
|
|
|
12
13
|
export type KeyboardPressableProps = WithKeyboardPropsTypeDeclaration<
|
|
13
14
|
PressableProps,
|
|
14
|
-
ViewProps['style']
|
|
15
|
+
ViewProps['style'],
|
|
16
|
+
View
|
|
15
17
|
>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PressableProps, ViewProps } from 'react-native';
|
|
1
|
+
import type { PressableProps, View, ViewProps } from 'react-native';
|
|
2
2
|
import type { FocusStyle } from './FocusStyle';
|
|
3
3
|
import type { KeyboardFocus, OnKeyPress } from './BaseKeyboardView';
|
|
4
4
|
import type { FocusViewProps } from './KeyboardFocusView.types';
|
|
@@ -36,12 +36,12 @@ export type KeyboardPressType<ComponentProps extends object> = {
|
|
|
36
36
|
onComponentBlur?: PickProp<ComponentProps, 'onBlur'>;
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
export type WithKeyboardProps<
|
|
39
|
+
export type WithKeyboardProps<ViewType = View, ViewStyleType = unknown> = {
|
|
40
40
|
withPressedStyle?: boolean;
|
|
41
41
|
containerStyle?: ViewStyleType | ViewProps['style'];
|
|
42
42
|
containerFocusStyle?: FocusStyle;
|
|
43
43
|
tintType?: TintType;
|
|
44
|
-
componentRef?: React.RefObject<
|
|
44
|
+
componentRef?: React.RefObject<ViewType>;
|
|
45
45
|
FocusHoverComponent?: RenderProp;
|
|
46
46
|
style?: PressableProps['style'];
|
|
47
47
|
onBlur?: (() => void) | ((e: any) => void) | null;
|
|
@@ -61,34 +61,38 @@ type MergeProps<BaseProps extends object, OverrideProps extends object> = Omit<
|
|
|
61
61
|
|
|
62
62
|
type KeyboardFocusOverrideProps<
|
|
63
63
|
ComponentProps extends object,
|
|
64
|
-
ViewStyleType
|
|
64
|
+
ViewStyleType,
|
|
65
|
+
ViewType = View
|
|
65
66
|
> = KeyboardPressType<ComponentProps> &
|
|
66
67
|
KeyboardFocusBaseProps &
|
|
67
|
-
WithKeyboardProps<
|
|
68
|
+
WithKeyboardProps<ViewType, ViewStyleType>;
|
|
68
69
|
|
|
69
70
|
export type WithKeyboardFocus<
|
|
70
71
|
ComponentProps extends object,
|
|
71
|
-
ViewStyleType
|
|
72
|
+
ViewStyleType,
|
|
73
|
+
ViewType = View
|
|
72
74
|
> = MergeProps<
|
|
73
75
|
ComponentProps,
|
|
74
|
-
KeyboardFocusOverrideProps<ComponentProps, ViewStyleType>
|
|
76
|
+
KeyboardFocusOverrideProps<ComponentProps, ViewStyleType, ViewType>
|
|
75
77
|
>;
|
|
76
78
|
|
|
77
79
|
export type WithKeyboardPropsTypeDeclaration<
|
|
78
80
|
ComponentProps extends object,
|
|
79
|
-
ViewStyleType
|
|
80
|
-
|
|
81
|
+
ViewStyleType,
|
|
82
|
+
ViewType = View
|
|
83
|
+
> = WithKeyboardFocus<ComponentProps, ViewStyleType, ViewType> &
|
|
81
84
|
RefAttributes<KeyboardFocus>;
|
|
82
85
|
|
|
83
86
|
export type WithKeyboardFocusDeclaration<
|
|
84
87
|
ComponentProps extends object,
|
|
85
|
-
ViewStyleType
|
|
88
|
+
ViewStyleType,
|
|
89
|
+
ViewType = View
|
|
86
90
|
> =
|
|
87
91
|
| React.JSXElementConstructor<
|
|
88
|
-
WithKeyboardPropsTypeDeclaration<ComponentProps, ViewStyleType>
|
|
92
|
+
WithKeyboardPropsTypeDeclaration<ComponentProps, ViewStyleType, ViewType>
|
|
89
93
|
>
|
|
90
94
|
| React.ForwardRefExoticComponent<
|
|
91
|
-
WithKeyboardPropsTypeDeclaration<ComponentProps, ViewStyleType>
|
|
95
|
+
WithKeyboardPropsTypeDeclaration<ComponentProps, ViewStyleType, ViewType>
|
|
92
96
|
>;
|
|
93
97
|
|
|
94
98
|
export type TintType = 'default' | 'hover' | 'background' | 'none';
|