react-native-keyboard-controller 1.21.4 → 1.21.6
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/android/src/main/java/com/reactnativekeyboardcontroller/extensions/ReactContext.kt +10 -0
- package/android/src/main/java/com/reactnativekeyboardcontroller/extensions/View.kt +0 -40
- package/android/src/main/java/com/reactnativekeyboardcontroller/modules/KeyboardControllerModuleImpl.kt +3 -11
- package/android/src/main/java/com/reactnativekeyboardcontroller/views/ClippingScrollViewDecoratorView.kt +1 -1
- package/android/src/main/java/com/reactnativekeyboardcontroller/views/EdgeToEdgeReactViewGroup.kt +19 -22
- package/lib/commonjs/components/KeyboardChatScrollView/index.js +3 -2
- package/lib/commonjs/components/KeyboardChatScrollView/index.js.map +1 -1
- package/lib/commonjs/components/KeyboardChatScrollView/types.js.map +1 -1
- package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js +3 -3
- package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js.map +1 -1
- package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.js +4 -4
- package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.js.map +1 -1
- package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/types.js.map +1 -1
- package/lib/commonjs/components/KeyboardChatScrollView/useExtraContentPadding/index.js +2 -2
- package/lib/commonjs/components/KeyboardChatScrollView/useExtraContentPadding/index.js.map +1 -1
- package/lib/commonjs/components/KeyboardToolbar/index.js +12 -3
- package/lib/commonjs/components/KeyboardToolbar/index.js.map +1 -1
- package/lib/commonjs/components/ScrollViewWithBottomPadding/index.js +1 -10
- package/lib/commonjs/components/ScrollViewWithBottomPadding/index.js.map +1 -1
- package/lib/commonjs/hooks/useKeyboardState/index.js +1 -7
- package/lib/commonjs/hooks/useKeyboardState/index.js.map +1 -1
- package/lib/commonjs/module.js +1 -1
- package/lib/commonjs/module.js.map +1 -1
- package/lib/module/components/KeyboardChatScrollView/index.js +3 -2
- package/lib/module/components/KeyboardChatScrollView/index.js.map +1 -1
- package/lib/module/components/KeyboardChatScrollView/types.js.map +1 -1
- package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js +3 -3
- package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js.map +1 -1
- package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.js +4 -4
- package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.js.map +1 -1
- package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/types.js.map +1 -1
- package/lib/module/components/KeyboardChatScrollView/useExtraContentPadding/index.js +2 -2
- package/lib/module/components/KeyboardChatScrollView/useExtraContentPadding/index.js.map +1 -1
- package/lib/module/components/KeyboardToolbar/index.js +12 -3
- package/lib/module/components/KeyboardToolbar/index.js.map +1 -1
- package/lib/module/components/ScrollViewWithBottomPadding/index.js +2 -11
- package/lib/module/components/ScrollViewWithBottomPadding/index.js.map +1 -1
- package/lib/module/hooks/useKeyboardState/index.js +1 -7
- package/lib/module/hooks/useKeyboardState/index.js.map +1 -1
- package/lib/module/module.js +1 -1
- package/lib/module/module.js.map +1 -1
- package/lib/typescript/components/KeyboardChatScrollView/index.d.ts +1 -1
- package/lib/typescript/components/KeyboardChatScrollView/types.d.ts +1 -1
- package/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/types.d.ts +1 -1
- package/lib/typescript/components/KeyboardChatScrollView/useExtraContentPadding/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/KeyboardChatScrollView/index.tsx +5 -2
- package/src/components/KeyboardChatScrollView/types.ts +1 -1
- package/src/components/KeyboardChatScrollView/useChatKeyboard/index.ios.ts +3 -3
- package/src/components/KeyboardChatScrollView/useChatKeyboard/index.ts +4 -4
- package/src/components/KeyboardChatScrollView/useChatKeyboard/types.ts +1 -1
- package/src/components/KeyboardChatScrollView/useExtraContentPadding/index.ts +3 -3
- package/src/components/KeyboardToolbar/index.tsx +13 -4
- package/src/components/ScrollViewWithBottomPadding/index.tsx +2 -12
- package/src/hooks/useKeyboardState/index.ts +1 -8
- package/src/module.ts +1 -1
|
@@ -26,7 +26,7 @@ type UseExtraContentPaddingOptions = {
|
|
|
26
26
|
contentOffsetY?: SharedValue<number>;
|
|
27
27
|
inverted: boolean;
|
|
28
28
|
keyboardLiftBehavior: KeyboardLiftBehavior;
|
|
29
|
-
freeze: boolean
|
|
29
|
+
freeze: SharedValue<boolean>;
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
/**
|
|
@@ -81,7 +81,7 @@ function useExtraContentPadding(options: UseExtraContentPaddingOptions): void {
|
|
|
81
81
|
useAnimatedReaction(
|
|
82
82
|
() => extraContentPadding.value,
|
|
83
83
|
(current, previous) => {
|
|
84
|
-
if (freeze || previous === null) {
|
|
84
|
+
if (freeze.value || previous === null) {
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
87
|
|
|
@@ -141,7 +141,7 @@ function useExtraContentPadding(options: UseExtraContentPaddingOptions): void {
|
|
|
141
141
|
scrollToTarget(target);
|
|
142
142
|
}
|
|
143
143
|
},
|
|
144
|
-
[inverted, keyboardLiftBehavior
|
|
144
|
+
[inverted, keyboardLiftBehavior],
|
|
145
145
|
);
|
|
146
146
|
}
|
|
147
147
|
|
|
@@ -99,11 +99,13 @@ const KeyboardToolbar: React.FC<KeyboardToolbarProps> & {
|
|
|
99
99
|
);
|
|
100
100
|
const containerStyle = useMemo(
|
|
101
101
|
() => [
|
|
102
|
+
// CRUCIAL: gives the native view real bounds
|
|
103
|
+
styles.sticky,
|
|
102
104
|
KEYBOARD_HAS_ROUNDED_CORNERS
|
|
103
|
-
? {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
105
|
+
? ({
|
|
106
|
+
left: (insets?.left ?? 0) + 16,
|
|
107
|
+
right: (insets?.right ?? 0) + 16,
|
|
108
|
+
} as const)
|
|
107
109
|
: null,
|
|
108
110
|
],
|
|
109
111
|
[insets],
|
|
@@ -207,6 +209,13 @@ const KeyboardToolbar: React.FC<KeyboardToolbarProps> & {
|
|
|
207
209
|
};
|
|
208
210
|
|
|
209
211
|
const styles = StyleSheet.create({
|
|
212
|
+
sticky: {
|
|
213
|
+
position: "absolute",
|
|
214
|
+
left: 0,
|
|
215
|
+
right: 0,
|
|
216
|
+
bottom: 0,
|
|
217
|
+
height: KEYBOARD_TOOLBAR_HEIGHT,
|
|
218
|
+
},
|
|
210
219
|
toolbar: {
|
|
211
220
|
position: "absolute",
|
|
212
221
|
bottom: 0,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
|
-
import { Platform
|
|
2
|
+
import { Platform } from "react-native";
|
|
3
3
|
import Reanimated, {
|
|
4
4
|
useAnimatedProps,
|
|
5
5
|
useSharedValue,
|
|
@@ -125,17 +125,7 @@ const ScrollViewWithBottomPadding = forwardRef<
|
|
|
125
125
|
style={styles.container}
|
|
126
126
|
>
|
|
127
127
|
<ScrollViewComponent ref={ref} animatedProps={animatedProps} {...rest}>
|
|
128
|
-
{
|
|
129
|
-
// The only thing it can break is `StickyHeader`, but it's already broken in FlatList and other lists
|
|
130
|
-
// don't support this functionality, so we can add additional view here
|
|
131
|
-
// The correct fix would be to add a new prop in ScrollView that allows
|
|
132
|
-
// to customize children extraction logic and skip custom view
|
|
133
|
-
<View collapsable={false} nativeID="container">
|
|
134
|
-
{children}
|
|
135
|
-
</View>
|
|
136
|
-
) : (
|
|
137
|
-
children
|
|
138
|
-
)}
|
|
128
|
+
{children}
|
|
139
129
|
</ScrollViewComponent>
|
|
140
130
|
</ReanimatedClippingScrollView>
|
|
141
131
|
);
|
|
@@ -5,7 +5,7 @@ import { KeyboardController } from "../../module";
|
|
|
5
5
|
|
|
6
6
|
import type { IKeyboardState } from "../../types";
|
|
7
7
|
|
|
8
|
-
const EVENTS = ["
|
|
8
|
+
const EVENTS = ["keyboardWillShow", "keyboardDidHide"] as const;
|
|
9
9
|
|
|
10
10
|
const getLatestState = () => ({
|
|
11
11
|
...KeyboardController.state(),
|
|
@@ -53,12 +53,6 @@ function useKeyboardState<T = IKeyboardState>(
|
|
|
53
53
|
setState(selector(getLatestState())),
|
|
54
54
|
),
|
|
55
55
|
);
|
|
56
|
-
// update `appearance` prematurely
|
|
57
|
-
const willShowSubscription = KeyboardEvents.addListener(
|
|
58
|
-
"keyboardWillShow",
|
|
59
|
-
(e) =>
|
|
60
|
-
setState(selector({ ...getLatestState(), appearance: e.appearance })),
|
|
61
|
-
);
|
|
62
56
|
|
|
63
57
|
// we might have missed an update between reading a value in render and
|
|
64
58
|
// `addListener` in this handler, so we set it here. If there was
|
|
@@ -67,7 +61,6 @@ function useKeyboardState<T = IKeyboardState>(
|
|
|
67
61
|
|
|
68
62
|
return () => {
|
|
69
63
|
subscriptions.forEach((subscription) => subscription.remove());
|
|
70
|
-
willShowSubscription.remove();
|
|
71
64
|
};
|
|
72
65
|
}, []);
|
|
73
66
|
|
package/src/module.ts
CHANGED