Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. var ImagePicker = NativeModules.ImageCropPicker;
  2.  
  3.  
  4. pickSingleWithCamera(cropIt) {
  5. ImagePicker.openCamera({
  6. cropping: cropIt,
  7. width: 500,
  8. height: 500,
  9. includeExif: true
  10. })
  11. .then(image => {
  12. console.log("received image", image);
  13. this.setState({
  14. image: { uri: image.path, width: image.width, height: image.height }
  15. });
  16. })
  17. .catch(e => alert(e));
  18. }
  19.  
  20. pickSingle(cropIt) {
  21. ImagePicker.openPicker({
  22. width: 300,
  23. height: 300,
  24. cropping: cropIt,
  25. compressImageMaxWidth: 640,
  26. compressImageMaxHeight: 480,
  27. compressImageQuality: 0.5,
  28. compressVideoPreset: "MediumQuality",
  29. includeExif: true
  30. })
  31. .then(image => {
  32. console.log("received image", image);
  33. this.setState({
  34. image: {
  35. uri: image.path,
  36. width: image.width,
  37. height: image.height,
  38. mime: image.mime
  39. }
  40. });
  41. })
  42. .catch(e => {
  43. console.log(e);
  44. Alert.alert(e.message ? e.message : e);
  45. });
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement