-
-
Notifications
You must be signed in to change notification settings - Fork 574
Description
Description
I'm using the iOS search bar to search artists. Works as expected.
When you click on an artist, it opens the Artist
screen.
The Artist
screen has headerShown: false
, since I have a custom header on that screen.
// this is the screen that search navigates to
<Screen
name="Artist"
component={ArtistScreen}
options={{
headerShown: false,
}}
getId={({ params }) => {
return params?.slug
}}
/>
However, if I open the artist screen while the search bar is focused, it adds a header to the Artist
screen, and creates a glitchy experience when I go back.
Screenshots
Works
When the search bar is not focused, and I click an artist, it works normally. It navigates to the Artist
screen, and there's no header.
Video: https://www.loom.com/share/174403203eb941f9a5731ba62253ab11
Doesn't work
However, when the search bar is focused, it incorrectly adds a header to the Artist
screen. Then, going back causes a weird jump.
Video: https://www.loom.com/share/8f8037145df649f880b891f52b099520
Steps To Reproduce
- Create a native stack screen with a search bar
- Navigate to a screen that has
headerShown: false
while the search bar is focused. - Try going back, too
Expected behavior
Having a searchBar
should not add a header when opening a screen that has headerShown: false
.
Actual behavior
A focused searchBar
causes screens opened to have a header. It also causes a layout glitch when you go back. I have contentInsetAdjustmentBehavior="automatic"
on my ScrollView
like I saw in the TestExample
file.
Snack or minimal code example
Expo Snack doesn't support 3.4.0. Let me know if you need me to make a full reproduction.
Package versions
- React: 16.8.3
- React Native: 0.63.4
- React Native Screens: 3.4.0