I am trying to create a Native module for an Android SDK. When I try to pass reactContext to it I get the following ReactApplicationContext cannot be converted to AppCompatActivity. This is the block with error
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);
}
I also tried passing getCurrentActivity() instead of reactContext but it gives error: incompatible types: Activity cannot be converted to AppCompatActivity error. How can I pass AppCompatActivity in ReactNative. Also tried changing ReactNative MainActivity from ReactActivity to ReactFragment but there is no change. My React native version is 0.61.5 and Android API level is 28