joltup / rn-fetch-blob

A project committed to making file access and data transfer easier, efficient for React Native developers.
MIT License
2.81k stars 772 forks source link

null is not an object (evaluating 'f.DocumentDir') #629

Open zl123top opened 3 years ago

zl123top commented 3 years ago

Description

E/ReactNativeJS: TypeError: null is not an object (evaluating 'f.DocumentDir')
E/ReactNativeJS: Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)

React Native version:

"rn-fetch-blob": "0.10.15", "react": "16.8.3", "react-native": "0.59.0", "react-native-pdf": "5.0.9",

private ReactInstanceManagerBuilder getBuilder(){
        return ReactInstanceManager.builder()
                .setApplication(getApplication())
                .setCurrentActivity(this)
//                .setBundleAssetName("index.android.jsbundle")
//                .setUseDeveloperSupport(false)
                .setBundleAssetName("index.android.bundle")
                .setUseDeveloperSupport(true)
                .setJSMainModulePath("index");

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mReactRootView = new ReactRootView(this);
        mReactInstanceManager = getBuilder()
                .addPackage(new MainReactPackage())
//                .addPackages(((MainApplication)getApplication()).getReactNativeHost().getReactInstanceManager().getPackages())
                .setInitialLifecycleState(LifecycleState.RESUMED)
                .build();
        Bundle bundle = getIntent().getExtras();
        extraModule = bundle.getString("module", "");
        extraBundle = bundle.getBundle("data");

        startReactApplication();
    }

I am getting this issue after click widget in the phone. I think it's because of packaged didn't link when I open like this. here is addPackage function but I think it's not working properly. I tried .addPackages(((MainApplication)getApplication()).getReactNativeHost().getReactInstanceManager().getPackages()) like this but it's not working neighter.

Please help me with this problem asap. Thank you in advance.

ranudhurandar commented 3 years ago

Have you got the solution for the same?