braintree-ios-drop-in
braintree-ios-drop-in copied to clipboard
SwiftUI layout is still broken on a presentation sheet.
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
https://user-images.githubusercontent.com/16446741/105643099-8b761400-5e53-11eb-8291-4b70b601ff5d.MP4
Hi @carlosdelamora, thanks for reporting this! We'll take a look and post any updates here.
Any update on this?
@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.
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
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.