Skip to content

Instantly share code, notes, and snippets.

@godswillokokon
Last active May 11, 2020 12:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save godswillokokon/59b07bf7a030787cc60c8be895674561 to your computer and use it in GitHub Desktop.
Save godswillokokon/59b07bf7a030787cc60c8be895674561 to your computer and use it in GitHub Desktop.
import React, { useState } from 'react'
import {
...
} from 'react-native';
import ImagePicker from 'react-native-image-picker';
const App = () => {
const selectPhotoTapped = () => {
const options = {
title: 'Select Photo',
storageOptions: {
skipBackup: true,
path: 'images',
},
};
ImagePicker.showImagePicker(options, (response) => {
console.log('Response = ', response);
if (response.didCancel) {
console.log('User cancelled image picker');
} else if (response.error) {
console.log('ImagePicker Error: ', response.error);
} else {
const uri = response.uri;
const type = response.type;
const name = response.fileName;
const source = {
uri,
type,
name,
}
}
});
}
return (
<View>
...
</View >
);
};
const styles = StyleSheet.create({
...
});
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment