Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all articles
Browse latest Browse all 30346

ReactApplicationContext cannot be converted to AppCompatActivity

$
0
0

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


Viewing all articles
Browse latest Browse all 30346

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>