Git Product home page Git Product logo

react-native-file-viewer's Introduction

Hi there ๐Ÿ‘‹

react-native-file-viewer's People

Contributors

geweald avatar johakr avatar lachlanroche avatar laurent22 avatar maddijoyce avatar mdrayer avatar mtiziano avatar radko93 avatar rgordon95 avatar rickysullivan avatar suhailmehta avatar thg303 avatar tobbbe avatar vinzscam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

react-native-file-viewer's Issues

Error while updating property 'source' of a view managed by: RNCWebView

When I try to open a png file on my Huawei P20 Lite I am getting this error:

RNCWebView
	at com.facebook.react.uimanager.ViewManagersPropertyCache$PropSetter.updateViewProp(ViewManagersPropertyCache.java:98)
	at com.facebook.react.uimanager.ViewManagerPropertyUpdater$FallbackViewManagerSetter.setProperty(ViewManagerPropertyUpdater.java:134)
	at com.facebook.react.uimanager.ViewManagerPropertyUpdater.updateProps(ViewManagerPropertyUpdater.java:54)
	at com.facebook.react.uimanager.ViewManager.updateProperties(ViewManager.java:48)
	at com.facebook.react.uimanager.NativeViewHierarchyManager.createView(NativeViewHierarchyManager.java:278)
	at com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute(UIViewOperationQueue.java:179)
	at com.facebook.react.uimanager.UIViewOperationQueue$1.run(UIViewOperationQueue.java:773)
	at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:888)
	at com.facebook.react.uimanager.UIViewOperationQueue.access$2200(UIViewOperationQueue.java:42)
	at com.facebook.react.uimanager.UIViewOperationQueue$2.runGuarded(UIViewOperationQueue.java:846)
	at com.facebook.react.bridge.GuardedRunnable.run(GuardedRunnable.java:29)
	at android.os.Handler.handleCallback(Handler.java:907)
	at android.os.Handler.dispatchMessage(Handler.java:105)
	at android.os.Looper.loop(Looper.java:216)
	at android.app.ActivityThread.main(ActivityThread.java:7625)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)
Caused by: java.lang.reflect.InvocationTargetException
	at java.lang.reflect.Method.invoke(Native Method)
	at com.facebook.react.uimanager.ViewManagersPropertyCache$PropSetter.updateViewProp(ViewManagersPropertyCache.java:83)
	... 17 more
Caused by: com.facebook.react.bridge.UnexpectedNativeTypeException: Value for uri cannot be cast from ReadableNativeMap to String
	at com.facebook.react.bridge.ReadableNativeMap.checkInstance(ReadableNativeMap.java:139)
	at com.facebook.react.bridge.ReadableNativeMap.getNullableValue(ReadableNativeMap.java:127)
	at com.facebook.react.bridge.ReadableNativeMap.getString(ReadableNativeMap.java:161)
	at com.reactnativecommunity.webview.RNCWebViewManager.setSource(RNCWebViewManager.java:431)
	... 19 more

Android 9
Version: 2.0.1
React Native: 0.61.5

Invariant Violation: Native module cannot be null.

I've updated my app to use react native 0.61 and since then, I'm getting this error when I import react-native-file-viewer in my files.

Looks like this in my files :

import FileViewer from 'react-native-file-viewer';
...
  async openAttachment(localFilePath) {
    try {
      setTimeout(async () => {
        await FileViewer.open(localFilePath);
      }, 100);
    } catch (e) {
      this.unableToOpenFile();
    }
  }

Imported :

    "react-native-file-viewer": "^2.0.1",

I'm using the automatic installation

View image

So my app can either have PDF documents or images, does this support images?

Error when closing opened file

Opening file working just fine, but when i close any file, i get this error
photo_2019-04-29_10-10-06
this happens because this package and react-native-awesome-card-io using the same request codes

Application crashes while trying to open xlsx file

UnexpectedNativeTypeException
I am trying to open a xlxs file on emulator with Android 10. If I install any application wich can open xlsx it works fine but when no application installed it crashes with following native exception:

com.facebook.react.bridge.UnexpectedNativeTypeException: Value for message cannot be cast from ReadableNativeMap to String
	at com.facebook.react.bridge.ReadableNativeMap.checkInstance(ReadableNativeMap.java:139)
	at com.facebook.react.bridge.ReadableNativeMap.getNullableValue(ReadableNativeMap.java:127)
	at com.facebook.react.bridge.ReadableNativeMap.getString(ReadableNativeMap.java:161)
	at com.facebook.react.modules.dialog.DialogModule.showAlert(DialogModule.java:195)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:371)
	at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:150)
	at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
	at android.os.Handler.handleCallback(Handler.java:883)
	at android.os.Handler.dispatchMessage(Handler.java:100)
	at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:26)
	at android.os.Looper.loop(Looper.java:214)
	at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:225)
	at java.lang.Thread.run(Thread.java:919)

Version: 2.0.1
React Native: 0.61.5

Open file types docx, pdf, pptx error

Hi @vinzscam,

I'm using Android Marshmallow Emulator and react-native-document-picker to pick a file which the response is a file URI then I convert it using react-native-get-real-path and the response is a absolute path.

Now when I used react-native-file-viewer I just pass the absolute path on it and it was able to open .jpg(need to pick a photo viewer app) and .txt(html view) but I got an error when I tried to open .docx, .PPTX and .pdf.

I would like to ask for your assistance on this.

FYR.

Below is my code implementation:
image

Below is the attached files:
image

Below is the logs:
image

Problems displaying preview on iOS

When trying to load an image downloaded to the RNFS's 'DocumentDirectoryPath'
It recognizes the file and extension but it cannot preview it. It also seems all the sharing options don't recognize the file properly. Should I be putting it somewhere else or?

Simulator Screen Shot - iPhone XS Max - 2019-03-15 at 10 14 13

error: cannot find symbol new RNFileViewerPackage()

Hi! I have an error. Please help me to fix this. What am I doing wrong?

`> react-native run-android

info JS server already running.
info Building and installing the app on the device (cd android && ./gradlew app:installDebug)...

Configure project :app
Could not find google-services.json while looking in [src/nullnull/debug, src/debug/nullnull, src/nullnull, src/debug, src/nullnullDebug]
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
Could not find google-services.json while looking in [src/nullnull/release, src/release/nullnull, src/nullnull, src/release, src/nullnullRelease]
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)

Configure project :react-native-audio
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Configure project :react-native-device-info
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Configure project :react-native-document-picker
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Configure project :react-native-fabric
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Configure project :react-native-fast-image
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Configure project :react-native-i18n
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Configure project :react-native-image-crop-picker
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Configure project :react-native-keychain
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Configure project :react-native-navigation
downloadRobolectricDependencies /Users/nikbelikov/Documents/rt-life-frontend/android/build/robolectric-dependencies
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: Configuration 'testCompile' is obsolete and has been replaced with 'testImplementation'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Configure project :react-native-svg
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Configure project :react-native-text-input-mask
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Configure project :react-native-toast
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Configure project :react-native-touch-id
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Configure project :react-native-vector-icons
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Configure project :react-native-video
WARNING: Configuration 'provided' is obsolete and has been replaced with 'compileOnly'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Configure project :react-native-webview
:react-native-webview:reactNativeAndroidRoot /Users/nikbelikov/Documents/rt-life-frontend/node_modules/react-native/android

Configure project :react-native-zeroconf
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Configure project :reactnativekeyboardinput
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Configure project :reactnativenotifications
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: Configuration 'testCompile' is obsolete and has been replaced with 'testImplementation'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Configure project :rn-fetch-blob
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Task :app:processDebugGoogleServices
Parsing json file: /Users/nikbelikov/Documents/rt-life-frontend/android/app/google-services.json

Task :app:compileDebugJavaWithJavac FAILED
/Users/nikbelikov/Documents/rt-life-frontend/android/app/src/main/java/ru/rt/life/MainApplication.java:74: error: cannot find symbol
new RNFileViewerPackage(),
^
symbol: class RNFileViewerPackage
location: class MainApplication
Note: /Users/nikbelikov/Documents/rt-life-frontend/android/app/src/main/java/ru/rt/life/CustomPushNotification.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 5s
387 actionable tasks: 8 executed, 379 up-to-date
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: ./gradlew app:installDebug. Run CLI with --verbose flag for more details.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] android: react-native run-android
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] android script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/nikbelikov/.npm/_logs/2019-12-02T10_06_20_281Z-debug.log

Process finished with exit code 1

`

Failed to open pdf file in android

Hi,

We were trying to open a pdf file stored in a local file using android emulator.
The file was downloaded using RNFS and stored in document directory path.
In order to fetch the file , we've used ${RNFS.DocumentDirectoryPath} + "/" + "artworkId=28960045relMedia=43381lang=EN.pdf and in the console the value of it is
"/data/user/0//files/artworkId=28960045relMedia=43381lang=EN.pdf". However it doesn't open the file and instead it throws an error : Failed to find configured root that contains /data/data//files/artworkId=28960045relMedia=43381lang=EN.pdf
Can you advise on how to fix the issue or if we did something wrong in using the module?
Thanks

The project 'ReactNative' cannot be referenced. RNFileViewer in VisualStudio2019

Hi,
I want to do show file in my react-native application with uwp. so i installed this package to my react-native winows app. after installation i linked this to my app via visual studio. After add this .csprojt , under refernce i got the warning symbol and also got the message as "Warning The project 'ReactNative' cannot be referenced. RNFileViewer" in VisualStudio2019. my react-native project version is 0.59.0 and react-native-windows --template vnext version also 0.59.0. Could you please tell how to resolve this.

Edit Interactive PDFs ?

I'm opening some interactive PDFs through the file-viewer, and it does allow edits, and enabled the share options. Only problem is if I then save to file system, send to mail, etc, only the base PDF is saved/sent, without any input content (on ios at least). Perhaps as this is called a file "viewer" I'm hoping for too much, but can anything be done? I thought this package was just invoking whatever native file app is registered for a filetype, if that allows edit & save why wouldn't that work? Is there an option to open a file in non-read-only mode?

iOs - Hide status bar

Is there a way to hide the status bar while viewing a file on ios?

In my app the status bar is always hidden. When I open a PDF with this modules, the status bar shows up and then stays present in my app after I close the file preview. Any ideas?

Thanks

"Save to Files" does not work

Hi @vinzscam, first off, thanks for this library! Very useful and works very well for my use case.

One thing that is not working for me is the Save to File option from the context menu: When viewing a file, I press the export button (arrow coming out of the box icon in the upper right corner, next to the filename); the context menu shows up as expected; when I press Save to Files, the context menu disappears as expected, and a blank/white view slides in from the bottom of the screen and then immediately disappears again. No error seems to be thrown and nothing else happens. Other menu options such as Print seem to work fine (I haven't tried actually printing but the Printer Options dialog comes up as expected).

I didn't find any mention of this in the docs and in existing issues. Any ideas?

Thanks!

Android install and No app associated with this mime type issue

Hey, Firstly, thanks for your hard work! Ios is working beautifully and can't wait to get this up on android..

First issue
The readme installation instructions for android number,
Copy android/src/main/res/xml/file_viewer_provider_paths.xml to your project res/xml/ directory
I can't find that path in my project.
screen shot 2018-10-30 at 8 15 46 am

Second, I can't open a docx on android. I'm assuming due to not completely step four of the installation. But...
`
// // const path = // absolute-path-to-my-local-file.
FileViewer.open(filePath)
.then(() => {
console.log('success')
// success
})
.catch(error => {
// error
console.log('Error viewing document', error)
})

`
screen shot 2018-10-30 at 8 16 00 am

I should also note. When attempting to open a PDF, I get a success and can view the document.

I am not using RNFS but RNfetchBlob as it supports more of what I'm doing with streams.

UPDATE: It may appear android just doesn't support docx. If you can verify this, lets get a PR stating that in the docs to save newbies like me some time ;).
Thanks!

'React/RCTDefines.h' file not found

I'm not able to run the project when i link this library, i followed the steps but when try to compile i get

'React/RCTDefines.h' file not found

I'm using a expo detached app.
thanks for any help

Failed to find configured root that contains

Hi. I'm running into this error when trying to make use of your Library. I combining this library with react-native-document-picker. I have in my android/app/src/main/res/xml file the following code:

<?xml version='1.0' encoding='utf-8'?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
    <files-path name="files" path="/" />
    <external-files-path name="external_files" path="" />
    <external-path name="external" path="." />
    <cache-path name="cache" path="/" />
</paths>

Also, in my AndroidManifest.xml file, I have:

<provider
        android:name="com.vinzscam.reactnativefileviewer.FileProvider"
        android:authorities="${applicationId}.provider"
        android:exported="false"
        android:grantUriPermissions="true">
        <meta-data
          android:name="android.support.FILE_PROVIDER_PATHS"
          android:resource="@xml/file_viewer_provider_paths"
        />
      </provider>

Library is linked as directed in the docs. In my code, after getting the response object returned by react-native-document-picker, I am passing the uri as an argument to the open method:

const resFile = await documentPicker(['images'], {maxWidth: 250}) // This is a utility method that abstracts certain implementations, but functionality is same as regular documentPicker
if (resFile) {
  FileViewer.open(resFile.uri)
    .then(() => { 
        //do something awesome here 
    })
    .catch(error => {
        console.log(error) // This bit prints out the `Failed to find configured root that contains` errors
    })
}

React Native version: 0.59.9
React Native File Viewer version: 2.0.2

Support array of files

Add an option to provide arrays with file and current index so we can swipe right/left to view files just like Files app.

Native module cannot be null

Cannot get it working with expo 36. Removing node_modules and yarn.lock file is not helping.

import FileViewer from 'react-native-file-viewer'; => Invariant Violation: Native module cannot be null.

File not open in UWP

Hi,
I tried this library for open a pdf file from react-native. My app should be support for all platform like ios,android and windows uwp also. i just tried to open a pdf file from my path. but FileViewer return error only. Here my code
const path ="C:\Users\sss\test.pdf";
FileViewer.open(path)
.then(() => {
// success
console.log("File opened successfully")
})
.catch(error => {
// error
console.log("File open error"+error)
});
}
my react-native version is 0.59.10. Could you please write a sample for windows also?..

Viewer language

When I open a pdf in the left top there is a button with the text "Done" that its like, close or go back, is there anyway I can change that text? I need it in another language, at first I thought it was reading device language, but it isnt

The file could not be accessed (Android)

All about Android. I've downloaded a pdf file to a device storage. Next call:
FileViewer.open(filelPath, { showOpenWithDialog: true, showAppsSuggestions: true })
It shows 'Open with' menu with suggested Adobe Acrobat which is correct.
However, when I tap open with Adobe Acrobat it show an error:
This file could not be accessed, Check the location or the network and try again
Could someone help me with that ?

Error opening file on android

Hello, I'm trying to open a file on android but this is showing up inside catch...

image

My code:

  const decodedData = (Here goes a decoded Base64 string)
  const file = 'test.pdf'
  const dest = `${RNFS.DocumentDirectoryPath}/${file}`

  RNFS.writeFile(dest, decodedData)
    .then(() => {
      console.info('File saved', dest)
    })
    .catch(err => {
      console.info(err.message, err.code)
    })

  RNFS.copyFileAssets(file, dest)
    .then(() => FileViewer.open(dest))
    .then(() => {
      console.info('Success')
    })
    .catch(_err => {
      console.info(_err)
    })

Callback/listener for when viewer is dismissed

Hi, great library.

We need to be able to detect when the user has dismissed the file viewer. Would it be possible to add a callback/listener that we can use to detect when that happens and the control returns to the main app?

Error migrating to AndroidX

Hi,
I using this great library and I was trying to migrate my react native project to AndroidX but the following error is show:

Error:
package android.support.v4.content does not exist

In the file:
android\src\main\java\com\vinzscam\reactnativefileviewer\RNFileViewerModule.java

Line:
8

Do you know when I will be able to use this library with AndroidX?

Thanks.

Android gradle assembleRelease error

Hi,

I already did manuel link and everything. But i am getting error when try to use command
./gradlew assembleRelease

I ve do it with ios without issue already send my version to testflight. However with android i am getting this error with stacktrace

/Users/gurcanyavuz/Documents/_GurcanCalismalar/Tanbula/Tanbula/node_modules/react-native-file-viewer/android/build/intermediates/res/compiled/release/drawable-hdpi-v4_notification_bg_low_normal.9.png.flat\ -R\ /Users/gurcanyavuz/Documents/_GurcanCalismalar/Tanbula/Tanbula/node_modules/react-native-file-viewer/android/build/intermediates/res/compiled/release/values-ja_values-ja.arsc.flat\ -R\ /Users/gurcanyavuz/Documents/_GurcanCalismalar/Tanbula/Tanbula/node_modules/react-native-file-viewer/android/build/intermediates/res/compiled/release/drawable-v23_abc_control_background_material.xml.flat\ -R\ /Users/gurcanyavuz/Documents/_GurcanCalismalar/Tanbula/Tanbula/node_modules/react-native-file-viewer/android/build/intermediates/res/compiled/release/xml_preferences.xml.flat\ -R\ /Users/gurcanyavuz/Documents/_GurcanCalismalar/Tanbula/Tanbula/node_modules/react-native-file-viewer/android/build/intermediates/res/compiled/release/drawable-xhdpi-v4_notification_bg_normal_pressed.9.png.flat\ -R\ /Users/gurcanyavuz/Documents/_GurcanCalismalar/Tanbula/Tanbula/node_modules/react-native-file-viewer/android/build/intermediates/res/compiled/release/drawable-xhdpi-v4_abc_ic_menu_selectall_mtrl_alpha.png.flat\ --auto-add-overlay\ --non-final-ids\ -0\ apk\ --no-version-vectors Daemon: AAPT2 aapt2-3.2.1-4818971-osx Daemon #0 at com.android.builder.internal.aapt.v2.Aapt2DaemonImpl.doLink(Aapt2DaemonImpl.kt:177) at com.android.builder.internal.aapt.v2.Aapt2Daemon.link(Aapt2Daemon.kt:103) at com.android.builder.internal.aapt.v2.Aapt2DaemonManager$LeasedAaptDaemon.link(Aapt2DaemonManager.kt:176) at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:823) at com.android.build.gradle.internal.res.Aapt2ProcessResourcesRunnable$run$1.invoke(Aapt2ProcessResourcesRunnable.kt:34) at com.android.build.gradle.internal.res.Aapt2ProcessResourcesRunnable$run$1.invoke(Aapt2ProcessResourcesRunnable.kt:28) at com.android.build.gradle.internal.res.namespaced.Aapt2DaemonManagerService.useAaptDaemon(Aapt2DaemonManagerService.kt:71) at com.android.build.gradle.internal.res.namespaced.Aapt2DaemonManagerService.useAaptDaemon$default(Aapt2DaemonManagerService.kt:69) at com.android.build.gradle.internal.res.Aapt2ProcessResourcesRunnable.run(Aapt2ProcessResourcesRunnable.kt:33) at com.android.ide.common.workers.ExecutorServiceAdapter$submit$submission$1.run(ExecutorServiceAdapter.kt:39) ... 120 more

No Activity found to handle Intent { act=android.intent.action.VIEW }

Hi,
I got this issue while trying to open file after downloading.
RNFS.downloadFile(options).promise
.then(() => FileViewer.open(localFile))
.then(() => {
// success
console.log('successs')
})
.catch(error => {
console.log('erorrr')
// error
});
I pass the file path "/storage/emulated/0/Android/data/com.awesomegroup.ngager/files/Whitepaper_Var%20inte%20r%C3%A4dd%20f%C3%B6r%20din%20r%C3%A4dsla.pdf"
Any idea why ?

Local files

Does it work only with local files ? Can I open files by link without downloading ?

Choice of Viewer when multiple

When there is a choice of viewer, the user is offered a choice on Android devices:

image

Is it the library managing this prompt or the OS? Either way, if a user has previously said "Always" to one choice, is it possible to switch? If so how?

Can not preview the files in iOS ?

i am new to react-native i unable to preview the files after getting Uri path please help me

DocumentPicker.show({ filetype: [DocumentPickerUtil.allFiles()], },(error,res) => {

  console.log(
    res.uri,
    res.type, // mime type
    res.fileName,
    res.fileSize
 );
  if(res) {
    FileViewer.open(res.uri)
    .then(() => {

      console.log("Success")

    })
    .catch(_err => {

      console.log("Error")
    });
  }

  
});

}`

Simulator Screen Shot - iPhone X - 2019-03-22 at 12 32 23
2019-03-22 14:54:12.125034+0530 D_I_Picker[21219:7357050] [default] QLUbiquitousItemFetcher: <QLUbiquitousItemFetcher: 0x283e85ae0> could not create sandbox wrapper. Error: Error Domain=NSPOSIXErrorDomain Code=2 "couldn't issue sandbox extension com.apple.quicklook.readonly for '/file:/private/var/mobile/Containers/Data/Application/8B1B80D1-96E0-4415-9C82-7F0BC1EB4357/tmp/org.reactjs.native.example.D-I-Picker-Inbox/Jan%20to%20Feb%2021%20st%20stmt.pages': No such file or directory" UserInfo={NSDescription=couldn't issue sandbox extension com.apple.quicklook.readonly for '/file:/private/var/mobile/Containers/Data/Application/8B1B80D1-96E0-4415-9C82-7F0BC1EB4357/tmp/org.reactjs.native.example.D-I-Picker-Inbox/Jan%20to%20Feb%2021%20st%20stmt.pages': No such file or directory} #PreviewItem

Animated gifs problem

Hi,
i'm trying to display animated gif files but I can't not view this type of files.

I'm using the 1.0.5 version.

is it possible?

thanks!

Open a file from Android assets folder

I have few doc files which I want to open. They are present in assets folder. Can you assist me in how to pass the filepath in the method FileViewer.open(filepath).
Thank you.

App crash after viewer is dismissed

Hi, thanks for the library
I'm facing this issue:
When the user goes back from the viewer app (the app that was used to open the file) to the current app using the Back Button on Android, the current app crashes

Help please!

Module RNFileViewer method 'open' got 5 arguments, expected 4 error on UWP

capture

I am developing application for windows platform using react native and while using this lib, i am facing this issue.

React-native: 0.57

import React, { Component } from 'react'; import { AppRegistry, Text, View, Image, Button, Alert } from 'react-native'; import FileViewer from 'react-native-file-viewer'; import RNFS from 'react-native-fs'; var path = RNFS.DocumentDirectoryPath + '/test.txt'; componentDidMount() { FileViewer.open(path) } render() { return ( <View style={{ flex: 1, alignItems: "center", justifyContent: "center" }}> <Text>Demo</Text> </View> ) } }
and if i use this in ComponentDidMount, then it returns file content
If i use this, it shows content of test.txt file sucessfully
RNFS.readFile(path, 'utf8') .then((success) => { Alert.alert('FILE WRITTEN!' + success); }) .catch((err) => { Alert.alert(err.message); });
what is the problem?

Won't open file on Android

Since I upgraded gradle from 2.2.+ to 3, this package has stopped working on Android, the new onDismiss callback is being fired more or less immediately. I'm downloading the file first from a remote location to local via RNFS, then viewing the local copy. I've upgraded to the latest version of this package and RNFS, and fully relinked.

Any ideas?

Can't show file from the internet

Hello guys, I'm trying to preview a file which is served from my server.
If I open the url in the browser I can see the preview, but if I try to open it using react-native-file-viewer it doesn't show anything.
I already tried to preview another file from the internet which wasn't from my server and it worked well.
To serve the file from server I used
res.sendFile(result[0].path, {root: '.'});
from nodejs express, and to preview it:
FileViewer.open('http://'+this.props.route+'?read=true').catch(error => console.log(error));
where this.props.route is the actual route

Wrong Android java package name in Docs.

Please update docs:
import com.reactlibrary.RNFileViewerPackage; - this package doesn't exist
import com.vinzscam.reactnativefileviewer.RNFileViewerPackage; - this does...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.