Expo32 - imageManipulator.manipulateAsync don't return anything


#1

Hi everyone,
I updated my app to expo32,

But imageManipulator.manipulate does not do anything. And unfortunately, ImagePicker’s with compress property doesn’t work, so I’m forced to use imageManipulator.manipulate.

Do you have an idea ?

Thank you.

Kév.


#2

Hey @kevin.vuillemin,

Can you create a Snack (snack.expo.io ) that reproduces this behavior so we can try it out on our end?

Cheers,

Adam


#3

Sorry,

But it’s difficult to test with Snack, because we have to upload image.

But here is my code:

 _pickImage = async () => {
        await this._askPermissionsAsync()
        let pickerResult = await ImagePicker.launchImageLibraryAsync({
            mediaType: 'Images',
            compress: 0.5,
            base64: false
        })
        if (!pickerResult.cancelled) {
            this._compressImage(pickerResult)
        }
    }

    _compressImage = async (pickerResult) => {
        console.log('compress');

        const manipResult = await ImageManipulator.manipulateAsync(
            pickerResult.uri,
            [{ resize: { width: 800} }],
            { compress: 0.5, format: 'jpeg', base64: false }
        );
        console.log('compress after');
      this._handleImagePicked(manipResult)
    }

The console show ‘compress’ but not ‘compress after’, ImageManipulator.manipulate never send response.


#4

Any idea ? =)


#5

Hey i found a solution,

Sdk32 removed method manipulate of exponent ImageManipulator, the class expoModule loads an object named manipulate instead of manipulateAync.

To correct, modify the node_modules/jest-expo/src/expoModules.js file on line 528 and replace

ExponentImageManipulator: {manipulate: {type: 'function', functionType: 'promise'}} 

by

ExponentImageManipulator: {manipulateAsync: {type: 'function', functionType: 'promised'}}

Of course you have to call ImageManipulator.manipulateAsync instead of ImageManipulator.manipulate .

Cheers