From 6b853fc7225d92d64c7b606a9fc272ab574859fa Mon Sep 17 00:00:00 2001 From: Aravind Raveendran Date: Thu, 6 Jun 2024 13:58:01 +1000 Subject: [PATCH] Direct explicit focus on input fields to fix the issue where focus is lost on dismissing keyboard --- src/screens/userInput/UserInput.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/screens/userInput/UserInput.tsx b/src/screens/userInput/UserInput.tsx index fc1b6e2..22c85f8 100644 --- a/src/screens/userInput/UserInput.tsx +++ b/src/screens/userInput/UserInput.tsx @@ -138,6 +138,7 @@ export const UserInput = ({ navigation }) => { validation={validation} autoFocus={!Platform.isTV} testID="StreamNameInput" + onSubmitEditing={() => accountIdRef.current.focus()} /> @@ -151,6 +152,13 @@ export const UserInput = ({ navigation }) => { onChangeText={onChangeAccountId} validation={validation} testID="AccountIdInput" + onSubmitEditing={() => { + if (Platform.isTV && Platform.OS === 'android') { + // FIXME: Workaround in Android TV's to keep the focus directed + // to another input field otherwise the focus is lost. + streamNameRef.current.focus() + } + }} />