We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android 10 , on "SupportScreen", add image-picker code. after select a image, app navigate to the loading screen. it seems restart.
image-picker
"react": "16.11.0", "react-native": "0.62.2", "react-native-image-picker": "^2.3.1",
import React, { useState, useEffect } from 'react'; import { View, Text, Button, StyleSheet, Image, PermissionsAndroid, Linking, Alert } from 'react-native'; import ImagePicker from 'react-native-image-picker'; const SupportScreen = () => { const [source, setSource] = useState(null); const defaultImage = require('../assets/logo.png'); const options = { title: 'Select Image', quality: 0.5, maxWidth: 600, maxHeight: 500, cancelButtonTitle: 'Cancel', takePhotoButtonTitle: 'Camera', chooseFromLibraryButtonTitle: 'Select from library', chooseWhichLibraryTitle: 'Select', cameraType: 'back', mediaType: 'photo', // customButtons: [{ name: 'fb', title: 'Choose Photo from Facebook' }], storageOptions: { skipBackup: true, path: 'images', }, // allowsEditing: false, noData: true, permissionDenied: { title: 'Need permissons', text: 'Please authorize the Camera and Photo permissions', reTryTitle: 'Go to settings', okTitle: 'OK' }, }; // android permissions const _showPicker = (type, option) => { PermissionsAndroid.requestMultiple([ PermissionsAndroid.PERMISSIONS.CAMERA, PermissionsAndroid.PERMISSIONS.READ_EXTERNAL_STORAGE ]).then(granted => { console.log('global.CheckAndroidPermissions', granted) if (granted[PermissionsAndroid.PERMISSIONS.READ_EXTERNAL_STORAGE] === PermissionsAndroid.RESULTS.NEVER_ASK_AGAIN || granted[PermissionsAndroid.PERMISSIONS.READ_EXTERNAL_STORAGE] === PermissionsAndroid.RESULTS.DENIED) {//GRANTED Alert.alert(''Need permissons', 'Please authorize the Camera and Photo permissions', [ { text: 'Cancel', style: "cancel", onPress: () => { // Linking.openSettings() }, }, { text: 'Go to settings', onPress: () => { Linking.openSettings() }, } ], { cancelable: false }); return; } //#region //select a image try { ImagePicker.showImagePicker(options, (response) => { console.log('Response = ', response); // return; if (response.didCancel) { console.log('User cancelled image picker'); } else if (response.error) { console.log('ImagePicker Error: ', response.error); } else if (response.customButton) { console.log('User tapped custom button: ', response.customButton); } else { const source = { uri: `file://${response.path}` }; // You can also display the image using data: // const source = { uri: 'data:image/jpeg;base64,' + response.data }; // setSource(source) } }); } catch (err) { console.log(err) } //#endregion }) } return ( <View style={styles.container}> <Text>Support Screen</Text> <Button title="Click Here" onPress={() => _showPicker()} /> <View> <Image source={source ? { uri: source } : defaultImage} resizeMode='cover' style={{ width: 100, height: 100 }} /> </View> </View> ); }; export default SupportScreen; const styles = StyleSheet.create({ container: { flex: 1, alignItems: 'center', justifyContent: 'center' }, });
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Android 10 , on "SupportScreen", add
image-picker
code.after select a image, app navigate to the loading screen. it seems restart.
The text was updated successfully, but these errors were encountered: