Gustash / react-native-giphy-keyboard

React Native implementation of the Giphy SDK for iOS and Android
12 stars 9 forks source link

Android not working if using react-native-navigation #12

Closed gimwee closed 3 years ago

gimwee commented 3 years ago

Having issues with android where giphy keyboard won't fire up, after some debugging, found out that problem lies in GiphyModule.kt line 70.

val activity = reactContext.currentActivity as? ReactActivity ?: return

If app is using react-native-navigation library, MainActivity class is extends to NavigationActivity instead of ReactActivity, and since NavigationActivity extends AppCompatActivity, so we have to cast reactContext.currentActivity as? AppCompatActivity

import androidx.appcompat.app.AppCompatActivity; val activity = reactContext.currentActivity as? AppCompatActivity ?: return

Not sure whether this is the correct solutions, as I am not very good in Native Android/Kotlin, if anyone can take a look at this and update code would be great

filipef101 commented 3 years ago

Not using the package anymore, I would say give it a go and see if you can manage a solution, and open a PR

Gustash commented 3 years ago

This package has now been deprecated in favor of the official @giphy/react-native-sdk library.