Skip to content

Callback navigation sometimes doesnt work #79

@cmason9

Description

@cmason9

Hi I have implemented this library and it works great for my app for the most part. I have implemented a registration flow were the user goes through certain steps and moves to the next page. I have noticed that for when creating an account first time everything works as it should. But if i log out or kill the app and try to create a second account on a callback function i hit the self.navigation.push okay but the screen does not move the user forward. Here is the code below:

                        Button(action: {
                            viewModel.isLoading = true
                            viewModel.signUp(firstName: viewModel.firstName, lastName: viewModel.lastName, onCompletion: { result in
                                switch result {
                                case true:
                                    print("Go to verify page")
                                    if viewModel.showVerifyEmail {
                                        DispatchQueue.main.async {
                                            self.navigationStack.push(VerifyEmailView(authHandler: authHandler, apiHandler: apiHandler, verifying: true, emailAddress: viewModel.email.lowercased(), firstName: viewModel.firstName, lastName: viewModel.lastName, userExists: viewModel.userExists))
                                        }
                                    }
                                case false:
                                    if viewModel.goBack {
                                        DispatchQueue.main.async {
                                            self.navigationStack.pop()
                                        }
                                    }
                                }
                            })
                        }) {
                            PrimaryButtonMed(btnTitle: "create_account", isLoading: $viewModel.isLoading)
                        }
                        .opacity(viewModel.enableButton(firstName: viewModel.firstName, lastName: viewModel.lastName) ? 1 : 0.6)
                        .disabled(!viewModel.enableButton(firstName: viewModel.firstName, lastName: viewModel.lastName))
                    }
                    .padding(.trailing, 10)

Any help of suggestions is greatly appreciated.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions