{"action":"created","issue":{"url":"https://api.github.com/repos/marcshilling/react-native-image-picker/issues/235","repository_url":"https://api.github.com/repos/marcshilling/react-native-image-picker","labels_url":"https://api.github.com/repos/marcshilling/react-native-image-picker/issues/235/labels{/name}","comments_url":"https://api.github.com/repos/marcshilling/react-native-image-picker/issues/235/comments","events_url":"https://api.github.com/repos/marcshilling/react-native-image-picker/issues/235/events","html_url":"https://github.com/marcshilling/react-native-image-picker/issues/235","id":160933567,"number":235,"title":"undefined is not an object (evaluating '_reactNativeImagePicker2.default.showImagePicker')","user":{"login":"joshg111","id":3508674,"avatar_url":"https://avatars.githubusercontent.com/u/3508674?v=3","gravatar_id":"","url":"https://api.github.com/users/joshg111","html_url":"https://github.com/joshg111","followers_url":"https://api.github.com/users/joshg111/followers","following_url":"https://api.github.com/users/joshg111/following{/other_user}","gists_url":"https://api.github.com/users/joshg111/gists{/gist_id}","starred_url":"https://api.github.com/users/joshg111/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshg111/subscriptions","organizations_url":"https://api.github.com/users/joshg111/orgs","repos_url":"https://api.github.com/users/joshg111/repos","events_url":"https://api.github.com/users/joshg111/events{/privacy}","received_events_url":"https://api.github.com/users/joshg111/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-06-17T17:08:35Z","updated_at":"2016-06-18T09:05:39Z","closed_at":null,"body":"Hi, \r\nI'm using the latest build for ImagePicker. From package.json:\r\n\"react-native-image-picker\": \"^0.19.4\"\r\n\r\nI keep seeing this crash: undefined is not an object (evaluating '_reactNativeImagePicker2.default.showImagePicker') at the following line:\r\nImagePicker.showImagePicker(options, (response) => {\r\n...\r\nMaybe I did not install it correctly. I used rnpm. The output of rnpm is successful though. Maybe I should try to link it manually. \r\n\r\nHere's my code, it's very similar to example code for android. \r\n\r\n```javascript\r\nimport React from 'react';\r\nimport {\r\n  Linking,\r\n  ListView,\r\n  Platform,\r\n  Text,\r\n  TouchableHighlight,\r\n  StyleSheet,\r\n  View,\r\n  RefreshControl,\r\n  Image,\r\n  TextInput\r\n} from 'react-native';\r\n\r\n// Flux\r\nimport AltActions from '../../actions/actions';\r\nimport AltStore from '../../stores/store';\r\n\r\nimport { Actions } from 'react-native-router-flux';\r\n\r\nimport ImagePicker from 'react-native-image-picker';\r\n\r\nvar ToolbarAndroid = require('ToolbarAndroid');\r\nvar toolbarActions = \r\n    [{title: 'Done', show: 'always'}];\r\n\r\nexport default class Main extends React.Component {\r\n  constructor(props) {\r\n    super(props);\r\n    \r\n    s = AltStore.getState()\r\n    this.state = {\r\n      name: s.profile.name,\r\n      gender: s.profile.gender,\r\n      avatarSource: null\r\n    };\r\n    \r\n  }\r\n\r\n  selectPhotoTapped() {\r\n    const options = {\r\n      title: 'Photo Picker',\r\n      takePhotoButtonTitle: 'Take Photo...',\r\n      chooseFromLibraryButtonTitle: 'Choose from Library...',\r\n      quality: 0.5,\r\n      maxWidth: 300,\r\n      maxHeight: 300,\r\n      allowsEditing: true,\r\n      storageOptions: {\r\n        skipBackup: true\r\n      }\r\n    };\r\n\r\n    // Fails on the following line.\r\n    ImagePicker.showImagePicker(options, (response) => {\r\n      //console.log('Response = ', response);\r\n      if(response === undef)\r\n      {\r\n        \r\n      }\r\n      else if (response.didCancel) {\r\n        //console.log('User cancelled photo picker');\r\n      }\r\n      else if (response.error) {\r\n        //console.log('ImagePicker Error: ', response.error);\r\n      }\r\n      else if (response.customButton) {\r\n        //console.log('User tapped custom button: ', response.customButton);\r\n      }\r\n      else {\r\n        var source;\r\n\r\n        // You can display the image using either:\r\n        source = {uri: 'data:image/jpeg;base64,' + response.data, isStatic: true};\r\n\r\n        //this.setState({\r\n        //  avatarSource: source\r\n        //});\r\n      }\r\n    });\r\n  }\r\n  \r\n  componentDidMount() {\r\n    AltStore.listen((state) => this.onAltStoreChange(state));\r\n\r\n    //AltActions.getProfile();\r\n  }\r\n\r\n  componentWillUnmount() {\r\n    AltStore.unlisten((state) => this.onAltStoreChange(state));\r\n  }\r\n\r\n  onAltStoreChange(state) {\r\n    this.setState({\r\n      name: state.profile.name,\r\n      gender: state.profile.gender\r\n    });\r\n  }\r\n\r\n  onActionSelected(position) {\r\n    if (position === 0) { \r\n      AltActions.setProfile({name: this.state.name, gender: this.state.gender});\r\n      Actions.pop(); \r\n      \r\n    } \r\n  }\r\n  \r\n  render() {\r\n    return (\r\n      <View style={styles.container}>\r\n        <ToolbarAndroid\r\n          title=\"Hello!\"\r\n          style={styles.toolbar} \r\n          actions={toolbarActions}\r\n          onActionSelected={this.onActionSelected.bind(this)}/>\r\n        <View style={styles.imageBox}>\r\n          <Image\r\n            style={styles.image}\r\n            source={this.state.avatarSource} />\r\n          <View style={styles.col}>\r\n            <TextInput \r\n              style={styles.hello}\r\n              onChangeText={(text) => this.setState({name: text})}\r\n              value={this.state.name} \r\n            />\r\n            <TextInput \r\n              style={styles.hello}\r\n              onChangeText={(text) => this.setState({gender: text})}\r\n              value={this.state.gender}\r\n            />\r\n            <TouchableHighlight\r\n              style={styles.editPicButton}\r\n              onPress={this.selectPhotoTapped.bind(this)}\r\n              underlayColor=\"#202020\">\r\n              <Text style={styles.hello}>{'Change Profile Picture'}</Text>\r\n            </TouchableHighlight>\r\n          </View>\r\n        </View>\r\n      </View>\r\n    );\r\n  }\r\n}\r\n\r\nvar styles = StyleSheet.create({\r\n  container: {\r\n    flex: 1\r\n  },\r\n  editPicButton: {\r\n    flex: 0,\r\n    borderWidth: 1\r\n  },\r\n  toolbar: {\r\n   \theight: 56,\r\n    backgroundColor: '#e9eaed',\r\n  },\r\n  col: {\r\n    flex: 1,\r\n    flexDirection: 'column'\r\n  },\r\n  imageBox: {\r\n    flex: 1,\r\n    flexDirection: 'row'\r\n  },\r\n  image: {\r\n      flex: 0,\r\n      width: 200,\r\n      height: 220\r\n  },\r\n  hello: {\r\n    flex: 0,\r\n    height: 40, \r\n    borderColor: 'gray', \r\n    borderWidth: 1\r\n  }\r\n});\r\n```"},"comment":{"url":"https://api.github.com/repos/marcshilling/react-native-image-picker/issues/comments/226930786","html_url":"https://github.com/marcshilling/react-native-image-picker/issues/235#issuecomment-226930786","issue_url":"https://api.github.com/repos/marcshilling/react-native-image-picker/issues/235","id":226930786,"user":{"login":"joshg111","id":3508674,"avatar_url":"https://avatars.githubusercontent.com/u/3508674?v=3","gravatar_id":"","url":"https://api.github.com/users/joshg111","html_url":"https://github.com/joshg111","followers_url":"https://api.github.com/users/joshg111/followers","following_url":"https://api.github.com/users/joshg111/following{/other_user}","gists_url":"https://api.github.com/users/joshg111/gists{/gist_id}","starred_url":"https://api.github.com/users/joshg111/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshg111/subscriptions","organizations_url":"https://api.github.com/users/joshg111/orgs","repos_url":"https://api.github.com/users/joshg111/repos","events_url":"https://api.github.com/users/joshg111/events{/privacy}","received_events_url":"https://api.github.com/users/joshg111/received_events","type":"User","site_admin":false},"created_at":"2016-06-18T09:05:38Z","updated_at":"2016-06-18T09:05:38Z","body":"Problem solved. Turns out I had to create a react native project, then the rnpm linking seemed to be working a little better. At the end I had to go through the manual linking steps to get it to work. Also, I was having the issue where taking/selecting photo was not calling the callback method. I then copied over a MainActivity.java file from the AwesomeProject facebook tutorial which was much less complex then my version of MainActivity.java. After that everything worked. THX for your help!"}}
{"actor":{"display_login":"joshg111"}}