Skip to content

Instantly share code, notes, and snippets.

@iRoachie
Created June 15, 2017 15:19
Show Gist options
  • Save iRoachie/9a2ab9a918e8a3991118056425d42641 to your computer and use it in GitHub Desktop.
Save iRoachie/9a2ab9a918e8a3991118056425d42641 to your computer and use it in GitHub Desktop.
react native navigation
const wrap = (BaseComponent: any, navigatorStyle: NavigatorStyle = {}, navigatorButtons: {} = {}) =>
class WrappedComponent extends React.Component<any, any> {
static navigatorStyle = navigatorStyle
static navigatorButtons = navigatorButtons
render() {
return (
<ThemeProvider uiTheme={uiTheme}>
<BaseComponent {...this.props}/>
</ThemeProvider>
)
}
}
export const registerScreens = (store: Store<State>, Provider: any) => {
Navigation.registerComponent('wwwp.Dashboard', () => wrap(Dashboard, {}, {
leftButtons: [{id: 'sideMenu'}]
}))
Navigation.registerComponent('wwwp.Drawer', () => wrap(Sidebar), store, Provider)
Navigation.registerComponent('wwwp.Account', () => wrap(Account, {
topBarElevationShadowEnabled: false
}, {
leftButtons: [{id: 'sideMenu'}]
}), store, Provider)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment