Closed zakster12 closed 7 years ago
This is not a issue. I just can't figure it out how exactly I can have TabNavigation or DrawerNavigation inside StackNavigation (something like that):
So from the documentation if I have this:
import React from 'react'; import { AppRegistry, Text, View, } from 'react-native'; import { createRouter, NavigationProvider, StackNavigation, } from '@exponent/ex-navigation'; const Router = createRouter(() => ({ home: () => HomeScreen, })); class App extends React.Component { render() { return ( <NavigationProvider router={Router}> <StackNavigation initialRoute={Router.getRoute('home')} /> </NavigationProvider> ); } } class HomeScreen extends React.Component { static route = { navigationBar: { title: 'Home', } } render() { return ( <View style={{alignItems: 'center', justifyContent: 'center', flex: 1}}> <Text>HomeScreen!</Text> </View> ) } } AppRegistry.registerComponent('main', () => App);
where I shoud append this part from the documentation:
import { StackNavigation, DrawerNavigation, DrawerNavigationItem, } from '@exponent/ex-navigation'; // Treat the DrawerNavigationLayout route like any other route -- you may want to set // it as the intiial route for a top-level StackNavigation class DrawerNavigationLayout extends React.Component { static route = { navigationBar: { visible: false, } }; render() { return ( <DrawerNavigation id='main' initialItem='home' drawerWidth={300} renderHeader={this._renderHeader} > <DrawerNavigationItem id='home' selectedStyle={styles.selectedItemStyle} renderTitle={isSelected => this._renderTitle('Home', isSelected)} > <StackNavigation id='home' initialRoute={Router.getRoute('home')} /> </DrawerNavigationItem> <DrawerNavigationItem id='about' selectedStyle={styles.selectedItemStyle} renderTitle={isSelected => this._renderTitle('About', isSelected)} > <StackNavigation id='about' initialRoute={Router.getRoute('about')} /> </DrawerNavigationItem> </DrawerNavigation> ); } _renderHeader = () => { return ( <View style={styles.header}> </View> ); }; _renderTitle(text: string, isSelected: boolean) { return ( <Text style={[styles.titleText, isSelected ? styles.selectedTitleText : {}]}> {text} </Text> ); }; } const styles = StyleSheet.create({ header: { height: 20 }, selectedItemStyle: { backgroundColor: 'blue' }, titleText: { fontWeight: 'bold' }, selectedTitleText: { color: 'white' } });
I would appreciate any help. Thank you, guys!
try to ask this on stackoverflow
@sibelius https://github.com/sibelius/ex-navigation-drawer-tabs this from you is exactly what I was looking for. Thank you!
auhaua, can we close this?
Yes, we can.
This is not a issue. I just can't figure it out how exactly I can have TabNavigation or DrawerNavigation inside StackNavigation (something like that):
So from the documentation if I have this:
where I shoud append this part from the documentation:
I would appreciate any help. Thank you, guys!