Skip to content

Commit

Permalink
Direct explicit focus on input fields to fix the issue where focus is…
Browse files Browse the repository at this point in the history
… lost on dismissing keyboard
  • Loading branch information
aravind-raveendran committed Jun 6, 2024
1 parent 56cc63a commit 6b853fc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/screens/userInput/UserInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ export const UserInput = ({ navigation }) => {
validation={validation}
autoFocus={!Platform.isTV}
testID="StreamNameInput"
onSubmitEditing={() => accountIdRef.current.focus()}
/>
</FocusedComponent>
<FocusedComponent testID="AccountIdFocusElement" componentRef={accountIdRef}>
Expand All @@ -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()
}
}}
/>
</FocusedComponent>
<Button
Expand Down

0 comments on commit 6b853fc

Please sign in to comment.