我正在尝试为Android SDK创建本机模块。当我尝试将reactContext传递给它时,我得到以下ReactApplicationContext cannot be converted to AppCompatActivity
。这是有错误的块
try {
manager.sendPaymentRequest(apiKey,
hmac,
txn,paymentCallback,reactContext);
} catch (InvalidPaymentRequestException ipre){
// Do something with the exception
promise.reject("error ipre: "+ipre);
} catch (Exception e){
// Do something with the exception
promise.reject("error e: "+e);
}
我还尝试传递getCurrentActivity()
而不是reactContext
,但是它会产生error: incompatible types: Activity cannot be converted to AppCompatActivity
错误。如何在ReactNative中传递AppCompatActivity。