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
navigation header view have a shadow ,how does it to remove shadow? #790
Comments
You can change the header style in Something like this ( I haven't tested it though )
|
These are the default header styles https://github.com/react-community/react-navigation/blob/master/src/views/Header.js#L330-L341
|
It's not like that . |
I tried a variety of ways ,I can not remove the shadow on android. |
@roselind put this in its style object |
|
thanks . I solve it . At first it didn't work, and the second day ,the shadow be removed, it looked like it was a cache code : |
@roselind using it like this
gives me error
Please help |
@zarcode `
); |
Properties names have changed, so:
|
shadowOpacity and elevation do nothing in 1.0.0-beta.15. |
@tapz Upgrading react-navigation to ^1.0.0-beta.19 in package.json and re-installing, did the trick. |
add
to StackNavigator
|
I've got a TabNavigator and no matter how I try to specify the
With this the border is still visible on the To Do Screen. |
Can confirm, I have tried both options: export default StackNavigator({
Main: {
screen: Main,
navigationOptions: {
headerStyle: {
shadowOpacity: 0
}
}
},
}); and class Main extends Component {
static navigationOptions = ({ navigation }) => {
const { params = {} } = navigation.state;
return {
title: 'Main',
headerStyle: {
shadowOpacity: 0
},
}
}
} |
I've looked through the code. On iOS the headerStyle property you need to override is 'borderBottomWidth'. This works for me with react-navigation ^1.0.3 as of 17th Feb 18: headerStyle:{ |
We have header set to null for the page and then following worked
|
can someone please tell how to fix this if it's possible |
@totti1 This fixes it: #790 (comment) |
i did it but nothing changed |
Trying to hide border from last 1 hour but because we hopelessly dependant on this repo and Google. |
@nsisodiya Have you tried to set |
DON'T set the borderBottomWidth attr |
Just to add clarity for others, I'm using a bottom tab navigator (from import { createStackNavigator } from 'react-navigation'
import { createMaterialBottomTabNavigator } from 'react-navigation-material-bottom-tabs'
import TabBarIcon from 'app/components/tab-bar-icon'
import CommitmentsScreen from 'app/containers/commitments-screen'
import FoodPlanScreen from 'app/containers/food-plan-screen'
import SettingsScreen from 'app/containers/settings-screen'
import FoodCategoriesSettingsScreen from 'app/containers/food-categories/settings-screen'
import FoodCategoriesEditScreen from 'app/containers/food-categories/edit-screen'
import PortionEditScreen from 'app/containers/meal-plans/portion-edit-screen'
import { colors, paperTheme } from 'app/themes'
export const DEFAULT_SCREEN_NAME = 'FoodPlan'
const stack = (initialRouteName, screens) =>
createStackNavigator(screens, {
initialRouteName,
cardStyle: { // <----- Adding these cardStyles is what removed the shadow for the stacks
elevation: 0,
shadowOpacity: 0
}
})
const tab = (screen, title, iconName, backgroundColor) => ({
screen,
navigationOptions: {
barStyle: { backgroundColor },
headerStyle: { backgroundColor },
headerTintColor: colors.snow,
tabBarIcon: TabBarIcon(iconName),
title
},
customOverrides: {
styles: {
screen: { backgroundColor }
}
}
})
const FoodPlanStack = stack('FoodPlan', {
FoodPlan: FoodPlanScreen,
PortionEdit: PortionEditScreen
})
const SettingsStack = stack('Settings', {
FoodCategoriesEdit: FoodCategoriesEditScreen,
FoodCategoriesSettings: FoodCategoriesSettingsScreen,
Settings: SettingsScreen
})
const tabs = {
Commitments: tab(
CommitmentsScreen,
'Commitments',
'check',
colors.frenchMauve
),
FoodPlan: tab(FoodPlanStack, 'Food Plan', 'utensils', colors.mediumTurquoise),
Settings: tab(SettingsStack, 'Settings', 'cog', colors.darkPastelBlue)
}
const navigationSettings = {
initialRouteName: DEFAULT_SCREEN_NAME,
order: ['FoodPlan', 'Commitments', 'Settings'],
labeled: false,
activeTintColor: colors.snow,
inactiveTintColor: colors.deepSpaceSparkle,
barStyle: { backgroundColor: paperTheme.colors.primary },
headerStyle: { backgroundColor: paperTheme.colors.primary },
headerTintColor: paperTheme.colors.primary
}
const AppNavigation = createMaterialBottomTabNavigator(tabs, navigationSettings)
export default AppNavigation |
I am using react-navigation @ 2.14.2 and SteveGreenley's solution worked for me:
|
For react-navigation 2.x this worked for me with both android and iOS:
|
Solution above works, however on iOS, when you press the back button, the bottom border shows briefly. |
This is due to the previous screen not being unmounted. Therefore, what you're seeing is not from the header you removed the border from but rather the header on the previous screen. |
As of 3.x on 4/25/19 on Android used :
marginBottom -1 helps when you have a top bar nav underneath the header |
This was helpful. here my code: |
Here's what worked for me:
I then proceeded to put specific
|
this works well: |
I implemented a custom header on iOS and has this issue where the header had a white square, 2px wide, in the leftmost area of every header. It was particularly noticeable when swiping back from a screen. What made it go away was: createStackNavigator({}, { cardShadowEnabled: false }); |
you need to use
|
navTransparent={true} Add this attribute in Scene tag.This will working properly |
<Stack.Screen
options={{ headerShadowVisible: false }}
...
/> works on react-navigation@6 , doc 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. |
StackNavigator (StackNavigator)
ios :
android:
The text was updated successfully, but these errors were encountered: