Skip to content

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

@andrewwardmt

Description

@andrewwardmt

Description

Originally posted here react-navigation/react-navigation#12459 (comment)

### Actual behaviour

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

mre-search-back.webm

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

mre-search-back-landscape.webm

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

Metadata

Metadata

Assignees

Labels

Platform: AndroidThis issue is specific to AndroidRepro providedA reproduction with a snack or repo is provided

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions