How to use the react-native-document-picker.types 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 bnankiewicz / organic / src / modules / startup / screens / splash.tsx View on Github external
const openPicker = async () => {
  console.tron.debug(DocumentPicker.types)
  try {
    const res = await DocumentPicker.pick({
      type: [DocumentPicker.types.allFiles],
    })
    console.log(
      res.uri,
      res.type, // mime type
      res.name,
      res.size
    )
    console.tron.debug('URI')
    console.tron.debug(res)
    const name = decodeURIComponent(res.uri)

    if (name.startsWith(CONTENT_PREFIXES.RESILLIO_SYNC)) {
      const realPath = name.replace(CONTENT_PREFIXES.RESILLIO_SYNC, '')
github bnankiewicz / organic / src / modules / startup / screens / splash.tsx View on Github external
const openPicker = async () => {
  console.tron.debug(DocumentPicker.types)
  try {
    const res = await DocumentPicker.pick({
      type: [DocumentPicker.types.allFiles],
    })
    console.log(
      res.uri,
      res.type, // mime type
      res.name,
      res.size
    )
    console.tron.debug('URI')
    console.tron.debug(res)
    const name = decodeURIComponent(res.uri)

    if (name.startsWith(CONTENT_PREFIXES.RESILLIO_SYNC)) {
      const realPath = name.replace(CONTENT_PREFIXES.RESILLIO_SYNC, '')
      const content = await RNFetchBlob.fs.readFile(realPath, 'utf8')
      const stat = await RNFetchBlob.fs.stat(realPath, 'utf8')
      console.tron.debug(stat)
github berty / berty / js / packages / components / chat / file-uploads / AddFileMenu.tsx View on Github external
onPress: async () => {
				setActiveTab(TabItems.Files)
				try {
					const res = await DocumentPicker.pick({
						type: [DocumentPicker.types.allFiles],
					})
					prepareMediaAndSend([
						{
							filename: res.name,
							uri: res.uri,
							mimeType: res.type,
						},
					])
				} catch (err) {
					if (DocumentPicker.isCancel(err)) {
						// ignore
					}
				}
			},
		},
github RocketChat / Rocket.Chat.ReactNative / app / containers / MessageBox / index.js View on Github external
chooseFile = async() => {
		try {
			const res = await DocumentPicker.pick({
				type: [DocumentPicker.types.allFiles]
			});
			this.showUploadModal({
				filename: res.name,
				size: res.size,
				mime: res.type,
				path: res.uri
			});
		} catch (e) {
			if (!DocumentPicker.isCancel(e)) {
				log(e);
			}
		}
	}
github raindropio / mobile / src / screens / bookmark / add / home / file.js View on Github external
onPress = async ()=>{
        let files = []
        try{
            files = await DocumentPicker.pickMultiple({
                type: [
                    DocumentPicker.types.images,
                    DocumentPicker.types.pdf,
                    DocumentPicker.types.plainText,
                    DocumentPicker.types.video,
                    ...Platform.select({
                        ios: ['com.microsoft.word.doc', 'com.microsoft.excel.xls', 'com.microsoft.powerpoint.​ppt', 'org.openxmlformats.wordprocessingml.document', 'org.openxmlformats.spreadsheetml.sheet', 'org.openxmlformats.presentationml.presentation', 'org.openxmlformats.presentationml.slideshow'],
                        android: ['application/*']//doc,etc...
                    })
                ],
            })
        }catch(e){}

        if (!files.length)
            return

        Navigation.replace(this.props, 'bookmark/add/save', {
            values: files.map(({name, uri, type})=>({
github raindropio / mobile / src / screens / bookmark / add / home / file.js View on Github external
onPress = async ()=>{
        let files = []
        try{
            files = await DocumentPicker.pickMultiple({
                type: [
                    DocumentPicker.types.images,
                    DocumentPicker.types.pdf,
                    DocumentPicker.types.plainText,
                    DocumentPicker.types.video,
                    ...Platform.select({
                        ios: ['com.microsoft.word.doc', 'com.microsoft.excel.xls', 'com.microsoft.powerpoint.​ppt', 'org.openxmlformats.wordprocessingml.document', 'org.openxmlformats.spreadsheetml.sheet', 'org.openxmlformats.presentationml.presentation', 'org.openxmlformats.presentationml.slideshow'],
                        android: ['application/*']//doc,etc...
                    })
                ],
            })
        }catch(e){}

        if (!files.length)
            return

        Navigation.replace(this.props, 'bookmark/add/save', {
            values: files.map(({name, uri, type})=>({
                uri,
github jolocom / smartwallet-app / src / ui / recovery / container / importBackup.tsx View on Github external
private getBackupFile = async () => {
    const res = await DocumentPicker.pick({
      type: [DocumentPicker.types.plainText],
    })
    const importedData = await readFile(res.uri)

    const encryptedBackup = this.validateImport(importedData)
    if (encryptedBackup) {
      this.props.recoverIdentity(encryptedBackup)
    }
  }
github mattermost / mattermost-mobile / app / screens / edit_profile / edit_profile.js View on Github external
const {
            profileImage,
            profileImageRemove,
        } = this.state;

        const style = getStyleSheet(theme);
        const uri = profileImage ? profileImage.uri : null;

        return (