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

Creating an Authenticated Scene #2246

Closed
wwwemree opened this issue Aug 16, 2017 · 2 comments
Closed

Creating an Authenticated Scene #2246

wwwemree opened this issue Aug 16, 2017 · 2 comments

Comments

@wwwemree
Copy link

wwwemree commented Aug 16, 2017

Hi, I want to create an Authenticated Scene. For example if users logged in, they will see the screen otherwise they won't. I wrote a code like this:

`
export default class AuthenticatedScene extends Scene {

static defaultProps = {
    onEnter: (props) => {
        if (!AppStore.getState().login.isOtpVerified) {
            return null;
        }
        return "success";
    },
    success: (data) => {
    },

    failure: (data) => {
        Actions.pop();
    }
};

constructor(props) {
    super(props)
}

So, the problem is that if users not logged in, I am closing the current screen with .pop() and going back after users opened the screen, but my purpose was that if users not logged in, just don't open the screen instead of opening and closing again. So, how can I achieve this?

Thanks

@aksonov
Copy link
Owner

aksonov commented Aug 18, 2017

It is not correct usage. success, failure should be name of scenes to navigate. And they should be defined within Scene definition.

@aksonov
Copy link
Owner

aksonov commented Aug 21, 2017

Closed due inactivity

@aksonov aksonov closed this as completed Aug 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants