How to use the react-native-image-crop-picker.openCamera 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 reactnativecomponent / react-native-chat-demo / src / screens / Chat.ios.js View on Github external
handleCameraPicker = () => {
    ImagePicker.openCamera({
      mediaType: 'photo',
      loadingLabelText: '请稍候...',
    }).then(image => {
      NimSession.sendImageMessages(image.path, 'myName')
    })
    // ImagePicker.openPicker({
    //     mediaType:'video',
    //     loadingLabelText:'请稍候...'
    // }).then((video) => {
    //     console.log(video);
    //     NimSession.sendVideoMessage(video.path, 'duration', 'width', 'height', 'displayName');
    // });
  }
  onLocation = (coordinate) => {
github zetaoWu / IRunning / app / containers / page / mePage.js View on Github external
_openCamera() {
        this.setState({ modalVisible: false });
        // ImagePicker.launchCamera(options, (response) => {
        //     // uri (on android)
        //     // const source = { uri: response.uri, isStatic: true };
        //     const source = { uri: 'data:image/jpeg;base64,' + response.data, isStatic: true };
        //     this.setState({
        //         avatarSource: source,
        //     });
        // });

        ImageCropPicker.openCamera({
            width: 500,
            height: 500,
            cropping: true,
            cropperTintColor: '#453d4b'
        }).then(image => {
            this.setState({
                avatarSource: image.path,
            });
        });
    }
github SocialXNetwork / socialx_react_native / packages / RNSocialX / src / utilities / mediaPicker.ts View on Github external
export const getCameraMediaObjectMultiple = async (options = {}): Promise<IPickerImageMultiple> => {
	try {
		const mediaObject: IPickerImage | IPickerImage[] = await ImagePicker.openCamera({
			...DEFAULT_CAMERA_OPTIONS,
			...options,
		});

		return [mediaObject as IPickerImage];
	} catch (ex) {
		console.log('getCameraMediaObjectMultiple error', ex);
		return [];
	}
};
github Bit-Nation / BITNATION-Pangea-mobile / src / PangeaCommonReactNative / UI / PhotoActionSheet.js View on Github external
openPicker = async (isCamera: boolean) => {
    const options = {
      cropping: this.props.circleCropping,
      mediaType: 'photo',
      cropperCircleOverlay: this.props.circleCropping,
      compressImageQuality: 0.4,
      includeBase64: true,
    };

    try {
      const result = isCamera ?
        await ImagePicker.openCamera(options)
        :
        await ImagePicker.openPicker(options);

      if (result.data) {
        this.props.onImageChosen(result.data, result.mime);
      }
    } catch (error) {
      if (error.code !== 'E_PICKER_CANCELLED') {
        Alert.alert(i18n.t('error.noCamera'));
      }
    }
  };
github NervJS / taro / packages / taro-rn / src / api / image / chooseImage.js View on Github external
function openCamera (options) {
  const {success, fail, complete} = options
  return ImagePicker.openCamera({}).then(image => {
    const result = {
      tempFilePaths: [image.path],
      tempFiles: [
        {
          path: image.path,
          size: image.size
        }]
    }
    const data = Object.assign({}, result, res)
    success && success(data)
    complete && complete(data)
    return data
  })
}
github Mangeneh / akkaskhooneh-frontend / src / pages / profileEdit / ProfileEdit.js View on Github external
onOpenCameraPress() {
    ImagePicker.openCamera({
      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 esteemapp / esteem-mobile / src / containers / profileEditContainer.js View on Github external
_handleOpenCamera = action => {
    ImagePicker.openCamera({
      includeBase64: true,
    })
      .then(image => {
        this._handleMediaOnSelected(image, action);
      })
      .catch(e => {
        this._handleMediaOnSelectFailure(e);
      });
  };
github letsdoitworld / World-Cleanup-Day / mobile-app / src / screens / CreateMarker / BaseTrashpointEdit.js View on Github external
successAddAnotherTrashPoint = async () => {
    const image = await ImagePicker.openCamera({
      compressImageQuality: 0.2,
      cropping: true,
      includeBase64: true,
    });
    const { width, height, data, path } = image;
    const uri = path;
    const base64 = data;

    const thumbnailBase64 = await ImageService.getResizedImageBase64({
      uri,
      width,
      height,
    });
    var newPosition;
    if (Platform.OS === 'ios') {
      newPosition = this.actualCoords
github Bit-Nation / BITNATION-Pangea-mobile / src / components / common / PhotoActionSheet.js View on Github external
openPicker = async (isCamera: boolean) => {
    const options = {
      cropping: this.props.circleCropping,
      mediaType: 'photo',
      cropperCircleOverlay: this.props.circleCropping,
      compressImageQuality: 0.4,
      includeBase64: true,
    };

    try {
      const result = isCamera ?
        await ImagePicker.openCamera(options)
        :
        await ImagePicker.openPicker(options);

      if (result.data) {
        this.props.onImageChosen(result.data, result.mime);
      }
    } catch (error) {
      if (error.code !== 'E_PICKER_CANCELLED') {
        Alert.alert(i18n.t('error.noCamera'));
      }
    }
  };
github just4fun / stuhome / src / services / ImagePicker.js View on Github external
function takePhoto({
  takePhotoOptions,
  uploadAction
}) {
  ImagePicker.openCamera(takePhotoOptions).then(image => {
    uploadAction && uploadAction(image);
  }).catch(e => {
    if (e.code === 'E_PICKER_CANNOT_RUN_CAMERA_ON_SIMULATOR') {
      AlertIOS.alert('提示', MESSAGES[e.code]);
    } else if (e.code === 'E_PICKER_NO_CAMERA_PERMISSION') {
      goToAppSettings(MESSAGES[e.code]);
    }
  });
}