Problem with android library REACT-NATIVE

0

I'm using a library to cut photos in my project, but it only works for android, when I squeeze the app on android it runs normally, but when it runs on ios, the error in importing the library has some way of when to run this app in ios it "forget" that library?

library: link

    
asked by anonymous 19.06.2018 / 22:51

1 answer

0

Use the Platform

import {Platform} from 'react-native';

// Importe a biblioteca assim:

const ImageCropperPackage = Platform.select({
  ios: () => null,
  android: () => require('com.ozdevcode.theartofdev.edmodo.cropper.ImageCropperPackage'),
})();

// OU

const ImageCropperPackage = Platform.select({
  ios: () => require('br.com.outrabiblioteca.ImageCropperPackage'),
  android: () => require('com.ozdevcode.theartofdev.edmodo.cropper.ImageCropperPackage'),
})();

With this you only use the component only when the constant ImageCropperPackage is different from null

    
20.06.2018 / 17:49