react-native-screens icon indicating copy to clipboard operation
react-native-screens copied to clipboard

feat: remove title with search bar

Open Gregoirevda opened this issue 1 year ago • 9 comments

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

Screenshot 2023-03-06 at 10 23 32

After

Screenshot 2023-03-06 at 10 23 52

Test code and steps to reproduce

  <Stack.Navigator>
     <Stack.Screen name="SearchScreen" component={SearchView} 
        options={{
          title: 'Search',
          headerSearchBarOptions: {
            placeholder: 'Search',
            removeTitle: true,
          },
        }}
      />
  </Stack.Navigator>

Gregoirevda avatar Mar 06 '23 09:03 Gregoirevda

  1. I've tried many alternatives, the only one who was getting close was [navitem setPreferredSearchBarPlacement:UINavigationItemSearchBarPlacementInline]; (iOS 16+ and next to title)

Gregoirevda avatar Mar 13 '23 12:03 Gregoirevda

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

Gregoirevda avatar Mar 13 '23 13:03 Gregoirevda

this is amazing, when will be released plz ?

hamdij0maa avatar Mar 13 '23 15:03 hamdij0maa

@kkafar animations are working properly both on iPhone and iPad (mainly cancel button appearing)

Gregoirevda avatar Mar 13 '23 17:03 Gregoirevda

any idea on when this change will be released please @kkafar @Gregoirevda ?

hamdij0maa avatar Mar 15 '23 12:03 hamdij0maa

@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.

kkafar avatar Mar 15 '23 12:03 kkafar

@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

hamdij0maa avatar Mar 15 '23 12:03 hamdij0maa

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?

FNG-2002 avatar Mar 23 '23 12:03 FNG-2002

@kkafar Could we get this merged?

Gregoirevda avatar Jul 18 '23 14:07 Gregoirevda