从标题反应导航中删除返回按钮

时间:2018-06-20 19:46:55

标签: react-native react-navigation

我正在使用createStackNavigator设置导航,第一个顶部导航栏没有返回按钮,并且将其用作登录屏幕。登录后,我会转到应用程序的主页,如何还排除此返回按钮?而不让用户返回?

enter image description here

我是否需要使用重置功能?我仅在浏览器中添加登录页面和主页,当我输入主页时,是否在浏览器中添加其他页面?

App.js

import React, { Component } from 'react';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware } from 'redux';
import ReduxThunk from 'redux-thunk';
import reducers from './src/reducers';
import firebase from 'firebase';
import { createStackNavigator, createMaterialTopTabNavigator } from 'react-navigation';


// Rotas
import FormLogin from "./src/components/FormLogin";
import FormCadastro from "./src/components/FormCadastro";
import FormBoasVindas from "./src/components/BoasVindas";
import FormPrincipal from "./src/components/Principal";
import FormAdicionarContato from "./src/components/AdicionarContato";
import Conversa from "./src/components/Conversa";
// Tab
import ConversasScreen from './src/components/Conversas';
import ContatosScreen from './src/components/Contatos';

const Tab = createMaterialTopTabNavigator(
{
  Conversas: ConversasScreen,
  Contatos: ContatosScreen,
},
{
  tabBarPosition: 'top',
  tabBarOptions: {
    activeTintColor: 'white',
    inactiveTintColor: 'black',
    labelStyle: {
      fontSize: 14,
    },
    style: {
      backgroundColor: '#115E54',
    },
    indicatorStyle: {
      backgroundColor: 'white',
    },
  }
});

const AppNavigator = createStackNavigator({

  FormLoginScreen: { screen: FormLogin },
  FormCadastroScreen: { screen: FormCadastro },
  FormBoasVindasScreen: { screen: FormBoasVindas },

  FormPrincipalScreen: {
    screen: Tab, navigationOptions: () => ({
      title:'WhatsApp',
      headerStyle: {
        backgroundColor: '#115E54',
      },
      headerTintColor: '#fff',
      headerTitleStyle: {
        fontWeight: 'bold',
      },
    }),
  },

  AdicionarContatoScreen: {
    screen: FormAdicionarContato, navigationOptions: () => ({
      title: "Adicionar Contato",
    }),
  },

  ConversaScreen: { screen: Conversa },

});

type Props = {};
export default class App extends Component<Props> {

  render() {
    return (

        <AppNavigator />

    );
  }
}

0 个答案:

没有答案