callstack/react-native-image-editor

Requested column: 0, # of columns: 0

Anujmoglix opened this issue ยท 3 comments

Getting this with 'react-native-image-picker';

Same error

I've workaround the issue by using path instead of uri given from react-native-image-picker as follow:

   ImagePicker.showImagePicker(options, (response) => {
      if (response.error) {
        Alert.alert(response.error)
      } else {
        ... 
        const fileUri = Platform.OS === 'android' ? `file://${response.path}` : response.uri
        const thumbnailUri = await ImageEditor.cropImage(
          fileUri,
          cropData,
        )
        ...
      }
    })

This library is compatible with the latest react-native-image-picker version

an example of usage

import {launchImageLibrary} from 'react-native-image-picker';
import ImageEditor from '@react-native-community/image-editor';

async function cropImage(){
  const response = await launchImageLibrary({ mediaType: 'photo', includeExtra: true });
  const uri = response.assets?.[0]?.uri;
  if(uri){
    const cropResult = await ImageEditor.cropImage(uri, {...});
    console.log(cropResult);
  }
}