我想从void发送回叫响应
RCT_EXPORT_METHOD(checkOut:(RCTResponseSenderBlock) callback){
}
- (void)paymentViewController:(PaymentViewController *)viewController paymentSuccess:(TransactionResult *)result {
NSLog(@"success: %@", result);
}
- (void)paymentViewController:(PaymentViewController *)viewController paymentFailed:(NSError *)error {
[self showAlertError:error];
}
- (void)paymentViewController:(PaymentViewController *)viewController paymentPending:(TransactionResult *)result {
NSLog(@"pending: %@", result);
}
- (void)paymentViewController_paymentCanceled:(PaymentViewController *)viewController {
NSLog(@"canceled");
}
当我运行react-native run-ios时 NSLog不再显示为日志。
关于本机代码
const callback = (result) => {
console.log(result)
};
Payment.checkOut(callback);
但是我需要回调响应, 所以我可以通过条件 喜欢
if(result === "canceled")