Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### 🐛 Bug fixes

- **Android**: Fixed focused input in sheet causing auto-focus on main screen input after dismiss. ([#649](https://github.com/lodev09/react-native-true-sheet/pull/649) by [@lodev09](https://github.com/lodev09))

## 3.10.0

### 🎉 New features
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,11 @@ class TrueSheetViewController(private val reactContext: ThemedReactContext) :
private fun dismissKeyboard() {
isKeyboardDismissProgrammatic = true
KeyboardUtils.dismiss(reactContext)

// Clear focus from any focused view within the sheet to prevent
// Android from auto-focusing the next focusable view on the main
// screen when the sheet is removed from the hierarchy.
sheetView?.findFocus()?.clearFocus()
}

fun handleBackPress() {
Expand Down
2 changes: 2 additions & 0 deletions example/shared/src/components/sheets/BasicSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Button } from '../Button';
import { ButtonGroup } from '../ButtonGroup';
import { Spacer } from '../Spacer';
import { Header } from '../Header';
import { Input } from '../Input';

interface BasicSheetProps extends TrueSheetProps {
onNavigateToModal?: () => void;
Expand Down Expand Up @@ -119,6 +120,7 @@ export const BasicSheet = forwardRef((props: BasicSheetProps, ref: Ref<TrueSheet
<Button text="Auto" onPress={() => resize(0)} />
</ButtonGroup>
<Spacer />
<Input />
<ButtonGroup>
<Button text="Child Sheet" onPress={presentChild} />
<Button text="PromptSheet" onPress={presentPromptSheet} />
Expand Down
Loading