react-navigation

React Navigation - How to switch Tab Navigation to handle Login Screen?

瘦欲@ 提交于 2019-12-02 05:15:18
I want to know if it's possible to handle login screen after the button login pressed, I have a router.js: export const TabLoged= TabNavigator({ Home: { screen: HomeStack, }, MyPatient:{ screen: MyPatientStack }, MyAccount: { screen: MyAccount, } }); export const Tab = TabNavigator({ Home: { screen: HomeStack, }, Login: { screen: LoginStack, } }); export const Root = StackNavigator({ Tab: { screen: Tab, } },{headerMode:'none'}) In export const Root I want to change the code looks like : export const Root = StackNavigator({ Tab: { // here i want to set the `alredyLogin` to be boolean, but i

Hide labels in TabNavigator - ReactNavigation

穿精又带淫゛_ 提交于 2019-12-02 03:23:59
问题 How do I hide the labels in TabNavigator and show only icons ? If I do the following: const Tabs = TabNavigator({ Home: { screen:MainHome, navigationOptions: ({ navigation }) => ({ title: "Home", //Tried to hide this for next tab Search. tabBarIcon: ({ tintColor, focused }) => <View><MaterialIcons name="home"/></View> }) }, Search: { screen:TestComp1, navigationOptions: ({ navigation }) => ({ //If no title it shows the name as Search. tabBarIcon: ({ tintColor, focused }) => <View>

Undefined is not a function near _reactNavigation.StackNavigator

[亡魂溺海] 提交于 2019-12-02 02:33:48
I want to setup a React Native app with a side menu and a tab menu at the same time. I was following this tutorial. My code . I get the error: undefined is not a function (near '...(0 , _reactNavigation.TabNavigator)...') Which you can see here: Preview of some of the files: App.js import React from 'react'; import { Drawer } from './src/navigators'; export default class App extends React.Component { render() { return ( <Drawer /> ); } } navigators.js import React, { Component } from 'react'; import { StyleSheet, Text, View } from 'react-native'; // Navigators import { DrawerNavigator,

Dynamic navigation items in Drawer Navigator

女生的网名这么多〃 提交于 2019-12-02 02:23:48
问题 I want to populate DrawerNavigator from response from an api. How can the drawer items be loaded dynamically? Eg 'someName1': { screen: (props) => <someView {...props} viewId='someId2' /> }, 'someName2': { screen: (props) => <someView {...props} viewId='someId2' /> }, 回答1: This is how I solved it- In render method- const Nav = DrawerNavigator(this.getNavItems(this.state.drawerSource.navItems)); const AppNavigator = (StackNavigator( { Drawer: { screen: Nav }, }, { initialRouteName: "Drawer",

Hide labels in TabNavigator - ReactNavigation

不想你离开。 提交于 2019-12-02 00:53:17
How do I hide the labels in TabNavigator and show only icons ? If I do the following: const Tabs = TabNavigator({ Home: { screen:MainHome, navigationOptions: ({ navigation }) => ({ title: "Home", //Tried to hide this for next tab Search. tabBarIcon: ({ tintColor, focused }) => <View><MaterialIcons name="home"/></View> }) }, Search: { screen:TestComp1, navigationOptions: ({ navigation }) => ({ //If no title it shows the name as Search. tabBarIcon: ({ tintColor, focused }) => <View><MaterialIcons name="accessibility"/></View> }) } }, { tabBarPosition: 'bottom', tabBarOptions: { showIcon: true,

React Navigation Preventing Going back to loading screen, reset not working

[亡魂溺海] 提交于 2019-12-02 00:52:53
I have a React Native application which I have implemented. Currently the app opens up on a loading screen which after mounting checks the firebase.auth().onAuthStateChanged(...) feature. The app basically decides whether or not to got to the login screen or to main screen depending on whether or not the user is already authenticated. It is implemented like this: Main Navigator: const MainNavigator = TabNavigator({ auth: { screen: TabNavigator({ login: { screen: LoginScreen }, signup: { screen: SignupScreen } }, { initialRouteName: 'login', tabBarPosition: 'top', lazy: true, animationEnabled:

React Navigation - How to pass data across different screens in TabNavigator?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-02 00:47:09
I have a TabNavigator, and in each tab is a StackNavigator. Inside the StackNavigator, I have screens. The screens in each Tab do not call each other directly; the TabNavigator handles the screen changes when a tab is pressed. In the first tab, if the user clicks a button, some data is created. If the user then navigates to the second Tab, I would like to pass this data to the screen in the second Tab. Here is a demo of the code: import React from 'react'; import { Button, Text, View } from 'react-native'; import { createBottomTabNavigator, createStackNavigator, } from 'react-navigation';

Navigate to root screen from nested stack navigator

情到浓时终转凉″ 提交于 2019-12-02 00:25:08
i am new to react and trying to learn it by myself , i am facing problem in navigating user back to root screen from nested stck navigator screen . Here is some of my classes :- index.android.js :- import React, { Component } from 'react'; import { AppRegistry, StyleSheet, Text, StatusBar, View } from 'react-native'; import {LoginStack} from './login/loginregisterrouter'; import {StackNavigator } from 'react-navigation'; class reactNavigationSample extends Component { render(){ return ( <LoginStack/> ); } } AppRegistry.registerComponent('MssReactDemo', () => reactNavigationSample);

Dynamic navigation items in Drawer Navigator

一世执手 提交于 2019-12-02 00:09:37
I want to populate DrawerNavigator from response from an api. How can the drawer items be loaded dynamically? Eg 'someName1': { screen: (props) => <someView {...props} viewId='someId2' /> }, 'someName2': { screen: (props) => <someView {...props} viewId='someId2' /> }, This is how I solved it- In render method- const Nav = DrawerNavigator(this.getNavItems(this.state.drawerSource.navItems)); const AppNavigator = (StackNavigator( { Drawer: { screen: Nav }, }, { initialRouteName: "Drawer", headerMode: "none", }) ); return (<AppNavigator />); getNavItems(navItems) { return navItems.reduce((routes,

Undefined is not a function near _reactNavigation.StackNavigator

北城以北 提交于 2019-12-01 22:54:14
问题 I want to setup a React Native app with a side menu and a tab menu at the same time. I was following this tutorial. My code. I get the error: undefined is not a function (near '...(0 , _reactNavigation.TabNavigator)...') Which you can see here: Preview of some of the files: App.js import React from 'react'; import { Drawer } from './src/navigators'; export default class App extends React.Component { render() { return ( <Drawer /> ); } } navigators.js import React, { Component } from 'react';