naoufal/react-native-payments

"TypeError: Right-hand side of 'instanceof' is not callable" when "requestShipping: true"

nmilcoff opened this issue ยท 1 comments

Hi, thanks a lot for maintaining this library, it's really appreciated! ๐Ÿ‘

I'm following all the steps defined in the readme file, but whenever I enable requestShipping in the options, I get the error:

Possible Unhandled Promise Rejection (id: 0):
TypeError: Right-hand side of 'instanceof' is not callable
TypeError: Right-hand side of 'instanceof' is not callable
    at PaymentRequestUpdateEvent.updateWith$ (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:244391:28)
    at tryCatch (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:43205:19)
    at Generator.invoke [as _invoke] (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:43381:24)
    at Generator.prototype.<computed> [as next] (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:43248:23)
    at tryCatch (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:43205:19)
    at invoke (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:43281:22)
    at http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:43311:13
    at tryCallTwo (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:3476:7)
    at doResolve (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:3640:15)
    at new Promise (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:3499:5)

If I'm correct, the error is triggered from this line when PaymentRequest is created.

This happens with and without adding event listeners.

Version: 0.8.3
Platform: iOS (simulator)

The problem was on my end, I'm using typescript and have alias configured in the codebase. The import for PaymentRequest in PaymentRequestUpdateEvent wasn't working because of that.