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

SwiftUI layout is still broken on a presentation sheet. #266

Open
carlosdelamora opened this issue Jan 24, 2021 · 5 comments
Open

SwiftUI layout is still broken on a presentation sheet. #266

carlosdelamora opened this issue Jan 24, 2021 · 5 comments

Comments

@carlosdelamora
Copy link

Integration Details (please complete the following information):

  • SDK/Library Version: 8.1.2
  • Environment: Sandbox
  • iOS Version: 14.3
  • Device iPhone 12
  • Integration type & version CocoaPods

Describe the bug
The presentation of a BTDropInController using the sheet SwiftUI property has a jumpy presentation. This bug is related to #202

To Reproduce
Steps to reproduce the behavior:
This is the code for UIViewControllerRepresentable

struct DropInRepresentable: UIViewControllerRepresentable {
    
    var authorization: String
    var handler: BTDropInControllerHandler
    
    init(authorization: String, handler: @escaping BTDropInControllerHandler) {
           self.authorization = authorization
           self.handler = handler
    }
    
    func makeUIViewController(context: Context) -> BTDropInController {
        let request = BTDropInRequest()
        //request.payPalRequest = payPalRequest
        request.applePayDisabled = true
        let dropInController = BTDropInController(authorization: authorization, request: request, handler: handler)!
        return dropInController
    }
        
    func updateUIViewController(_ uiViewController: BTDropInController, context: UIViewControllerRepresentableContext<DropInRepresentable>) {
    }
}

This is the code to present the view controller

.sheet(isPresented: $isShowingPaymentFlow)  {
            DropInRepresentable(authorization: braintreeToken.token) { controller, result, error in
                print("result \(result)")
            }
        }

Expected behavior
Expected to show the DropInRespresentable view with a correct layout.

Actual behavior
The DropInRespresentable view shows full screen then abruptly shrinks to the correct size.

Screenshots

RPReplay_Final1611510732.MP4
@sestevens
Copy link
Contributor

Hi @carlosdelamora, thanks for reporting this! We'll take a look and post any updates here.

@RamblinWreck77
Copy link

Any update on this?

@sestevens
Copy link
Contributor

@RamblinWreck77 We don't have any updates at the moment. We're currently focused on a couple other things (namely, Swift Package Manager support and accessibility improvements). If this is something you're interested in working on, we'd be happy to review a PR for it.

@JavierMazarioPicazo
Copy link

Is there any guide for Drop-in in Swift UI? I have already done the client side and a simple server but I don't know how to send the nonce to my server and test it

@scannillo
Copy link
Contributor

Hi @JavierMazarioPicazo - no we don't officially offer SwiftUI support yet (nor have a guide) though it is something we are looking into.

If you already have the client-side UI set up and your server set up, then you should send your nonce to your server the same way you would with a UIKit integration. You can see our docs for an example of that here.

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

5 participants