react-native-external-keyboard 0.8.0 → 0.8.2

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.
Files changed (47) hide show
  1. package/README.md +31 -0
  2. package/ios/Views/RNCEKVExternalKeyboardView/Helpers/RNCEKVFabricEventHelper/RNCEKVFabricEventHelper.mm +6 -4
  3. package/lib/commonjs/components/KeyboardExtendedInput/KeyboardExtendedInput.consts.js +17 -0
  4. package/lib/commonjs/components/KeyboardExtendedInput/KeyboardExtendedInput.consts.js.map +1 -0
  5. package/lib/commonjs/components/KeyboardExtendedInput/KeyboardExtendedInput.js +11 -12
  6. package/lib/commonjs/components/KeyboardExtendedInput/KeyboardExtendedInput.js.map +1 -1
  7. package/lib/commonjs/components/KeyboardExtendedInput/KeyboardExtendedInput.types.js +6 -0
  8. package/lib/commonjs/components/KeyboardExtendedInput/KeyboardExtendedInput.types.js.map +1 -0
  9. package/lib/commonjs/components/RenderPropComponent/RenderPropComponent.js.map +1 -1
  10. package/lib/commonjs/components/Touchable/Pressable.js.map +1 -1
  11. package/lib/commonjs/index.js.map +1 -1
  12. package/lib/commonjs/utils/withKeyboardFocus.js.map +1 -1
  13. package/lib/module/components/KeyboardExtendedInput/KeyboardExtendedInput.consts.js +13 -0
  14. package/lib/module/components/KeyboardExtendedInput/KeyboardExtendedInput.consts.js.map +1 -0
  15. package/lib/module/components/KeyboardExtendedInput/KeyboardExtendedInput.js +9 -10
  16. package/lib/module/components/KeyboardExtendedInput/KeyboardExtendedInput.js.map +1 -1
  17. package/lib/module/components/KeyboardExtendedInput/KeyboardExtendedInput.types.js +4 -0
  18. package/lib/module/components/KeyboardExtendedInput/KeyboardExtendedInput.types.js.map +1 -0
  19. package/lib/module/components/RenderPropComponent/RenderPropComponent.js.map +1 -1
  20. package/lib/module/components/Touchable/Pressable.js.map +1 -1
  21. package/lib/module/index.js.map +1 -1
  22. package/lib/module/utils/withKeyboardFocus.js.map +1 -1
  23. package/lib/typescript/src/components/KeyboardExtendedInput/KeyboardExtendedInput.consts.d.ts +11 -0
  24. package/lib/typescript/src/components/KeyboardExtendedInput/KeyboardExtendedInput.consts.d.ts.map +1 -0
  25. package/lib/typescript/src/components/KeyboardExtendedInput/KeyboardExtendedInput.d.ts +15 -223
  26. package/lib/typescript/src/components/KeyboardExtendedInput/KeyboardExtendedInput.d.ts.map +1 -1
  27. package/lib/typescript/src/components/KeyboardExtendedInput/KeyboardExtendedInput.types.d.ts +30 -0
  28. package/lib/typescript/src/components/KeyboardExtendedInput/KeyboardExtendedInput.types.d.ts.map +1 -0
  29. package/lib/typescript/src/components/RenderPropComponent/RenderPropComponent.d.ts +1 -1
  30. package/lib/typescript/src/components/RenderPropComponent/RenderPropComponent.d.ts.map +1 -1
  31. package/lib/typescript/src/components/Touchable/Pressable.d.ts +8 -4
  32. package/lib/typescript/src/components/Touchable/Pressable.d.ts.map +1 -1
  33. package/lib/typescript/src/index.d.ts +1 -0
  34. package/lib/typescript/src/index.d.ts.map +1 -1
  35. package/lib/typescript/src/types/WithKeyboardFocus.d.ts +7 -7
  36. package/lib/typescript/src/types/WithKeyboardFocus.d.ts.map +1 -1
  37. package/lib/typescript/src/utils/withKeyboardFocus.d.ts +2 -2
  38. package/lib/typescript/src/utils/withKeyboardFocus.d.ts.map +1 -1
  39. package/package.json +1 -1
  40. package/src/components/KeyboardExtendedInput/KeyboardExtendedInput.consts.ts +11 -0
  41. package/src/components/KeyboardExtendedInput/KeyboardExtendedInput.tsx +13 -46
  42. package/src/components/KeyboardExtendedInput/KeyboardExtendedInput.types.ts +58 -0
  43. package/src/components/RenderPropComponent/RenderPropComponent.tsx +1 -0
  44. package/src/components/Touchable/Pressable.tsx +3 -1
  45. package/src/index.tsx +7 -0
  46. package/src/types/WithKeyboardFocus.ts +16 -12
  47. package/src/utils/withKeyboardFocus.tsx +6 -2
@@ -0,0 +1,58 @@
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
+
13
+ export type ExtraKeyboardProps = {
14
+ focusType?: keyof typeof focusMap;
15
+ blurType?: keyof typeof blurMap;
16
+ containerStyle?: StyleProp<ViewStyle>;
17
+ onFocusChange?: (isFocused: boolean) => void;
18
+ focusStyle?: FocusStyle;
19
+ haloEffect?: boolean;
20
+ canBeFocusable?: boolean;
21
+ focusable?: boolean;
22
+ tintColor?: ColorValue;
23
+ tintType?: TintType;
24
+ containerFocusStyle?: FocusStyle;
25
+ FocusHoverComponent?: RenderProp;
26
+ submitBehavior?: string;
27
+ groupIdentifier?: string;
28
+ };
29
+
30
+ type IgnoreForCompatibility =
31
+ | 'rejectResponderTermination'
32
+ | 'selectionHandleColor'
33
+ | 'cursorColor'
34
+ | 'maxFontSizeMultiplier';
35
+
36
+ type CompatibleInputProp<
37
+ TextInputPropsType extends object,
38
+ CompatibilityProp extends IgnoreForCompatibility
39
+ > = CompatibilityProp extends keyof TextInputPropsType
40
+ ? TextInputPropsType[CompatibilityProp]
41
+ : CompatibilityProp extends keyof TextInputProps
42
+ ? TextInputProps[CompatibilityProp]
43
+ : never;
44
+
45
+ type ReactNativeInputCompatibility<
46
+ TextInputPropsType extends object = TextInputProps
47
+ > = Omit<TextInputPropsType, IgnoreForCompatibility> & {
48
+ [CompatibilityProp in IgnoreForCompatibility]?: CompatibleInputProp<
49
+ TextInputPropsType,
50
+ CompatibilityProp
51
+ > | null;
52
+ };
53
+
54
+ export type KeyboardInputPropsDeclaration<
55
+ TextInputPropsType extends object = TextInputProps
56
+ > = ReactNativeInputCompatibility<TextInputPropsType> & ExtraKeyboardProps;
57
+
58
+ export type KeyboardInputProps = KeyboardInputPropsDeclaration<TextInputProps>;
@@ -3,6 +3,7 @@ import React, { type FunctionComponent, type ReactElement } from 'react';
3
3
  export type RenderProp =
4
4
  | ReactElement
5
5
  | FunctionComponent
6
+ | FunctionComponent<{}>
6
7
  | (() => ReactElement);
7
8
 
8
9
  export const RenderPropComponent = ({ render }: { render: RenderProp }) => {
@@ -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
  >;
package/src/index.tsx CHANGED
@@ -32,10 +32,17 @@ export {
32
32
  Pressable as KeyboardExtendedPressable,
33
33
  type KeyboardPressableProps,
34
34
  } from './components/Touchable/Pressable';
35
+
35
36
  export {
36
37
  KeyboardExtendedInput,
37
38
  KeyboardExtendedInput as TextInput,
38
39
  } from './components/KeyboardExtendedInput/KeyboardExtendedInput';
40
+ export type {
41
+ KeyboardInputPropsDeclaration,
42
+ KeyboardInputProps,
43
+ ExtraKeyboardProps,
44
+ } from './components/KeyboardExtendedInput/KeyboardExtendedInput.types';
45
+
39
46
  export { KeyboardFocusGroup } from './components/KeyboardFocusGroup/KeyboardFocusGroup';
40
47
  export { withKeyboardFocus } from './utils/withKeyboardFocus';
41
48
  export { useIsViewFocused } from './context/IsViewFocusedContext';
@@ -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<R = unknown, ViewStyleType = unknown> = {
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<R>;
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<ComponentProps, ViewStyleType>;
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
- > = WithKeyboardFocus<ComponentProps, ViewStyleType> &
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';
@@ -13,13 +13,17 @@ import { useKeyboardPress } from './useKeyboardPress/useKeyboardPress';
13
13
  import { IsViewFocusedContext } from '../context/IsViewFocusedContext';
14
14
  import type { FocusViewProps } from '../types/KeyboardFocusView.types';
15
15
 
16
- export const withKeyboardFocus = <ComponentProps extends object, ViewStyleType>(
16
+ export const withKeyboardFocus = <
17
+ ComponentProps extends object,
18
+ ViewStyleType,
19
+ ViewType = View
20
+ >(
17
21
  Component: WithKeyboardFocusComponent<ComponentProps>
18
22
  ) => {
19
23
  const WithKeyboardFocus = React.memo(
20
24
  React.forwardRef<
21
25
  View | KeyboardFocus,
22
- WithKeyboardFocus<ComponentProps, ViewStyleType>
26
+ WithKeyboardFocus<ComponentProps, ViewStyleType, ViewType>
23
27
  >((allProps, ref) => {
24
28
  const {
25
29
  tintType = 'default',