corymsmith / react-native-fabric

A React Native library for Fabric, Crashlytics and Answers
MIT License
1.31k stars 236 forks source link

How to use with wix/react-native-navigation v2 #212

Open dungnguyen10989 opened 5 years ago

dungnguyen10989 commented 5 years ago

RNN v2 using other structure, and it's MainActivity it not contain onCreate method to init Fabric. `public class MainActivity extends NavigationActivity {

@Override
protected String getJSBundleFile() {
    return CodePush.getJSBundleFile();
}

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    MainApplication.getCallbackManager().onActivityResult(requestCode, resultCode, data);
}

}` How can I resolve this issue ?

bacrilio commented 5 years ago

Try this

// ......
import android.os.Bundle;
import android.support.annotation.Nullable;
import com.crashlytics.android.Crashlytics;
import io.fabric.sdk.android.Fabric;
// ......

public class MainActivity extends NavigationActivity
{
   // ......
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
   // ......
        Fabric.with(this, new Crashlytics());
   // ......
    }
   // ......
}