vinzscam/react-native-file-viewer

File not viewing on IOS

moaIIim opened this issue · 13 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

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.

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

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

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

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

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

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

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

Same problem

we are also facing issue please help