0

I am trying to use a fix from this GitHub issue, but when using the solution in my code, this is not available. How can I pass this to the function?

´´´java

public class MainActivity extends ReactActivity {

    @Override
    protected String getMainComponentName() {
        return "fleeting";
    }

    private ReactContext mReactContext;
    private PowerManager.WakeLock sCpuWakeLock;
    private Activity activity;
    private static final String TAG = "MainActivity";

    public void onReactContextInitialized(ReactContext context) {
        Log.d(TAG, "Here's your valid ReactContext");
        mReactContext = context;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        getReactInstanceManager().addReactInstanceEventListener(this); // Throws error, can´t find "this"
OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Mr. Robot
  • 1,334
  • 6
  • 27
  • 79

1 Answers1

2

Replace you first line with below code. You were not implemented the ReactInstanceEventListener interface.

public class MainActivity extends ReactActivity  implements ReactInstanceManager.ReactInstanceEventListener{

Then add this method inside your mainActivity.

@Override
public void onReactContextInitialized(ReactContext context) {
    Log.d(TAG, "Here's your valid ReactContext");
}
Noban Hasan
  • 593
  • 1
  • 7
  • 21