How to use the react-native-image-crop-picker.openPicker function in react-native-image-crop-picker

To help you get started, we’ve selected a few react-native-image-crop-picker examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github BrightID / BrightID / BrightID-rn / src / components / OnboardingScreens / SignUp.js View on Github external
width: 180,
      height: 180,
      includeBase64: true,
      // compressImageQuality: 0.2,
      mediaType: 'photo',
    };
    // loading UI to account for the delay after picking an image
    setTimeout(
      () =>
        this.setState({
          imagePicking: true,
        }),
      1000,
    );

    ImagePicker.openPicker(options)
      .then((image) => {
        const imageData = { uri: `data:${image.mime};base64,${image.data}` };
        this.setState({
          userAvatar: imageData,
          imagePicking: false,
        });
        setTimeout(
          () =>
            this.setState({
              imagePicking: false,
            }),
          1001,
        );
      })
      .catch((err) => {
        console.log(err);
github NervJS / taro / packages / taro-rn / src / api / image / chooseImage.js View on Github external
function openPicker (options) {
  console.log(options)
  const {count: maxFiles, success, complete} = options
  return ImagePicker.openPicker({
    multiple: true,
    maxFiles
  }).then(images => {
    console.log(images)
    let data = Object.assign({}, getRes(images), res)
    success && success(data)
    complete && complete(data)
    return data
  })
}
github RocketChat / Rocket.Chat.ReactNative / app / views / ProfileView / index.js View on Github external
pickImage = async() => {
		const options = {
			cropping: true,
			compressImageQuality: 0.8,
			cropperAvoidEmptySpaceAroundImage: false,
			cropperChooseText: I18n.t('Choose'),
			cropperCancelText: I18n.t('Cancel'),
			includeBase64: true
		};
		try {
			const response = await ImagePicker.openPicker(options);
			this.setAvatar({ url: response.path, data: `data:image/jpeg;base64,${ response.data }`, service: 'upload' });
		} catch (error) {
			console.warn(error);
		}
	}
github SocialXNetwork / socialx_react_native / packages / RNSocialX / src / utilities / mediaPicker.ts View on Github external
export const getGalleryMediaObject = async (
	options: Partial<Options> = {},
): Promise<IPickerImage | undefined> => {
	try {
		const mediaObject: IPickerImage | IPickerImage[] = await ImagePicker.openPicker({
			...DEFAULT_PICKER_OPTIONS,
			...options,
		});

		return mediaObject as IPickerImage;
	} catch (ex) {
		console.log('getGalleryMediaObject error', ex);
	}
};
github Mangeneh / akkaskhooneh-frontend / src / pages / profileEdit / ProfileEdit.js View on Github external
onChooseFromGalleryPress() {
    ImagePicker.openPicker({
      width: Constants.UPLOAD_POST_PICTURE_SIZE,
      height: Constants.UPLOAD_POST_PICTURE_SIZE,
      cropping: true,
    })
      .then((image) => {
        const imageSource = extractImageSource(image);
        this.setState({
          imageFile: image,
          imageSource,
        });
      });
  }
github Mangeneh / akkaskhooneh-frontend / src / pages / signUpComplete / SignUpComplete.js View on Github external
onChooseFromGalleryPress() {
    ImagePicker.openPicker({
      width: Constants.UPLOAD_POST_PICTURE_SIZE,
      height: Constants.UPLOAD_POST_PICTURE_SIZE,
      cropping: true,
      avoidEmptySpaceAroundImage: false,
      cropperStatusBarColor: Colors.BASE,
      cropperToolbarColor: Colors.BASE,
    })
      .then((image) => {
        const imageSource = extractImageSource(image);
        this.props.changeImage(imageSource);
      });
  }
github sishuguojixuefu / react-native-form / src / components / SsImagePicker.tsx View on Github external
private _onAddImageClick = async () => {
    const { value } = this.state
    const { onChange } = this.props
    try {
      const images = await ImageCropPicker.openPicker({
        multiple: true,
        waitAnimationEnd: false,
        includeExif: true,
        forceJpg: true,
        maxFiles: 9 - value.length,
        compressImageQuality: 0.5,
      })
      let files: any = []
      if (Array.isArray(images)) {
        files = images.map((item, index) => ({
          url: item.path,
          id: index,
          meta: { ...item },
        }))
      } else {
        files = [
github RocketChat / Rocket.Chat.ReactNative / app / containers / MessageBox / index.js View on Github external
chooseFromLibrary = async() => {
		try {
			const image = await ImagePicker.openPicker(this.libraryPickerConfig);
			this.showUploadModal(image);
		} catch (e) {
			log(e);
		}
	}
github berty / berty / js / packages / components / settings / EditProfile.tsx View on Github external
const handlePicturePressed = async () => {
		try {
			const pic = await ImagePicker.openPicker({
				width: 400,
				height: 400,
				cropping: true,
				cropperCircleOverlay: true,
				mediaType: 'photo',
			})
			if (pic) {
				dispatch({ type: 'SET_PICTURE', pic })
			}
		} catch (err) {
			if (err?.code !== 'E_PICKER_CANCELLED') {
				dispatch({ type: 'SET_ERROR', err })
			}
		}
	}