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

FUIAuthDelegate is not called if the view is activated in a .sheet #1225

Open
acgacgacgacg opened this issue Jan 2, 2025 · 0 comments
Open

Comments

@acgacgacgacg
Copy link

acgacgacgacg commented Jan 2, 2025

Similar to #1198
I use the FirebaseAuthUI in SwiftUI. I wrapped it in a UIViewControllerRepresentable and implemented the makeCoordinator method to set the delegate like the following

struct AuthView: View {
  var body: some View {
    AuthViewControllerRepresentable()
  }
}

struct AuthViewControllerRepresentable: UIViewControllerRepresentable {
  ...
  func makeCoordinator() -> Coordinator {
    Coordinator()
  }

  func makeUIViewController(context: Context) -> UINavigationController {
    let authUI = FUIAuth.defaultAuthUI()!
    authUI.delegate = context.coordinator
    ...
  }

  class Coordinator: NSObject, FUIAuthDelegate {
    func authUI(
      _ authUI: FUIAuth, didSignInWith authDataResult: AuthDataResult?, error: Error?
    ) {
      print("authUI called")
      }
  }
}

The FUIAuthDelegate is not called if it is activated inside a .sheet like the following

.sheet(isPresented: $showAuthViewSheet) {
      AuthView()
    }

However, the FUIAuthDelegate method will get called if it is a stand alone page.

I'm using v14.2.6

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

1 participant