React-native-image-crop-picker: Cannot read property 'openPicker' of undefined

Created on 14 Jul 2018  路  8Comments  路  Source: ivpusic/react-native-image-crop-picker

Version

Tell us which versions you are using:

  • react-native-image-crop-picker v0.20.3
  • react-native v0.55.2

Platform

Tell us to which platform this issue is related

  • Android

Hi,
I integrate react native with my app with https://facebook.github.io/react-native/docs/integration-with-existing-apps.html
and now want to add your component but i got this error
please help me

Most helpful comment

Working library after adding node_modules/react-native-image-crop-picker/ios/imageCropPicker.xcodeproj in my project and also adding libimageCropPicker.a to Linked Frameworks and Libraries. Better if it will update in readmMe file.

All 8 comments

it has bin solved (now picker open) by adding
.addPackage(new PickerPackage())
to
mReactInstanceManager = ReactInstanceManager.builder()
.setApplication(getApplication())
.setBundleAssetName("index.android.bundle")
.setJSMainModulePath("index")
.addPackage(new MainReactPackage())
.addPackage(new PickerPackage())
.setUseDeveloperSupport(BuildConfig.DEBUG)
.setInitialLifecycleState(LifecycleState.RESUMED)
.build();

but now image callback don`t return any thing

tanks to @zsaCHG
his answer solved my problem
I resolve this problem by

mReactInstanceManager = ReactInstanceManager.builder() .setApplication(getApplication()) .setBundleAssetName("index.android.bundle") .setJSMainModulePath("index") .addPackage(new MainReactPackage()) .setUseDeveloperSupport(BuildConfig.DEBUG) .setInitialLifecycleState(LifecycleState.RESUMED) .build();

@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (mReactInstanceManager != null) { mReactInstanceManager.onActivityResult(this,requestCode,resultCode,data); } }

"it has bin solved (now picker open) by adding"

Where do you add that? What file is this?

FYI, there is an open issue that is a duplicate of this one: https://github.com/ivpusic/react-native-image-crop-picker/issues/705

I have a ReactActivity.java file in my app that in it. this is the avtivity that call my react part of app

 private ReactRootView mReactRootView;
    private ReactInstanceManager mReactInstanceManager;

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

        mReactRootView = new ReactRootView(this);
        mReactInstanceManager = ReactInstanceManager.builder()
                .setApplication(getApplication())
                .setBundleAssetName("index.android.bundle")
                .setJSMainModulePath("index")
                .addPackage(new MainReactPackage())
                .addPackage(new PickerPackage())
                .addPackage(new RNFetchBlobPackage())
                .addPackage(new FastImageViewPackage())
                .addPackage(new ActivityStarterReactPackage())
                .setUseDeveloperSupport(BuildConfig.DEBUG)
                .setInitialLifecycleState(LifecycleState.RESUMED)
                .build();
        Bundle initialProps = new Bundle();
        Intent i = getIntent();
        initialProps.putLong("profileId", i.getLongExtra("profileId", 0));
        initialProps.putString("accountId", i.getStringExtra("accountId"));
        initialProps.putString("accessToken", i.getStringExtra("accessToken"));
        mReactRootView.startReactApplication(mReactInstanceManager, "TestApp", initialProps);

        setContentView(mReactRootView);
    }

Same issue is getting in iOS ?

Working library after adding node_modules/react-native-image-crop-picker/ios/imageCropPicker.xcodeproj in my project and also adding libimageCropPicker.a to Linked Frameworks and Libraries. Better if it will update in readmMe file.

also encountered this error and had basically given up hope on using this library, but since there aren't any other great alternatives I persisted. I don't use cocoapods, but I installed according to the readme and was getting the "Cannot read property" error when calling the openPicker function. Turns out that calling "rm -rf node_modules/" and then "npm install" was the solution. Hope this helps someone.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pavsidhu picture pavsidhu  路  3Comments

victorwpbastos picture victorwpbastos  路  3Comments

aterribili picture aterribili  路  3Comments

Phenek picture Phenek  路  3Comments

xuchao321 picture xuchao321  路  3Comments