Created
June 15, 2017 15:19
-
-
Save iRoachie/9a2ab9a918e8a3991118056425d42641 to your computer and use it in GitHub Desktop.
react native navigation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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