Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map*ToRoute methods should call props method to map something to the current route #6

Open
maluramichael opened this issue Aug 28, 2016 · 0 comments

Comments

@maluramichael
Copy link
Member

e.g. The mapLeftButtonToRoute could call a prop mapLeftButtonToRoute. This way it is possible to handle the left button inside the app component.

mapLeftButtonToRoute(route, navigator, index, navState) {
    // check route static methods for a left button
    var navigatorItem = this.callRouteFunction('navigationBarLeftButton', route, navigator, index, navState);
    if (navigatorItem) {
        return navigatorItem;
    }

    // check props for a left button
    if (this.props.mapLeftButtonToRoute) {
        navigatorItem = mapLeftButtonToRoute(route, navigator, index, navState);
        if (navigatorItem) {
            return navigatorItem;
        }
    }

    // default to a simple back button
    if (index > 0) {
        return <BackButton onPress={this.onPressBackButton}/>;
    }

    // just in case nothing handles the left button we return a empty view
    return <View/>;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant