Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- POUR EN SAVOIR PLUS, CLIQUEZ SUR LE LIEN http://bit.ly/36Y5iDA
- https://gurl.pw/i3XI
- import * as React from 'react';
- import { Button, Image, View, Alert } from 'react-native';
- import * as ImagePicker from 'expo-image-picker';
- import Constants from 'expo-constants';
- import * as Permissions from 'expo-permissions';
- import { AntDesign, Ionicons, MaterialIcons } from '@expo/vector-icons';
- import * as Print from 'expo-print';
- export default class ImagePickerExample extends React.Component {
- state = {
- image: null,
- avatarSource: null,
- isUploading: false
- };
- componentDidMount() {
- this.getPermissionAsync();
- console.log('Permisos Aceptados');
- }
- getPermissionAsync = async () => {
- if (Constants.platform.ios) {
- const { status } = await Permissions.askAsync(Permissions.CAMERA_ROLL);
- if (status !== 'granted') {
- alert('Sorry, we need camera roll permissions to make this work!');
- }
- }
- }
- _pickImagePDF = async () => {
- let result = await ImagePicker.launchCameraAsync({
- mediaTypes: ImagePicker.MediaTypeOptions.All,
- allowsEditing: true,
- aspect: [4, 3],
- quality: 0.5,
- base64: true
- });
- console.log(result);
- Print.printToFileAsync({
- html: '<img src="data:image/jpeg;base64, '+result.base64+'" width="100%"/>',
- width : 612,
- height : 792,
- base64 : true
- });
- if (!result.cancelled) {
- /**this.setState({ image: result.uri });
- this.uploadImage(result.uri);**/
- }
- }
Add Comment
Please, Sign In to add comment