React Native Navigation bottomTabNavigater and Header
I am trying to make an app navigation, with tabs on the bottom and some buttons on the header.
The set up I have at the moment is following:
AppNavigator.Js which has a SwitchNavigation for the login and signUp. Then a StackNavgation for the Mainapp, inside is the TabNavigator.
const AppStack = createStackNavigator({
Main: MainTabNavigator,
Profile: ProfileScreen,
UserSettings: SettingsScreen,
Abo: AboScreen,
})
AppStack.navigationOptions = {
headerRight: (
<Button
onPress={() => alert('This is a button!')}
title="Info"
color="#fff"
/>
),
}
{/* Navigation all the routes added here */}
export default createSwitchNavigator({
Loading: AuthLoadingScreen,
Welcome: WelcomeScreen,
App: AppStack,
Login: LoginScreen,
SignUp: SignUpScreen,
ForgotPassword: ForgotPasswordScreen,
});
MainTabNavigator.js in here I have the Tabs, each Tab is a StackNavigator.
const NewsStack = createStackNavigator({
News: NewsScreen,
});
NewsStack.navigationOptions = {
tabBarLabel: 'News',
header: null,
tabBarIcon: ({ focused }) => (
<TabBarIcon
focused={focused}
name={
Platform.OS === 'ios'
? `ios-information-circle${focused ? '' : '-outline'}`
: 'md-information-circle'
}
/>
),
};
const AbosStack = createStackNavigator({
Abos: AboScreen,
});
AbosStack.navigationOptions = {
tabBarLabel: 'Abos',
header: null,
tabBarIcon: ({ focused }) => (
<TabBarIcon
focused={focused}
name={Platform.OS === 'ios' ? `ios-link${focused ? '' : '-outline'}` : 'md-link'}
/>
),
};
const MomentsStack = createStackNavigator({
Moments: MomentsScreen,
});
MomentsStack.navigationOptions = {
tabBarLabel: 'Moments',
header: null,
tabBarIcon: ({ focused }) => (
<TabBarIcon
focused={focused}
name={Platform.OS === 'ios' ? `ios-options${focused ? '' : '-outline'}` : 'md-options'}
/>
),
};
export default createBottomTabNavigator({
News: NewsStack,
Abo: AbosStack,
Moment: MomentsStack,
});
I End up with followingTwo Headers and cant add Icon to Header
How can I disable the second Header and How can I add Buttons to the Header to Add some Navigation to that too?
reactjs react-native react-navigation
add a comment |
I am trying to make an app navigation, with tabs on the bottom and some buttons on the header.
The set up I have at the moment is following:
AppNavigator.Js which has a SwitchNavigation for the login and signUp. Then a StackNavgation for the Mainapp, inside is the TabNavigator.
const AppStack = createStackNavigator({
Main: MainTabNavigator,
Profile: ProfileScreen,
UserSettings: SettingsScreen,
Abo: AboScreen,
})
AppStack.navigationOptions = {
headerRight: (
<Button
onPress={() => alert('This is a button!')}
title="Info"
color="#fff"
/>
),
}
{/* Navigation all the routes added here */}
export default createSwitchNavigator({
Loading: AuthLoadingScreen,
Welcome: WelcomeScreen,
App: AppStack,
Login: LoginScreen,
SignUp: SignUpScreen,
ForgotPassword: ForgotPasswordScreen,
});
MainTabNavigator.js in here I have the Tabs, each Tab is a StackNavigator.
const NewsStack = createStackNavigator({
News: NewsScreen,
});
NewsStack.navigationOptions = {
tabBarLabel: 'News',
header: null,
tabBarIcon: ({ focused }) => (
<TabBarIcon
focused={focused}
name={
Platform.OS === 'ios'
? `ios-information-circle${focused ? '' : '-outline'}`
: 'md-information-circle'
}
/>
),
};
const AbosStack = createStackNavigator({
Abos: AboScreen,
});
AbosStack.navigationOptions = {
tabBarLabel: 'Abos',
header: null,
tabBarIcon: ({ focused }) => (
<TabBarIcon
focused={focused}
name={Platform.OS === 'ios' ? `ios-link${focused ? '' : '-outline'}` : 'md-link'}
/>
),
};
const MomentsStack = createStackNavigator({
Moments: MomentsScreen,
});
MomentsStack.navigationOptions = {
tabBarLabel: 'Moments',
header: null,
tabBarIcon: ({ focused }) => (
<TabBarIcon
focused={focused}
name={Platform.OS === 'ios' ? `ios-options${focused ? '' : '-outline'}` : 'md-options'}
/>
),
};
export default createBottomTabNavigator({
News: NewsStack,
Abo: AbosStack,
Moment: MomentsStack,
});
I End up with followingTwo Headers and cant add Icon to Header
How can I disable the second Header and How can I add Buttons to the Header to Add some Navigation to that too?
reactjs react-native react-navigation
take a look at this project, they have code samples for everything that you are trying to do: github.com/react-native-training/react-native-elements
– kivul
Nov 22 '18 at 11:07
Thank you, but as I see they didnt use react-navigation. My question is how to solve this with react-navigation.
– MirjamT
Nov 22 '18 at 21:21
they are using react-navigation on the project, im pretty sure you didnt read correctly what i said: 'they have code samples for everything that you are trying to do'
– kivul
Nov 22 '18 at 21:43
I read your message but unfortunantely they didnt use react-navigation. I searched through the whole project. I would like to do it with react-navigation.
– MirjamT
Dec 1 '18 at 12:24
add a comment |
I am trying to make an app navigation, with tabs on the bottom and some buttons on the header.
The set up I have at the moment is following:
AppNavigator.Js which has a SwitchNavigation for the login and signUp. Then a StackNavgation for the Mainapp, inside is the TabNavigator.
const AppStack = createStackNavigator({
Main: MainTabNavigator,
Profile: ProfileScreen,
UserSettings: SettingsScreen,
Abo: AboScreen,
})
AppStack.navigationOptions = {
headerRight: (
<Button
onPress={() => alert('This is a button!')}
title="Info"
color="#fff"
/>
),
}
{/* Navigation all the routes added here */}
export default createSwitchNavigator({
Loading: AuthLoadingScreen,
Welcome: WelcomeScreen,
App: AppStack,
Login: LoginScreen,
SignUp: SignUpScreen,
ForgotPassword: ForgotPasswordScreen,
});
MainTabNavigator.js in here I have the Tabs, each Tab is a StackNavigator.
const NewsStack = createStackNavigator({
News: NewsScreen,
});
NewsStack.navigationOptions = {
tabBarLabel: 'News',
header: null,
tabBarIcon: ({ focused }) => (
<TabBarIcon
focused={focused}
name={
Platform.OS === 'ios'
? `ios-information-circle${focused ? '' : '-outline'}`
: 'md-information-circle'
}
/>
),
};
const AbosStack = createStackNavigator({
Abos: AboScreen,
});
AbosStack.navigationOptions = {
tabBarLabel: 'Abos',
header: null,
tabBarIcon: ({ focused }) => (
<TabBarIcon
focused={focused}
name={Platform.OS === 'ios' ? `ios-link${focused ? '' : '-outline'}` : 'md-link'}
/>
),
};
const MomentsStack = createStackNavigator({
Moments: MomentsScreen,
});
MomentsStack.navigationOptions = {
tabBarLabel: 'Moments',
header: null,
tabBarIcon: ({ focused }) => (
<TabBarIcon
focused={focused}
name={Platform.OS === 'ios' ? `ios-options${focused ? '' : '-outline'}` : 'md-options'}
/>
),
};
export default createBottomTabNavigator({
News: NewsStack,
Abo: AbosStack,
Moment: MomentsStack,
});
I End up with followingTwo Headers and cant add Icon to Header
How can I disable the second Header and How can I add Buttons to the Header to Add some Navigation to that too?
reactjs react-native react-navigation
I am trying to make an app navigation, with tabs on the bottom and some buttons on the header.
The set up I have at the moment is following:
AppNavigator.Js which has a SwitchNavigation for the login and signUp. Then a StackNavgation for the Mainapp, inside is the TabNavigator.
const AppStack = createStackNavigator({
Main: MainTabNavigator,
Profile: ProfileScreen,
UserSettings: SettingsScreen,
Abo: AboScreen,
})
AppStack.navigationOptions = {
headerRight: (
<Button
onPress={() => alert('This is a button!')}
title="Info"
color="#fff"
/>
),
}
{/* Navigation all the routes added here */}
export default createSwitchNavigator({
Loading: AuthLoadingScreen,
Welcome: WelcomeScreen,
App: AppStack,
Login: LoginScreen,
SignUp: SignUpScreen,
ForgotPassword: ForgotPasswordScreen,
});
MainTabNavigator.js in here I have the Tabs, each Tab is a StackNavigator.
const NewsStack = createStackNavigator({
News: NewsScreen,
});
NewsStack.navigationOptions = {
tabBarLabel: 'News',
header: null,
tabBarIcon: ({ focused }) => (
<TabBarIcon
focused={focused}
name={
Platform.OS === 'ios'
? `ios-information-circle${focused ? '' : '-outline'}`
: 'md-information-circle'
}
/>
),
};
const AbosStack = createStackNavigator({
Abos: AboScreen,
});
AbosStack.navigationOptions = {
tabBarLabel: 'Abos',
header: null,
tabBarIcon: ({ focused }) => (
<TabBarIcon
focused={focused}
name={Platform.OS === 'ios' ? `ios-link${focused ? '' : '-outline'}` : 'md-link'}
/>
),
};
const MomentsStack = createStackNavigator({
Moments: MomentsScreen,
});
MomentsStack.navigationOptions = {
tabBarLabel: 'Moments',
header: null,
tabBarIcon: ({ focused }) => (
<TabBarIcon
focused={focused}
name={Platform.OS === 'ios' ? `ios-options${focused ? '' : '-outline'}` : 'md-options'}
/>
),
};
export default createBottomTabNavigator({
News: NewsStack,
Abo: AbosStack,
Moment: MomentsStack,
});
I End up with followingTwo Headers and cant add Icon to Header
How can I disable the second Header and How can I add Buttons to the Header to Add some Navigation to that too?
const AppStack = createStackNavigator({
Main: MainTabNavigator,
Profile: ProfileScreen,
UserSettings: SettingsScreen,
Abo: AboScreen,
})
AppStack.navigationOptions = {
headerRight: (
<Button
onPress={() => alert('This is a button!')}
title="Info"
color="#fff"
/>
),
}
{/* Navigation all the routes added here */}
export default createSwitchNavigator({
Loading: AuthLoadingScreen,
Welcome: WelcomeScreen,
App: AppStack,
Login: LoginScreen,
SignUp: SignUpScreen,
ForgotPassword: ForgotPasswordScreen,
});
const AppStack = createStackNavigator({
Main: MainTabNavigator,
Profile: ProfileScreen,
UserSettings: SettingsScreen,
Abo: AboScreen,
})
AppStack.navigationOptions = {
headerRight: (
<Button
onPress={() => alert('This is a button!')}
title="Info"
color="#fff"
/>
),
}
{/* Navigation all the routes added here */}
export default createSwitchNavigator({
Loading: AuthLoadingScreen,
Welcome: WelcomeScreen,
App: AppStack,
Login: LoginScreen,
SignUp: SignUpScreen,
ForgotPassword: ForgotPasswordScreen,
});
const NewsStack = createStackNavigator({
News: NewsScreen,
});
NewsStack.navigationOptions = {
tabBarLabel: 'News',
header: null,
tabBarIcon: ({ focused }) => (
<TabBarIcon
focused={focused}
name={
Platform.OS === 'ios'
? `ios-information-circle${focused ? '' : '-outline'}`
: 'md-information-circle'
}
/>
),
};
const AbosStack = createStackNavigator({
Abos: AboScreen,
});
AbosStack.navigationOptions = {
tabBarLabel: 'Abos',
header: null,
tabBarIcon: ({ focused }) => (
<TabBarIcon
focused={focused}
name={Platform.OS === 'ios' ? `ios-link${focused ? '' : '-outline'}` : 'md-link'}
/>
),
};
const MomentsStack = createStackNavigator({
Moments: MomentsScreen,
});
MomentsStack.navigationOptions = {
tabBarLabel: 'Moments',
header: null,
tabBarIcon: ({ focused }) => (
<TabBarIcon
focused={focused}
name={Platform.OS === 'ios' ? `ios-options${focused ? '' : '-outline'}` : 'md-options'}
/>
),
};
export default createBottomTabNavigator({
News: NewsStack,
Abo: AbosStack,
Moment: MomentsStack,
});
const NewsStack = createStackNavigator({
News: NewsScreen,
});
NewsStack.navigationOptions = {
tabBarLabel: 'News',
header: null,
tabBarIcon: ({ focused }) => (
<TabBarIcon
focused={focused}
name={
Platform.OS === 'ios'
? `ios-information-circle${focused ? '' : '-outline'}`
: 'md-information-circle'
}
/>
),
};
const AbosStack = createStackNavigator({
Abos: AboScreen,
});
AbosStack.navigationOptions = {
tabBarLabel: 'Abos',
header: null,
tabBarIcon: ({ focused }) => (
<TabBarIcon
focused={focused}
name={Platform.OS === 'ios' ? `ios-link${focused ? '' : '-outline'}` : 'md-link'}
/>
),
};
const MomentsStack = createStackNavigator({
Moments: MomentsScreen,
});
MomentsStack.navigationOptions = {
tabBarLabel: 'Moments',
header: null,
tabBarIcon: ({ focused }) => (
<TabBarIcon
focused={focused}
name={Platform.OS === 'ios' ? `ios-options${focused ? '' : '-outline'}` : 'md-options'}
/>
),
};
export default createBottomTabNavigator({
News: NewsStack,
Abo: AbosStack,
Moment: MomentsStack,
});
reactjs react-native react-navigation
reactjs react-native react-navigation
edited Nov 22 '18 at 11:03
MirjamT
asked Nov 22 '18 at 10:56
MirjamTMirjamT
82
82
take a look at this project, they have code samples for everything that you are trying to do: github.com/react-native-training/react-native-elements
– kivul
Nov 22 '18 at 11:07
Thank you, but as I see they didnt use react-navigation. My question is how to solve this with react-navigation.
– MirjamT
Nov 22 '18 at 21:21
they are using react-navigation on the project, im pretty sure you didnt read correctly what i said: 'they have code samples for everything that you are trying to do'
– kivul
Nov 22 '18 at 21:43
I read your message but unfortunantely they didnt use react-navigation. I searched through the whole project. I would like to do it with react-navigation.
– MirjamT
Dec 1 '18 at 12:24
add a comment |
take a look at this project, they have code samples for everything that you are trying to do: github.com/react-native-training/react-native-elements
– kivul
Nov 22 '18 at 11:07
Thank you, but as I see they didnt use react-navigation. My question is how to solve this with react-navigation.
– MirjamT
Nov 22 '18 at 21:21
they are using react-navigation on the project, im pretty sure you didnt read correctly what i said: 'they have code samples for everything that you are trying to do'
– kivul
Nov 22 '18 at 21:43
I read your message but unfortunantely they didnt use react-navigation. I searched through the whole project. I would like to do it with react-navigation.
– MirjamT
Dec 1 '18 at 12:24
take a look at this project, they have code samples for everything that you are trying to do: github.com/react-native-training/react-native-elements
– kivul
Nov 22 '18 at 11:07
take a look at this project, they have code samples for everything that you are trying to do: github.com/react-native-training/react-native-elements
– kivul
Nov 22 '18 at 11:07
Thank you, but as I see they didnt use react-navigation. My question is how to solve this with react-navigation.
– MirjamT
Nov 22 '18 at 21:21
Thank you, but as I see they didnt use react-navigation. My question is how to solve this with react-navigation.
– MirjamT
Nov 22 '18 at 21:21
they are using react-navigation on the project, im pretty sure you didnt read correctly what i said: 'they have code samples for everything that you are trying to do'
– kivul
Nov 22 '18 at 21:43
they are using react-navigation on the project, im pretty sure you didnt read correctly what i said: 'they have code samples for everything that you are trying to do'
– kivul
Nov 22 '18 at 21:43
I read your message but unfortunantely they didnt use react-navigation. I searched through the whole project. I would like to do it with react-navigation.
– MirjamT
Dec 1 '18 at 12:24
I read your message but unfortunantely they didnt use react-navigation. I searched through the whole project. I would like to do it with react-navigation.
– MirjamT
Dec 1 '18 at 12:24
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53429397%2freact-native-navigation-bottomtabnavigater-and-header%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53429397%2freact-native-navigation-bottomtabnavigater-and-header%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
take a look at this project, they have code samples for everything that you are trying to do: github.com/react-native-training/react-native-elements
– kivul
Nov 22 '18 at 11:07
Thank you, but as I see they didnt use react-navigation. My question is how to solve this with react-navigation.
– MirjamT
Nov 22 '18 at 21:21
they are using react-navigation on the project, im pretty sure you didnt read correctly what i said: 'they have code samples for everything that you are trying to do'
– kivul
Nov 22 '18 at 21:43
I read your message but unfortunantely they didnt use react-navigation. I searched through the whole project. I would like to do it with react-navigation.
– MirjamT
Dec 1 '18 at 12:24