From 98ac456be641e395460079468a8ab9e8a33c1f7d Mon Sep 17 00:00:00 2001 From: Justin Mazzocchi <2831158+jzzocc@users.noreply.github.com> Date: Tue, 5 Jan 2021 13:34:14 -0800 Subject: [PATCH] Use normal NavigationLink --- Views/AddIdentityView.swift | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/Views/AddIdentityView.swift b/Views/AddIdentityView.swift index 00a1042..d1194b7 100644 --- a/Views/AddIdentityView.swift +++ b/Views/AddIdentityView.swift @@ -9,8 +9,6 @@ struct AddIdentityView: View { @Environment(\.accessibilityReduceMotion) var accessibilityReduceMotion @EnvironmentObject var rootViewModel: RootViewModel - @State private var navigateToRegister = false - var body: some View { Form { Section { @@ -45,28 +43,21 @@ struct AddIdentityView: View { } else { Button("add-identity.log-in", action: viewModel.logInTapped) - if let instance = viewModel.instance, let url = viewModel.url, - instance.registrations { - ZStack { - NavigationLink( - destination: RegistrationView( - viewModel: viewModel.registrationViewModel( - instance: instance, - url: url)), - isActive: $navigateToRegister) { - EmptyView() - } - .hidden() - Button(instance.approvalRequired - ? "add-identity.request-invite" - : "add-identity.join") { - navigateToRegister.toggle() - } - } - } if viewModel.isPublicTimelineAvailable { Button("add-identity.browse", action: viewModel.browseTapped) } + if let instance = viewModel.instance, + let url = viewModel.url, + instance.registrations { + NavigationLink( + instance.approvalRequired + ? "add-identity.request-invite" + : "add-identity.join", + destination: RegistrationView( + viewModel: viewModel.registrationViewModel( + instance: instance, + url: url))) + } } } .frame(maxWidth: .infinity, alignment: .center)