diff --git a/app/Tabs/Sessions/Navigation/TabBar.tsx b/app/Tabs/Sessions/Navigation/TabBar.tsx
index c18ff26..5e4831a 100644
--- a/app/Tabs/Sessions/Navigation/TabBar.tsx
+++ b/app/Tabs/Sessions/Navigation/TabBar.tsx
@@ -57,9 +57,7 @@ export default function TabBar({
}, 50);
} else {
onHideKeyboard?.();
- setTimeout(() => {
- Keyboard.dismiss();
- }, 50);
+ Keyboard.dismiss();
}
};
@@ -76,18 +74,6 @@ export default function TabBar({
minHeight: 60,
maxHeight: 60,
}}
- onStartShouldSetResponder={() => true}
- onResponderGrant={() => {
- if (!keyboardIntentionallyHiddenRef.current) {
- hiddenInputRef.current?.focus();
- }
- }}
- onResponderTerminationRequest={() => false}
- onTouchEndCapture={() => {
- if (!keyboardIntentionallyHiddenRef.current) {
- hiddenInputRef.current?.focus();
- }
- }}
focusable={false}
>
{
- if (!keyboardIntentionallyHiddenRef.current) {
- hiddenInputRef.current?.focus();
- }
- }}
onPress={() => router.navigate("/hosts" as any)}
- onPressOut={() => {
- if (!keyboardIntentionallyHiddenRef.current) {
- hiddenInputRef.current?.focus();
- }
- }}
focusable={false}
className="items-center justify-center rounded-md"
activeOpacity={0.7}
@@ -162,17 +138,7 @@ export default function TabBar({
return (
{
- if (!keyboardIntentionallyHiddenRef.current) {
- hiddenInputRef.current?.focus();
- }
- }}
onPress={() => onTabPress(session.id)}
- onPressOut={() => {
- if (!keyboardIntentionallyHiddenRef.current) {
- hiddenInputRef.current?.focus();
- }
- }}
focusable={false}
className="flex-row items-center rounded-md"
style={{
@@ -199,20 +165,10 @@ export default function TabBar({
{
- if (!keyboardIntentionallyHiddenRef.current) {
- hiddenInputRef.current?.focus();
- }
- }}
onPress={(e) => {
e.stopPropagation();
onTabClose(session.id);
}}
- onPressOut={() => {
- if (!keyboardIntentionallyHiddenRef.current) {
- hiddenInputRef.current?.focus();
- }
- }}
focusable={false}
className="items-center justify-center"
activeOpacity={0.7}
@@ -235,8 +191,7 @@ export default function TabBar({
- {!isCustomKeyboardVisible &&
- (isKeyboardVisible || keyboardIntentionallyHiddenRef.current) && (
+ {!isCustomKeyboardVisible && (
{
- if (!keyboardIntentionallyHiddenRef.current) {
- hiddenInputRef.current?.focus();
- }
- }}
onPress={() => onToggleKeyboard?.()}
- onPressOut={() => {
- if (!keyboardIntentionallyHiddenRef.current) {
- hiddenInputRef.current?.focus();
- }
- }}
focusable={false}
className="items-center justify-center rounded-md"
activeOpacity={0.7}
diff --git a/app/Tabs/Sessions/Sessions.tsx b/app/Tabs/Sessions/Sessions.tsx
index 2081eff..a8ef50f 100644
--- a/app/Tabs/Sessions/Sessions.tsx
+++ b/app/Tabs/Sessions/Sessions.tsx
@@ -117,36 +117,18 @@ export default function Sessions() {
};
}, [sessions.length, isCustomKeyboardVisible, activeSessionId]);
- useEffect(() => {
- const keyboardDidHideListener = Keyboard.addListener(
- "keyboardDidHide",
- () => {
- if (
- sessions.length > 0 &&
- !isCustomKeyboardVisible &&
- !keyboardIntentionallyHiddenRef.current
- ) {
- setTimeout(() => {
- hiddenInputRef.current?.focus();
- }, 50);
- }
- },
- );
- return () => {
- keyboardDidHideListener?.remove();
- };
- }, [
- sessions.length,
- isCustomKeyboardVisible,
- keyboardIntentionallyHiddenRef,
- ]);
useEffect(() => {
if (Platform.OS === "android" && sessions.length > 0) {
const backHandler = BackHandler.addEventListener(
"hardwareBackPress",
() => {
+ if (isKeyboardVisible) {
+ setKeyboardIntentionallyHidden(true);
+ Keyboard.dismiss();
+ return true;
+ }
return true;
},
);
@@ -155,7 +137,7 @@ export default function Sessions() {
backHandler.remove();
};
}
- }, [sessions.length]);
+ }, [sessions.length, isKeyboardVisible]);
useEffect(() => {
if (
@@ -185,23 +167,12 @@ export default function Sessions() {
? terminalRefs.current[activeSessionId]
: null;
activeRef?.current?.fit();
-
- if (
- sessions.length > 0 &&
- !isCustomKeyboardVisible &&
- !keyboardIntentionallyHiddenRef.current
- ) {
- hiddenInputRef.current?.focus();
- }
}, 300);
});
return () => subscription?.remove();
}, [
- activeSessionId,
- sessions.length,
- isCustomKeyboardVisible,
- keyboardIntentionallyHiddenRef,
+ activeSessionId
]);
useEffect(() => {
@@ -459,7 +430,7 @@ export default function Sessions() {
left: 0,
right: 0,
height: keyboardIntentionallyHiddenRef.current ? 66 : 50,
- zIndex: 999,
+ zIndex: 1003,
}}
>
)}
- {sessions.length > 0 &&
- !isCustomKeyboardVisible &&
- !keyboardIntentionallyHiddenRef.current &&
- !isKeyboardVisible && (
- 0
- ? keyboardHeight
- : Math.max(80, screenDimensions.height * 0.1),
- backgroundColor: "#09090b",
- justifyContent: "center",
- alignItems: "center",
- borderTopWidth: 1,
- borderTopColor: "#303032",
- zIndex: 1000,
- }}
- onPress={() => {
- setKeyboardIntentionallyHidden(false);
- hiddenInputRef.current?.focus();
- }}
- >
-
- Tap anywhere to bring back the keyboard
-
-
- )}
+
{sessions.length > 0 && !isCustomKeyboardVisible && (
{
setKeyboardIntentionallyHidden(false);
}}
- onBlur={() => {
- setTimeout(() => {
- if (
- sessions.length > 0 &&
- !isCustomKeyboardVisible &&
- !keyboardIntentionallyHiddenRef.current
- ) {
- hiddenInputRef.current?.focus();
- }
- }, 100);
- }}
- onSubmitEditing={() => {
- setTimeout(() => {
- if (
- sessions.length > 0 &&
- !isCustomKeyboardVisible &&
- !keyboardIntentionallyHiddenRef.current
- ) {
- hiddenInputRef.current?.focus();
- }
- }, 100);
- }}
+
/>
)}
diff --git a/app/Tabs/Sessions/Terminal.tsx b/app/Tabs/Sessions/Terminal.tsx
index 9cf0718..cce3111 100644
--- a/app/Tabs/Sessions/Terminal.tsx
+++ b/app/Tabs/Sessions/Terminal.tsx
@@ -48,7 +48,6 @@ export type TerminalHandle = {
export const Terminal = forwardRef(
({ hostConfig, isVisible, title = "Terminal", onClose }, ref) => {
const webViewRef = useRef(null);
- const hiddenInputRef = useRef(null);
const { config } = useTerminalCustomization();
const [webViewKey, setWebViewKey] = useState(0);
const [screenDimensions, setScreenDimensions] = useState(
@@ -315,7 +314,7 @@ export const Terminal = forwardRef(
}
const terminalElement = document.getElementById('terminal');
- ['touchstart','touchend','touchmove','mousedown','mouseup','click','dblclick','contextmenu'].forEach(function(ev){
+ ['touchstart','touchend','mousedown','mouseup','click','dblclick','contextmenu'].forEach(function(ev){
terminalElement.addEventListener(ev, function(e){
e.preventDefault();
e.stopPropagation();
@@ -603,11 +602,7 @@ export const Terminal = forwardRef(
};
}, []);
- const handleTerminalPress = useCallback(() => {
- if (Platform.OS === "android") {
- hiddenInputRef.current?.focus();
- }
- }, []);
+
return (
(
zIndex: isVisible ? 1 : -1,
}}
>
-
(
showsVerticalScrollIndicator={false}
nestedScrollEnabled={false}
/>
- {Platform.OS === "android" && (
-
- )}
-
{(showConnectingOverlay || isRetrying) && (