2017-10-16 53 views
0

我在js文件中託管兩個選項卡組件。如果一個僅渲染選項卡路由器它的工作完美。如果我嘗試在View組件內渲染它的非渲染選項卡。選項卡組件不呈現 - 反應原生

我的RegisterHost.js渲染方法。

render() { 
return (
    <View> 
    <Text>This is main home Component</Text> 
    <Tab /> 
    </View> 
); 

}

其渲染只有 '這是主要的家庭成分'

如果我評論瀏覽和文本組件。它的渲染標籤完美。

render() { 
    return (
     // <View> 
     // <Text>This is main home Component</Text> 
     <Tab /> 
     //</View> 
    ); 
    } 

我的標籤路由器配置

export const Tab = TabNavigator(
    { 
    BankCustomerRegister: { 
     screen: BankCustomerRegister, 
     navigationOptions: { 
     tabBarLabel: "Bank Customer" 
     } 
    }, 
    nonbankcustomer: { 
     screen: NonCustomerRegister, 
     navigationOptions: { 
     tabBarLabel: "New Customer" 
     } 
    } 
    }, 

我不知道它在那裏去錯了。 有什麼遺漏。

回答

0

嘗試添加style={{flex: 1}}到RegisterHost.js

+0

您能否提供一些鏈接父視圖,我可以學習完成反應母語 –

+0

這裏有3個環節,幫助我,當我開始使用本機作出反應相關的柔性使用: https://facebook.github.io/react-native/docs/flexbox.html - https://medium.com/the-react-native-log/understanding-react-native-flexbox-layout -7a528200afd4 - https://code.tutsplus.com/tutorials/get-started-with-layouts-in-react-native--cms-27418 - 希望這會有所幫助;) –