Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How remove bottom border of header #6899

Closed
Piero87 opened this issue Feb 19, 2020 · 21 comments
Closed

How remove bottom border of header #6899

Piero87 opened this issue Feb 19, 2020 · 21 comments

Comments

@Piero87
Copy link

Piero87 commented Feb 19, 2020

Current Behavior

In react navigation 4 I could remove the bottom border of the header, in version 5 I can't, this is a screen of the border:

Schermata 2020-02-19 alle 22 05 19

And this is the code I use:

    <Stack.Navigator
      initialRouteName="Page1"
      screenOptions={{
  headerStyle: {
    backgroundColor: commonStyles.mainBGColor,
    borderBottomWidth: 0,
  },
  headerTintColor: '#fff',
  headerTitleStyle: commonStyles.headerText,
}}
    >

Expected Behavior

I want remove the bottom border i add some arrow to indicate the border to make my self more clear:
Schermata 2020-02-19 alle 22 05 19

Your Environment

software version
iOS
@react-navigation/stack
react-native-gesture-handler
react-native-safe-area-context
react-native-screens
react-native
yarn
@WoLewicki
Copy link
Member

It looks like the prop connected with it is shadowOffset here (for iOS):

so you can change it by providing something like shadowOffset: { height: 0, width: 0 }

@pmadruga
Copy link

pmadruga commented Jul 21, 2020

This is what worked for me:

screenOptions={{
        headerHideShadow: true
      }}

EDIT: If you're using native-stack.

@WoLewicki
Copy link
Member

@pmadruga I am afraid it worked for you in native-stack, not in stack. Am I right?

@hkadyanji
Copy link

@Piero87 adding shadowColor: 'transparent' in headerStyle worked for me

@Mangor1no
Copy link

@Piero87 adding shadowColor: 'transparent' in headerStyle worked for me

This solution works for me! Thank you a lot!

@pmadruga
Copy link

pmadruga commented Aug 17, 2020

@pmadruga I am afraid it worked for you in native-stack, not in stack. Am I right?

You're right, @WoLewicki - thanks for pointing it out.

@NishargShah
Copy link

screenOptions={{
    headerStyle: { elevation: 0 }
}}

works fine in android 😄

@goodryanboy
Copy link

borderBottomColor: 'transparent' works for me ios

@dereknahman
Copy link

dereknahman commented Nov 10, 2020

Here's what I did for my use case (i.e., the header had to have the exact same colour as the screen's backgroundColor):

 options={{
          title: false,
          headerTransparent: true,
        }}

...haven't tested on Android yet but it works on iOS.

@Mrjavaci

This comment has been minimized.

@darrylyoung
Copy link

The following worked for me:

headerStyle: {
  ... // your other styles
  shadowColor: 'transparent',
}

@rn04techmelo

This comment has been minimized.

@gtallen13
Copy link

headerTransparent:true, worked for me

@hungdev
Copy link

hungdev commented Mar 24, 2021

The following worked for me:

headerStyle: {
  ... // your other styles
  shadowColor: 'transparent', // ios
  elevation: 0  // android
}

thank you. it worked for me. React navigation version 5

@russiann
Copy link

headerShadowVisible works for me:

https://reactnavigation.org/docs/native-stack-navigator/#headershadowvisible

<Stack.Navigator
  initialRouteName="home"
  screenOptions={{
    headerShadowVisible: false
  }}
>

@github-actions
Copy link

Hey! This issue is closed and isn't watched by the core team. You are welcome to discuss the issue with others in this thread, but if you think this issue is still valid and needs to be tracked, please open a new issue with a repro.

@fmacedoo
Copy link

fmacedoo commented Nov 29, 2021

@russiann
headerShadowVisible works for me:

https://reactnavigation.org/docs/native-stack-navigator/#headershadowvisible

<Stack.Navigator
  initialRouteName="home"
  screenOptions={{
    headerShadowVisible: false
  }}
>

Worked pretty well at "@react-navigation/native-stack": "^6.2.5".
No other option replied here worked.

@ashkan-esz
Copy link

headerShadowVisible works for me:

https://reactnavigation.org/docs/native-stack-navigator/#headershadowvisible

<Stack.Navigator
  initialRouteName="home"
  screenOptions={{
    headerShadowVisible: false
  }}
>

tnx , this one woked for me.

@alamothe
Copy link

I have the opposite problem with native stack navigator. When I do headerTransparent: true, the "shadow" disappears:

		<MyStack.Navigator
			screenOptions={{
				headerTransparent: true,
				headerBlurEffect: "systemChromeMaterialLight",
				headerShadowVisible: true,
			}}
		>

Do you know how to get it back? The native iMessage app on iOS still has the "shadow" even though it uses transparent background.

@varda-altusnova
Copy link

@alamothe have u managed to resolve that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests