无法将ReactApplicationContext转换为AppCompatActivity

时间:2019-12-28 08:29:22

标签: android react-native react-native-android

我正在尝试为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。

0 个答案:

没有答案