Skip to content

Commit ed9b693

Browse files
authored
Update useKeyboard hook to use default argument for shouldHandleKeyboardEvents (#265)
* update useKeyboard argument shouldHandleKeyboardEvents to default to true * Add changesets patch bump for useKeyboard hook
1 parent 95e3cae commit ed9b693

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

.changeset/eighty-planets-think.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@react-native-ama/extras': patch
3+
---
4+
5+
Updated useKeyboard hook argument shouldHandleKeyboardEvents to default to true and not be required.

packages/extras/src/hooks/useKeyboard.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,19 @@ const KEYBOARD_EVENT_HIDE: KeyboardEventName = Platform.select({
2121
default: 'keyboardDidHide',
2222
});
2323

24-
export const useKeyboard = (shouldHandleKeyboardEvents: boolean) => {
24+
export const useKeyboard = (shouldHandleKeyboardEvents: boolean = true) => {
2525
const keyboardHeight = useSharedValue(0);
2626
const keyboardFinalHeight = useSharedValue(0);
2727
const isKeyboardVisible = useSharedValue(false);
2828

2929
const handleKeyboardEvent = useCallback(
3030
(
3131
isVisible: boolean,
32-
height: number,
32+
endCoordinatesHeight: number,
3333
duration: number,
3434
easing: KeyboardEventEasing,
3535
) => {
36-
const finalHeight = isVisible ? height : 0;
36+
const finalHeight = isVisible ? endCoordinatesHeight : 0;
3737

3838
const animationConfig = getKeyboardAnimationConfigs(easing, duration);
3939

0 commit comments

Comments
 (0)