title: react native image picker error : undefined is not an object
body: <p>I implemented get photo from library,
  but when I don't choose photo in libary and just cancel, I got error
  <strong>undefined is not an object (evaluating 'response.assets[0]')</strong></p>
  <p>I think it's because response.assets[0].uri might be empty when I didn't choose photo.
  How can I solve this?</p>
  <p>here's my code
  CameraScreen.js</p>
  <pre><code>import React, {Component} from 'react'
  import { View, Text, StyleSheet, Image, TouchableOpacity } from 'react-native'
  import {launchCamera, launchImageLibrary } from 'react-native-image-picker'
  
  class CameraScreen extends Component {
    state = {
      avatar: ''
    }
  
    showImage = () =&gt; {
      launchImageLibrary({}, (response)=&gt;{
        alert(response.assets[0].uri)
        this.setState({
          avatar: response.assets[0].uri
        })
      })
    }
  
    render() {
      return (
        &lt;View style={styles.container}&gt;
          &lt;Image
            source={{uri:this.state.avatar}}
            style={styles.avatar}
          /&gt;
          &lt;TouchableOpacity
            style={styles.buttonStyle}
            activeOpacity={0.5}
            onPress={() =&gt; {this.showImage()}}
          &gt;
            &lt;Text style={styles.buttonTextStyle}&gt;영수증 등록하기&lt;/Text&gt;
          &lt;/TouchableOpacity&gt;
        &lt;/View&gt;
      )
    }
  }
  </code></pre>