Created
October 19, 2019 20:02
-
-
Save deeayeen/281ca399a19174321cd3a8c23d2be433 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ImagePicker from 'react-native-image-picker'; | |
import {Button} from 'react-native-elements'; | |
const options = { | |
title: 'Select Video to Upload', | |
mediaType: 'video', | |
storageOptions: { | |
skipBackup: true, | |
path: 'images', | |
}, | |
}; | |
class UploadButton extends React.Component { | |
render() { | |
return <Button title="Upload a Video" onPress={this._handleButtonPress} />; | |
} | |
_handleButtonPress = () => { | |
ImagePicker.showImagePicker(options, response => { | |
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 { | |
// This response object will hold the URI | |
console.log(response) | |
} | |
}); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment