2016-07-22 123 views
-1

我在實現抽屜反應天然抽屜在陣營天然

<Drawer 
    ref={(ref) => this._drawer = ref} 
    type="overlay" 
    tapToClose={true} 
    content={ <Navigator 

     initialRoute={{name: 'controlpanel'}} 
     renderScene={this.renderScene.bind(this)} 
     />} 

    acceptDoubleTap 
    styles={{main: {shadowColor: '#000000', shadowOpacity: 0.3, shadowRadius: 15}}} 
    onOpen={() => { 
     console.log('onopen') 
     this.setState({drawerOpen: true}) 
    }} 
    onClose={() => { 
     console.log('onclose') 
     this.setState({drawerOpen: false}) 
    }} 
    tweenDuration={100} 
    panThreshold={0.08} 
    disabled={this.state.drawerDisabled} 
    openDrawerOffset={0.2} 
    panOpenMask={0.2} 
    negotiatePan 
    > 

    <Navigator 

     initialRoute={{name: 'main'}} 
     renderScene={this.renderScene.bind(this)} 
     /> 

在側抽屜(控制面板部件),我創建5按鈕。當我點擊一個按鈕,就這樣表示:

enter image description here

點擊我的帳戶後,它看起來像這樣:

enter image description here

我希望它是全尺寸的。

+0

你能分享你的代碼嗎? –

+0

我認爲你不應該使用導航器來渲染控制面板。 – Abhishek

回答

1

content屬性應該接收要在抽屜內顯示的組件,並且抽屜的子標籤應該接收應用程序的主要內容。

我想象一下,當用戶點擊鏈接時,它應該關閉抽屜並在主頁上顯示內容,對嗎?

我的建議是:

1)只與鏈接(該'controlpanel'點到組件的組件替換您content屬性)

content={ <Navigator 
    initialRoute={{name: 'controlpanel'}} 
    renderScene={this.renderScene.bind(this)} 
    />} 

更換的東西,如:

content={<ControlPanel />} 

2)點擊按鈕後,您應該將想要顯示的路線推送到導航器對象,以便它出現在對象上直接位置。

navigator.push({ name: 'main' });