Skip to content

Commit

Permalink
fix: hide navigation bar when keyboard disappear
Browse files Browse the repository at this point in the history
  • Loading branch information
lme-axelor committed Nov 4, 2024
1 parent 49ed743 commit 63530d2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
5 changes: 5 additions & 0 deletions changelogs/unreleased/86451.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"title": "Screen: hide native navigation bar when keyboard disappears",
"type": "fix",
"packages": "ui"
}
13 changes: 12 additions & 1 deletion packages/ui/src/components/atoms/Screen/Screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/

import React, {useEffect, useMemo, useState} from 'react';
import {ActivityIndicator, StyleSheet, View} from 'react-native';
import {ActivityIndicator, Keyboard, StyleSheet, View} from 'react-native';
import SystemNavigationBar from 'react-native-system-navigation-bar';
import {ThemeColors, useThemeColor} from '../../../theme';
import {useConfig} from '../../../config/ConfigContext';
Expand Down Expand Up @@ -58,6 +58,17 @@ const Screen = ({
setFixedItemsHeight(height);
};

useEffect(() => {
const keyboardHideListener = Keyboard.addListener(
'keyboardDidHide',
immersiveMode,
);

return () => {
keyboardHideListener.remove();
};
}, []);

useEffect(() => {
immersiveMode();
}, []);
Expand Down

0 comments on commit 63530d2

Please sign in to comment.