react-native-keyboard-controller 1.21.0-beta.1 → 1.21.0-beta.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.
- package/ios/animations/KeyboardAnimation.swift +2 -2
- package/ios/animations/SpringAnimation.swift +1 -1
- package/ios/animations/TimingAnimation.swift +3 -1
- package/ios/delegates/KCTextInputCompositeDelegate.swift +2 -2
- package/ios/extensions/CGFloat.swift +3 -1
- package/ios/interactive/KeyboardAreaExtender.swift +1 -2
- package/ios/observers/FocusedInputObserver.swift +2 -4
- package/ios/observers/movement/KeyboardTrackingView.swift +1 -4
- package/ios/observers/movement/observer/KeyboardMovementObserver+Interactive.swift +0 -2
- package/ios/observers/movement/observer/KeyboardMovementObserver+Listeners.swift +7 -30
- package/ios/observers/movement/observer/KeyboardMovementObserver.swift +48 -2
- package/ios/protocols/TextInput.swift +1 -1
- package/ios/swizzling/UIResponderSwizzle.swift +4 -2
- package/ios/traversal/FocusedInputHolder.swift +3 -3
- package/ios/traversal/KeyboardView.swift +1 -1
- package/ios/traversal/ViewHierarchyNavigator.swift +2 -2
- package/ios/views/KeyboardControllerViewManager.swift +5 -5
- package/jest/index.js +3 -0
- package/lib/commonjs/components/ChatKit/TODO.md +20 -0
- package/lib/commonjs/components/ChatKit/hooks.js +13 -0
- package/lib/commonjs/components/ChatKit/hooks.js.map +1 -0
- package/lib/commonjs/components/ChatKit/index.js +55 -0
- package/lib/commonjs/components/ChatKit/index.js.map +1 -0
- package/lib/commonjs/components/ChatKit/types.js +6 -0
- package/lib/commonjs/components/ChatKit/types.js.map +1 -0
- package/lib/commonjs/components/ChatKit/useChatKeyboard/helpers.js +101 -0
- package/lib/commonjs/components/ChatKit/useChatKeyboard/helpers.js.map +1 -0
- package/lib/commonjs/components/ChatKit/useChatKeyboard/index.js +147 -0
- package/lib/commonjs/components/ChatKit/useChatKeyboard/index.js.map +1 -0
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js +7 -36
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -1
- package/lib/commonjs/components/KeyboardStickyView/index.js +7 -5
- package/lib/commonjs/components/KeyboardStickyView/index.js.map +1 -1
- package/lib/commonjs/components/ScrollViewWithBottomPadding/index.js +38 -14
- package/lib/commonjs/components/ScrollViewWithBottomPadding/index.js.map +1 -1
- package/lib/commonjs/components/index.js +7 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/index.js +7 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/components/ChatKit/TODO.md +20 -0
- package/lib/module/components/ChatKit/hooks.js +2 -0
- package/lib/module/components/ChatKit/hooks.js.map +1 -0
- package/lib/module/components/ChatKit/index.js +48 -0
- package/lib/module/components/ChatKit/index.js.map +1 -0
- package/lib/module/components/ChatKit/types.js +2 -0
- package/lib/module/components/ChatKit/types.js.map +1 -0
- package/lib/module/components/ChatKit/useChatKeyboard/helpers.js +92 -0
- package/lib/module/components/ChatKit/useChatKeyboard/helpers.js.map +1 -0
- package/lib/module/components/ChatKit/useChatKeyboard/index.js +141 -0
- package/lib/module/components/ChatKit/useChatKeyboard/index.js.map +1 -0
- package/lib/module/components/KeyboardAwareScrollView/index.js +7 -36
- package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -1
- package/lib/module/components/KeyboardStickyView/index.js +7 -5
- package/lib/module/components/KeyboardStickyView/index.js.map +1 -1
- package/lib/module/components/ScrollViewWithBottomPadding/index.js +38 -14
- package/lib/module/components/ScrollViewWithBottomPadding/index.js.map +1 -1
- package/lib/module/components/index.js +1 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/components/ChatKit/hooks.d.ts +2 -0
- package/lib/typescript/components/ChatKit/index.d.ts +14 -0
- package/lib/typescript/components/ChatKit/types.d.ts +49 -0
- package/lib/typescript/components/ChatKit/useChatKeyboard/helpers.d.ts +57 -0
- package/lib/typescript/components/ChatKit/useChatKeyboard/index.d.ts +36 -0
- package/lib/typescript/components/ScrollViewWithBottomPadding/index.d.ts +6 -1
- package/lib/typescript/components/index.d.ts +2 -0
- package/lib/typescript/index.d.ts +2 -2
- package/package.json +12 -4
- package/src/components/ChatKit/TODO.md +20 -0
- package/src/components/ChatKit/hooks.ts +2 -0
- package/src/components/ChatKit/index.tsx +63 -0
- package/src/components/ChatKit/types.ts +50 -0
- package/src/components/ChatKit/useChatKeyboard/helpers.ts +118 -0
- package/src/components/ChatKit/useChatKeyboard/index.ts +228 -0
- package/src/components/KeyboardAwareScrollView/index.tsx +7 -43
- package/src/components/KeyboardStickyView/index.tsx +4 -5
- package/src/components/ScrollViewWithBottomPadding/index.tsx +66 -17
- package/src/components/index.ts +2 -0
- package/src/index.ts +2 -0
|
@@ -6,11 +6,12 @@ import { ClippingScrollView } from "../../bindings";
|
|
|
6
6
|
|
|
7
7
|
import styles from "./styles";
|
|
8
8
|
|
|
9
|
-
import type { ScrollViewProps } from "react-native";
|
|
9
|
+
import type { ScrollViewProps, StyleProp, ViewStyle } from "react-native";
|
|
10
10
|
import type { SharedValue } from "react-native-reanimated";
|
|
11
11
|
|
|
12
|
+
const OS = Platform.OS;
|
|
12
13
|
const ReanimatedClippingScrollView =
|
|
13
|
-
|
|
14
|
+
OS === "android"
|
|
14
15
|
? Reanimated.createAnimatedComponent(ClippingScrollView)
|
|
15
16
|
: ClippingScrollView;
|
|
16
17
|
|
|
@@ -25,7 +26,12 @@ export type AnimatedScrollViewComponent = React.ForwardRefExoticComponent<
|
|
|
25
26
|
type ScrollViewWithBottomPaddingProps = {
|
|
26
27
|
ScrollViewComponent: AnimatedScrollViewComponent;
|
|
27
28
|
children?: React.ReactNode;
|
|
29
|
+
inverted?: boolean;
|
|
28
30
|
bottomPadding: SharedValue<number>;
|
|
31
|
+
/** Absolute Y content offset (iOS only, for ChatKit). */
|
|
32
|
+
contentOffsetY?: SharedValue<number>;
|
|
33
|
+
/** Style applied to the container wrapper (Android only, for ChatKit translateY). */
|
|
34
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
29
35
|
} & ScrollViewProps;
|
|
30
36
|
|
|
31
37
|
const ScrollViewWithBottomPadding = forwardRef<
|
|
@@ -33,35 +39,78 @@ const ScrollViewWithBottomPadding = forwardRef<
|
|
|
33
39
|
ScrollViewWithBottomPaddingProps
|
|
34
40
|
>(
|
|
35
41
|
(
|
|
36
|
-
{
|
|
42
|
+
{
|
|
43
|
+
ScrollViewComponent,
|
|
44
|
+
bottomPadding,
|
|
45
|
+
contentInset,
|
|
46
|
+
scrollIndicatorInsets,
|
|
47
|
+
inverted,
|
|
48
|
+
contentOffsetY,
|
|
49
|
+
containerStyle,
|
|
50
|
+
children,
|
|
51
|
+
style,
|
|
52
|
+
...rest
|
|
53
|
+
},
|
|
37
54
|
ref,
|
|
38
55
|
) => {
|
|
39
|
-
const animatedProps = useAnimatedProps(
|
|
40
|
-
|
|
56
|
+
const animatedProps = useAnimatedProps(() => {
|
|
57
|
+
const bottom = inverted
|
|
58
|
+
? 0
|
|
59
|
+
: bottomPadding.value + (contentInset?.bottom || 0);
|
|
60
|
+
const top = !inverted
|
|
61
|
+
? 0
|
|
62
|
+
: bottomPadding.value + (contentInset?.top || 0);
|
|
63
|
+
|
|
64
|
+
const result: Record<string, unknown> = {
|
|
41
65
|
// iOS prop
|
|
42
66
|
contentInset: {
|
|
43
|
-
bottom:
|
|
44
|
-
top:
|
|
67
|
+
bottom: bottom,
|
|
68
|
+
top: top,
|
|
45
69
|
right: contentInset?.right,
|
|
46
70
|
left: contentInset?.left,
|
|
47
71
|
},
|
|
72
|
+
scrollIndicatorInsets: {
|
|
73
|
+
bottom: bottom,
|
|
74
|
+
top: top,
|
|
75
|
+
right: scrollIndicatorInsets?.right,
|
|
76
|
+
left: scrollIndicatorInsets?.left,
|
|
77
|
+
},
|
|
48
78
|
// Android prop
|
|
49
79
|
contentInsetBottom: bottomPadding.value,
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
if (contentOffsetY) {
|
|
83
|
+
result.contentOffset = { x: 0, y: contentOffsetY.value };
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return result;
|
|
87
|
+
}, [
|
|
88
|
+
contentInset?.bottom,
|
|
89
|
+
contentInset?.top,
|
|
90
|
+
contentInset?.right,
|
|
91
|
+
contentInset?.left,
|
|
92
|
+
scrollIndicatorInsets?.bottom,
|
|
93
|
+
scrollIndicatorInsets?.top,
|
|
94
|
+
scrollIndicatorInsets?.right,
|
|
95
|
+
scrollIndicatorInsets?.left,
|
|
96
|
+
inverted,
|
|
97
|
+
contentOffsetY,
|
|
98
|
+
]);
|
|
58
99
|
|
|
59
100
|
return (
|
|
60
101
|
<ReanimatedClippingScrollView
|
|
61
102
|
animatedProps={animatedProps}
|
|
62
|
-
style={
|
|
103
|
+
style={[
|
|
104
|
+
styles.container,
|
|
105
|
+
OS === "android" ? containerStyle : undefined,
|
|
106
|
+
]}
|
|
63
107
|
>
|
|
64
|
-
<ScrollViewComponent
|
|
108
|
+
<ScrollViewComponent
|
|
109
|
+
ref={ref}
|
|
110
|
+
animatedProps={animatedProps}
|
|
111
|
+
style={style}
|
|
112
|
+
{...rest}
|
|
113
|
+
>
|
|
65
114
|
{children}
|
|
66
115
|
</ScrollViewComponent>
|
|
67
116
|
</ReanimatedClippingScrollView>
|
package/src/components/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ export {
|
|
|
5
5
|
default as KeyboardToolbar,
|
|
6
6
|
DefaultKeyboardToolbarTheme,
|
|
7
7
|
} from "./KeyboardToolbar";
|
|
8
|
+
export { default as ChatKit } from "./ChatKit";
|
|
8
9
|
export type { KeyboardAvoidingViewProps } from "./KeyboardAvoidingView";
|
|
9
10
|
export type { KeyboardStickyViewProps } from "./KeyboardStickyView";
|
|
10
11
|
export type {
|
|
@@ -12,3 +13,4 @@ export type {
|
|
|
12
13
|
KeyboardAwareScrollViewRef,
|
|
13
14
|
} from "./KeyboardAwareScrollView";
|
|
14
15
|
export type { KeyboardToolbarProps } from "./KeyboardToolbar";
|
|
16
|
+
export type { ChatKitScrollViewProps } from "./ChatKit/types";
|
package/src/index.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from "./types";
|
|
|
8
8
|
export * from "./compat";
|
|
9
9
|
|
|
10
10
|
export {
|
|
11
|
+
ChatKit,
|
|
11
12
|
KeyboardAvoidingView,
|
|
12
13
|
KeyboardStickyView,
|
|
13
14
|
KeyboardAwareScrollView,
|
|
@@ -16,6 +17,7 @@ export {
|
|
|
16
17
|
DefaultKeyboardToolbarTheme,
|
|
17
18
|
} from "./components";
|
|
18
19
|
export type {
|
|
20
|
+
ChatKitScrollViewProps,
|
|
19
21
|
KeyboardAvoidingViewProps,
|
|
20
22
|
KeyboardStickyViewProps,
|
|
21
23
|
KeyboardAwareScrollViewProps,
|