From 28e4b9a04786089f4dc086cb83f98b843e439fa2 Mon Sep 17 00:00:00 2001 From: Jasonzza Date: Wed, 27 Dec 2023 22:11:31 +0800 Subject: [PATCH] feat: add cancelSearch command on SearchBar (#1987) ## Description Add cancelSearch native command to SearchBar imperative API. The command provides a way for developers to programmatically cancel an ongoing search operation and clear the search input. ## Changes - Added JS impl - Added Native impl (both Android & iOS) - RNSSearchBar.mm - CustomSearchView.kt - SearchBarManager.kt - SearchBarView.kt - Updated JS types - Updated docs ## Test code and steps to reproduce Test1097 in both FabricTestExample & TestsExample ## Checklist - [x] Included code example that can be used to test this change - [x] Updated TS types - [x] Updated documentation: - [x] https://github.com/software-mansion/react-native-screens/blob/main/guides/GUIDE_FOR_LIBRARY_AUTHORS.md - [x] https://github.com/software-mansion/react-native-screens/blob/main/native-stack/README.md - [x] https://github.com/software-mansion/react-native-screens/blob/main/src/types.tsx - [ ] https://github.com/software-mansion/react-native-screens/blob/main/src/native-stack/types.tsx - [ ] Ensured that CI passes --------- Co-authored-by: Kacper Kafara --- Example/src/screens/SearchBar.tsx | 6 +++++- FabricTestExample/src/Test1097.tsx | 4 ++++ TestsExample/src/Test1097.tsx | 4 ++++ .../com/swmansion/rnscreens/CustomSearchView.kt | 5 +++++ .../com/swmansion/rnscreens/SearchBarManager.kt | 1 + .../com/swmansion/rnscreens/SearchBarView.kt | 4 ++++ guides/GUIDE_FOR_LIBRARY_AUTHORS.md | 1 + ios/RNSSearchBar.mm | 16 ++++++++++++++++ native-stack/README.md | 1 + src/fabric/SearchBarNativeComponent.ts | 2 ++ src/index.native.tsx | 13 +++++++++++-- src/types.tsx | 2 ++ 12 files changed, 56 insertions(+), 3 deletions(-) diff --git a/Example/src/screens/SearchBar.tsx b/Example/src/screens/SearchBar.tsx index 37ddd7380c..e7968e6b9c 100644 --- a/Example/src/screens/SearchBar.tsx +++ b/Example/src/screens/SearchBar.tsx @@ -177,7 +177,7 @@ const MainScreen = ({ navigation }: MainScreenProps): JSX.Element => {