react-native-file-viewer icon indicating copy to clipboard operation
react-native-file-viewer copied to clipboard

File not viewing on IOS

Open moaIIim opened this issue 4 years ago • 14 comments

Hey there, as a test, I ran the code on the readMe for downloading and opening a file. I've used the exact code with the test link. When I open a file on iOS, it doesn't show the file itself! Screenshot 2021-10-20 at 16 10 46 I'm on an M1 Mac with the simulator running on IOS 14.5. Thanks, Omar

moaIIim avatar Oct 20 '21 15:10 moaIIim

Hi! unfortunately I couldn't reproduce the issue. I've tried to run the snippet on the same machine and simulator as you did and everything is working as expected.

The issue you're experiencing reminds me #114. I would double check that your code matches the example snippet, paying attention to specifying the correct extension for the file.

Let me know if you have something else you could share.

vinzscam avatar Oct 20 '21 21:10 vinzscam

Hey, thanks for replying! I used the exact method from the readme. here's my code:

<TouchableOpacity onPress={() => {
                        const url = 'https://github.com/vinzscam/react-native-file-viewer/raw/master/docs/react-native-file-viewer-certificate.pdf';
                        const localFile = `${RNFS.DocumentDirectoryPath}/temporaryfile.pdf`;
                        
                       const options = {
                          fromUrl: url,
                          toFile: localFile
                        };
                        RNFS.downloadFile(options).promise
                        .then(() => FileViewer.open(localFile))
                        .then(() => {
                            // success
                        })
                        .catch(error => {
                            // error
                        });
                    }}>
                        <Text style={{color: colors.primary, paddingLeft: 15, fontSize: 18}}>
                            Click to view document
                        </Text>
                    </TouchableOpacity>

It doesn't show the file for some reason. Thanks, Omar

moaIIim avatar Oct 21 '21 17:10 moaIIim

Hi, have same issue with 100% valid file link. Mac with M1. Simulator - iOS 14.4 (iPhone11)

whoiandrew avatar Nov 16 '21 23:11 whoiandrew

Same! it only happens on the simulator though (iOS 14.5), on my device the file is correctly downloaded (I used react-native-blob-util) and opened in preview.

Also, on iOS 15.0 simulators the app crashes, while on iOS devices it works alright

ste7en avatar Nov 22 '21 15:11 ste7en

i have same issue. Run on IOS physical device iphone 7 ios 14.5 with local file.

namnvsskpi avatar Dec 14 '21 09:12 namnvsskpi

Any solution for this? As i am still facing the same.

shiprasharma12 avatar Dec 21 '21 05:12 shiprasharma12

Any solution for this? As i am still facing the same.

It's wrong url local file. plz remove "file://"

namnvsskpi avatar Dec 28 '21 07:12 namnvsskpi

Same problem

stefanocapitanio avatar Feb 16 '22 16:02 stefanocapitanio

we are also facing issue please help

riteshgomedii99 avatar Jun 25 '22 11:06 riteshgomedii99

please check the url path is temporary path or not , Because if i'm facing this issue in document picker , Picking some files to view the file Viewer is showing few minutes the issue is document picker given response data in two url one is temporary and another one is permanent url so please check url to pass the fileViewer...

MAYILERUMPERUMAL avatar Nov 30 '23 10:11 MAYILERUMPERUMAL

I'm guess this still isn't resolved?

Earthiings avatar Mar 08 '24 17:03 Earthiings

Same problem

How did you work around this problem?

Earthiings avatar Mar 08 '24 17:03 Earthiings

please check the url path is temporary path or not , Because if i'm facing this issue in document picker , Picking some files to view the file Viewer is showing few minutes the issue is document picker given response data in two url one is temporary and another one is permanent url so please check url to pass the fileViewer...

@Earthiings for url "file:///var/mobile/Media/DCIM/106APPLE/IMG_6092.JPG" can not be preview, but copyed file url file:///private/var/mobile/Containers/Data/Application/12E9CDEF-3FB2-449E-8D4E-D1C8E6B98688/tmp/59FBE229-CD71-4646-A8A5-E1584BCD39AE.jpg can be preview

krmao avatar Mar 26 '24 09:03 krmao