2017-08-28 22 views
1

私はthisを使用していましたが、今ではコードを再構成しなければならなくなったため、私のアプリにTabNavigatorを表示したいと考えています。 ここに私のコードです:ここReact-native Tab-navigatorが表示されない

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, 
    }, 
}); 

それは偉大前に働いていたが、今では表示白い画面、タブなし、および警告またはエラーなし。誰かが私を助けることができれば、それはとても涼しいでしょう!事前のおかげで、アレックス

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

または

return <Navigation />; 

答えて

2

変更この

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

は、この問題を修正する必要があります。

+0

非常に簡単でした...ありがとう –

関連する問題