Adyen / Adyen/adyen-react-native

Make `hide(true|false)` async to resolve Apple Pay dismiss

Open
#577 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement v3
Dominant language
TypeScript
Stars
71
Forks
45
Avg merge
2d 5h
Merged PRs (30d)
1

Description

Describe the bug
I have done a transaction via Apple Pay on a real device. After a successful transaction, when I go for the next transaction again and try to open Apple Pay again, it does not open.
start('applepay')

To Reproduce
Steps to reproduce the behavior:

  1. Go for transaction via apple pay
  2. even it's fail or successful. then again for for another transaction
  3. apple pay is not opening

Expected behavior
it should open the apple pay even for second payment

Screenshots

Smartphone (please complete the following information):

  • Device: iphone
  • Adyen sdk version: 2.4.0

Additional context
Error on xcode:
[Presentation] Attempt to present <PKPaymentAuthorizationViewController: 0x107d23f00> on <RNSScreen: 0x106e9edf0> (from <RNSScreen: 0x106e9edf0>) whose view is not in the window hierarchy.

i'm suspecting an issue on this block.

 internal func present(_ component: PresentableComponent) {
        guard let presenter = BaseModule.currentPresenter ?? UIViewController.topPresenter else { return sendEvent(error: NativeModuleError.notKeyWindow) }
        defer {
            BaseModule.currentPresenter = presenter
        }
 
        guard component.requiresModalPresentation else {
            presenter.present(component.viewController, animated: true)
            return
        }
 
        let navigation = UINavigationController(rootViewController: component.viewController)
        component.viewController.navigationItem.rightBarButtonItem = .init(barButtonSystemItem: .cancel,
                                                                           target: self,
                                                                           action: #selector(cancelDidPress))
        presenter.present(navigation, animated: true)
    }

it's going to else condition in
guard component.requiresModalPresentation else {
presenter.present(component.viewController, animated: true)
return
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the native present(_ component: PresentableComponent) method shown in the issue and trace the hide flow after an Apple Pay transaction. Reproduce the first and second start('applepay') calls on an iPhone, then verify that dismissing the first payment completes before the next payment is presented successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, react-native, swift
Domain
mobile, payments
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.