Styled navbar with custom buttons which opens the drawer on press.
Styled navbar, but the menu button press return nothing (error or anything).
index.android.js
`export default class relevanti extends Component
{
logoButton = () => (
containerStyle={$style.header_logo}
onPress={() => { Actions.profile.call(); }}
>
);
profileButton = () => (
<Button>
<IonIcon name="md-person" size={25} color="#FFF" />
</Button>
);
sidebarButton = () => (
<Button onPress={() => { Actions.refresh({ key: 'drawer', open: true }); }}>
<MaterialIcon name="menu" size={25} color="#FFF" />
</Button>
);
backButton = () => (
<Button onPress={() => { Actions.main.call(); }}>
<MaterialIcon name={ I18nManager.isRTL ? 'chevron-right' : 'chevron-left' } size={25} color="#FFF" />
</Button>
);
render() {
return (
<Router>
<Scene key="root">
<Scene key="drawer" component={Sidebar} open={true}>
<Scene key="drawer_root"
navigationBarStyle={$style.header}
renderTitle={this.logoButton}
>
<Scene
key="main"
component={MainView}
renderLeftButton={this.sidebarButton}
renderRightButton={this.profileButton}
type="reset"
initial={true}
/>
<Scene
key="profile"
component={ProfileView}
renderLeftButton={this.sidebarButton}
renderBackButton={this.backButton}
/>
</Scene>
</Scene>
</Scene>
</Router>
);
}
}`
sidebar.js (drawer)
`class Sidebar extends Component
{
componentDidMount() {
Actions.refresh({key: 'drawer', ref: this.refs.navigation});
}
render() {
const state = this.props.navigationState;
const children = state.children;
return (
<Drawer
ref="navigation"
type="overlay"
content={<SidebarInit />}
tapToClose={true}
openDrawerOffset={0.2}
styles={drawerStyles}
tweenHandler={(ratio) => ({
main: { opacity:Math.max(0.54, 1-ratio) }
})}
>
<DefaultRenderer navigationState={children[0]} onNavigate={this.props.onNavigate} />
</Drawer>
);
}
}`
i have the same problem
Well, finally found my stupid fault.
The import of my Sidebar was under curly brackets, after changing this - worked perfect.
Although, I'm thinking that the documentation of the combined drawer and flux is a little bit bad, so I'll try as soon as I can to make a small tutorial.
Most helpful comment
Well, finally found my stupid fault.
The import of my Sidebar was under curly brackets, after changing this - worked perfect.
Although, I'm thinking that the documentation of the combined drawer and flux is a little bit bad, so I'll try as soon as I can to make a small tutorial.