How to use the react-native-document-picker.DocumentPickerUtil.allFiles function in react-native-document-picker

To help you get started, we’ve selected a few react-native-document-picker examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github laurent22 / joplin / ReactNativeClient / lib / components / screens / note.js View on Github external
return new Promise((resolve) => {
			DocumentPicker.show({ filetype: [DocumentPickerUtil.allFiles()] }, (error, res) => {
				if (error) {
					// Also returns an error if the user doesn't pick a file
					// so just resolve with null.
					console.info('pickDocument error:', error);
					resolve(null);
					return;
				}

				resolve(res);
			});
		});
	}
github lbryio / lbry-android / app / src / page / publish / view.js View on Github external
handleUploadPressed = () => {
    DocumentPicker.show(
      {
        filetype: [DocumentPickerUtil.allFiles()],
      },
      (error, res) => {
        if (!error) {
          //console.log(res);
        }
      }
    );
  };
github cometchat-pro-samples / react-native-chat-app / chatApp / src / ChatScreen.js View on Github external
documentPicker(){
        DocumentPicker.show({
            filetype: [DocumentPickerUtil.allFiles()],
        },(error,response) => {
            if(Platform.OS === 'ios'){
                var ext = response.fileName.split('.')[1].toLowerCase();               
                var type = this.getMimeType(ext);
            }
            var file = {
                name: response.fileName,
                type: Platform.OS === "android" ? response.type : type, 
                uri: Platform.OS === "android" ? response.uri : response.uri.replace("file://",""),
            }
            this.setState({ mediaMsg: file });
        });
    }
github cometchat-pro-samples / react-native-chat-app / chatApp / src / GroupChatScreen.js View on Github external
documentPicker(){
        DocumentPicker.show({
            filetype: [DocumentPickerUtil.allFiles()],
        },(error,response) => {
            if(Platform.OS === 'ios'){
                var ext = response.fileName.split('.')[1].toLowerCase();               
                var type = this.getMimeType(ext);
            }
            var file = {
                name: response.fileName,
                type: Platform.OS === "android" ? response.type : type, 
                uri: Platform.OS === "android" ? response.uri : response.uri.replace("file://",""),
            }
            this.setState({ mediaMsg: file });
        });
    }
github anchetaWern / RNChatkitDemo / src / screens / Chat.js View on Github external
openFilePicker = async () => {
    await this.setState({
      is_picking_file: true
    });

    DocumentPicker.show({
      filetype: [DocumentPickerUtil.allFiles()],
    }, async (err, file) => {
      if (!err) {

        try {
          const file_type = mime.contentType(file.fileName);
          const base64 = await RNFS.readFile(file.uri, "base64");

          const file_blob = await Blob.build(base64, { type: `${file_type};BASE64` });

          this.attachment = {
            file_blob: file_blob,
            file_name: file.fileName,
            file_type: file_type
          };

          Alert.alert("Success", "File attached!");
github rongcloud / rongcloud-react-native-imlib / example / examples / send-message.js View on Github external
pickFile = () => {
    DocumentPicker.show({ filetype: [DocumentPickerUtil.allFiles()] }, (error, response) => {
      if (response) {
        this.setState({ content: { objectName: ObjectName.File, local: response.uri } });
      }
    });
  };