2017-08-28 82 views
1

我想,以顯示我的app.For TabNavigator的一個,我用this,但現在我不得不調整自己的代碼,它不工作了。 這裏是我的代碼:陣營本土製表導航不顯示

主類:

import React, {Component} from 'react'; 
import {View,Text, WebView,StyleSheet} from 'react-native'; 
import { TabNavigator } from "react-navigation"; 
const Navigation = TabNavigator({ 
    Prod: { screen: Prod }, 
    ContinuousDeployment: { screen: ContinuousDeployment }, 
}); 
export default class Mattermost extends Component{ 
    constructor(props){ 
     super(props); 

     this.state = ({ 
      MMAUTHTOKEN : null, 
      BASICAUTH : null, 
     }); 
    } 
    render(){ 
     if(this.state.MMAUTHTOKEN === undefined || this.state.MMAUTHTOKEN === null){ 
      return(
       /*Another page , not the tab*/ 
      ); 
     } 
     else if(this.state.BASICAUTH === undefined || this.state.BASICAUTH === null){ 
       return(
        /*Another page , not the tab*/ 
       ); 
     } 
     else{ 
      return <View>{Navigation}</View>; 
     } 
    } 

這裏是類我的網頁之一:

import React,{Component} from 'react'; 
import {View,Text,StyleSheet} from 'react-native'; 


export default class Prod extends Component{ 
    constructor(props){ 
     super(props); 
    } 

    static navigationOptions = { 
     tabBarLabel: 'Prod', 
     tabBarIcon: ({ tintColor }) => (
      <Image source={require('../Images/Icones/jenkins.png')} style={[styles.icon, {tintColor: tintColor}]}/> 
     ), 
    }; 

    put(){ 
    } 
    render(){ 
     return (
      <View> 
       <Text>Prod</Text> 
      </View> 
     ); 
    } 
} 
const styles = StyleSheet.create({ 
    icon: { 
    width: 26, 
    height: 26, 
    }, 
}); 

這是偉大的工作,但現在它顯示白色屏幕,沒有標籤,沒有任何警告或錯誤。如果有人能幫助我,這將是非常酷!在此先感謝,亞歷克斯

回答

2

改變這種

return <View>{Navigation}</View>; 

return <View><Navigation /></View>; 

return <Navigation />; 

應該解決這個問題。

+0

該死的,這很簡單...非常感謝 –