react-native-screens
react-native-screens copied to clipboard
feat: remove title with search bar
Description
When using a search bar in react navigation, there's currently no option to have a search bar without title. Specifying a blank title leaves a blank area
Fixes https://github.com/react-navigation/react-navigation/issues/11257
Changes
Added removeTitle
property, which will place the search bar in the title
Screenshots / GIFs
Before
After
Test code and steps to reproduce
<Stack.Navigator>
<Stack.Screen name="SearchScreen" component={SearchView}
options={{
title: 'Search',
headerSearchBarOptions: {
placeholder: 'Search',
removeTitle: true,
},
}}
/>
</Stack.Navigator>
- I've tried many alternatives, the only one who was getting close was
[navitem setPreferredSearchBarPlacement:UINavigationItemSearchBarPlacementInline];
(iOS 16+ and next to title)
I've re-applied hidesNavigationBarDuringPresentation = false
back as clicking on the searchBar would then hide the searchBar, cannot see a use case for that :D
this is amazing, when will be released plz ?
@kkafar animations are working properly both on iPhone and iPad (mainly cancel button appearing)
any idea on when this change will be released please @kkafar @Gregoirevda ?
@hamdij0maa, I've not fount time to review it yet, but I'll try in incoming days & I did not plan releasing 3.21.0 earlier than few weeks from now. However we'll see whether we can release it sooner.
@hamdij0maa, I've not fount time to review it yet, but I'll try in incoming days & I did not plan releasing 3.21.0 earlier than few weeks from now. However we'll see whether we can release it sooner.
thank you <3
How is the behavior with headerButtons? For example if I want to have a headerRight with a Button. Will it dissapear and be replaced with the cancel buttom from the searchbar?
@kkafar Could we get this merged?