Skip to content

Commit 4adc151

Browse files
Merge branch 'vishal/keyboard-compatible-hooks' of github.com:GetStream/stream-chat-react-native into vishal/keyboard-compatible-hooks
2 parents 3b3d18e + 4c0cc6c commit 4adc151

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/components/KeyboardCompatibleView/KeyboardCompatibleView.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ import { KeyboardContext } from '../../context';
2121
* ```
2222
*/
2323
export const KeyboardCompatibleView = ({
24+
children,
2425
enabled = true,
2526
keyboardDismissAnimationDuration = 500,
2627
keyboardOpenAnimationDuration = 500,
27-
children,
2828
}) => {
2929
const heightAnim = useRef(new Animated.Value(0)).current;
3030
const rootChannelView = useRef();
@@ -39,15 +39,15 @@ export const KeyboardCompatibleView = ({
3939

4040
useEffect(() => {
4141
Animated.timing(heightAnim, {
42-
toValue: channelHeight,
4342
duration: isKeyboardOpen
4443
? keyboardDismissAnimationDuration
4544
: keyboardOpenAnimationDuration,
45+
toValue: channelHeight,
4646
useNativeDriver: false,
4747
}).start();
4848
}, [
49-
heightAnim,
5049
channelHeight,
50+
heightAnim,
5151
keyboardDismissAnimationDuration,
5252
keyboardOpenAnimationDuration,
5353
]);
@@ -62,16 +62,16 @@ export const KeyboardCompatibleView = ({
6262
} else {
6363
// Bring the channel height to its full length state.
6464
Animated.timing(heightAnim, {
65-
toValue: initialHeight,
6665
duration: keyboardDismissAnimationDuration,
66+
toValue: initialHeight,
6767
useNativeDriver: false,
6868
}).start(resolve);
6969
}
7070
});
7171
}, [
72+
channelHeight,
7273
heightAnim,
7374
initialHeight,
74-
channelHeight,
7575
isKeyboardOpen,
7676
keyboardDismissAnimationDuration,
7777
]);
@@ -90,13 +90,13 @@ export const KeyboardCompatibleView = ({
9090
if (!initialHeight) {
9191
setInitialHeight(height);
9292
Animated.timing(heightAnim, {
93-
toValue: height,
9493
duration: 10,
94+
toValue: height,
9595
useNativeDriver: false,
9696
}).start();
9797
}
9898
},
99-
[heightAnim, initialHeight, enabled],
99+
[enabled, heightAnim, initialHeight],
100100
);
101101

102102
if (!enabled) {

src/components/KeyboardCompatibleView/hooks/useKeyboardCompatibleHeight.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,5 @@ export const useKeyboardCompatibleHeight = ({
8989
};
9090
}, [appState, initialHeight, keyboardDidHide, keyboardDidShow]);
9191

92-
return [height, keyboardOpen];
92+
return { height, keyboardOpen };
9393
};

0 commit comments

Comments
 (0)