software-mansion / software-mansion/react-native-screens

Android: Up/back on search should cancel search, not navigate

Open
#2,744 5 comments 0 reactions 1 assignee View on GitHub

@kmichalikk is already working on this.

Since Jul 10, 2025.

platform:android repro-provided
Dominant language
TypeScript
Stars
3.7k
Forks
714
Avg merge
2d 23h
Merged PRs (30d)
71

Description

Description

Originally posted here https://github.com/react-navigation/react-navigation/issues/12459#issuecomment-2685489915

### Actual behaviour

Actual behaviour: On Android, tapping the up button or using the back gesture with search open immediately navigates from the screen.

https://github.com/user-attachments/assets/e4b20ff0-6bb5-44e4-968c-e4cc71fb5a5c

This is especially a problem in landscape mode, as the text input covers the X button and tapping the X button once will open the text input again. So to cancel search, you need to awkwardly close the input, press X, close the input, and then press X again

https://github.com/user-attachments/assets/2be274c6-44b1-429f-be31-a5b770f9b48f

Expected behavior

Expected behaviour: To match native behaviour and platform conventions. On Android, pressing the up or using the back gesture when search is open should first cancel the search. Tapping it again should then return from the screen.

I have tested this on a real device (Pixel 7 Pro) as well as the android emulator

Steps to reproduce
  1. Open search screen
  2. Tap search icon
  3. Search
  4. Press "<-" or do the back gesture
  5. Expected: cancel search. Actual: exits search screen
Snack or a link to a repository

https://github.com/andrewwardmt/mre-search-back-cancel

Screens version

4.4.0

React Native version

0.76.7

Platforms

Android

JavaScript runtime

None

Workflow

Expo bare workflow

Architecture

Fabric (New Architecture)

Build type

Debug mode

Device

Android emulator

Device model

No response

Acknowledgements

Yes

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.