Possible Unhandled Promise Rejection(id:0) (Based on Document Picker)

996 Views Asked by At

Error appears with react-native-document-picker
I can't find a Solution according to my Problem, so i try it this way. If the Button is pressed, no new Window is open, just the Error comes up. I tried with POD updates but i think i did something wrong with my Code.

It's based on the package Documentation


  onPress = () => {
    this.openDocumentReader();
  };

  async openDocumentReader (){
    // Pick a single file
    try {
      const res = await DocumentPicker.pick({
        type: [DocumentPicker.types.allFiles],
     })
  console.log(
    res.uri,
    res.type, // mime type
    res.name,
    res.size,
  )
    } catch (err) {
      if (DocumentPicker.isCancel(err)) {
        // User cancelled the picker, exit any dialogs or menus and move on
      } else {
        Alert.alert('Simple');
        throw err
      }
    }

  }

  render() {
    return (
      <View style={styles.container}>
        <TouchableOpacity
          style={styles.button}
          onPress={this.onPress}
        >
          <Text>Press Here</Text>
        </TouchableOpacity>
      </View>
    );
  }
}

export default App;

I opened it on virtualized iPad via expo.

0

There are 0 best solutions below