diff --git a/app/Tabs/Sessions/Sessions.tsx b/app/Tabs/Sessions/Sessions.tsx index d0c80f6..2081eff 100644 --- a/app/Tabs/Sessions/Sessions.tsx +++ b/app/Tabs/Sessions/Sessions.tsx @@ -13,6 +13,7 @@ import { Pressable, Dimensions, BackHandler, + AppState, } from "react-native"; import { useSafeAreaInsets } from "react-native-safe-area-context"; import { useFocusEffect } from "@react-navigation/native"; @@ -52,6 +53,7 @@ export default function Sessions() { const [screenDimensions, setScreenDimensions] = useState( Dimensions.get("window"), ); + const [keyboardType, setKeyboardType] = useState('default'); useEffect(() => { const map: Record> = { @@ -91,6 +93,30 @@ export default function Sessions() { ]), ); + useEffect(() => { + const subscription = AppState.addEventListener("change", (nextAppState) => { + if (nextAppState === "active") { + if ( + sessions.length > 0 && + !isCustomKeyboardVisible && + !keyboardIntentionallyHiddenRef.current + ) { + setTimeout(() => { + setKeyboardType('email-address'); + setTimeout(() => { + setKeyboardType('default'); + hiddenInputRef.current?.focus(); + }, 100); + }, 250); + } + } + }); + + return () => { + subscription.remove(); + }; + }, [sessions.length, isCustomKeyboardVisible, activeSessionId]); + useEffect(() => { const keyboardDidHideListener = Keyboard.addListener( "keyboardDidHide", @@ -562,7 +588,7 @@ export default function Sessions() { pointerEvents="none" autoFocus={false} showSoftInputOnFocus={true} - keyboardType="default" + keyboardType={keyboardType} returnKeyType="default" blurOnSubmit={false} editable={true}