React Native Environment Info:
System:
OS: macOS High Sierra 10.13.6
CPU: x64 Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
Memory: 3.66 GB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.8.0 - ~/.nvm/versions/node/v10.8.0/bin/node
Yarn: 1.9.4 - ~/.nvm/versions/node/v10.8.0/bin/yarn
npm: 6.4.0 - ~/.nvm/versions/node/v10.8.0/bin/npm
Watchman: 4.6.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 11.3, macOS 10.13, tvOS 11.3, watchOS 4.3
IDEs:
Android Studio: 3.1 AI-173.4907809
Xcode: 9.3/9E145 - /usr/bin/xcodebuild
npmPackages:
react: 16.4.2 => 16.4.2
react-native: 0.56.0 => 0.56.0
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7
I think it's a regression because I could do it in 0.55.4
I want to open a PDF file on iOS with the webview. The path is good (I checked with the terminal and I'm also able to open it with the library react-native-pdf) but I have the error on my debugger :
YellowBox.js:67 Possible Unhandled Promise Rejection (id: 0):
Error: Unable to open URL: file:///Users/rvillulles/Library/Developer/CoreSimulator/Devices/C42C1C0A-B鈥-2721-492F-966E-50B08C355DAD/Documents/EmployeeHistoryExcelReport(1).xlsx
Error: Unable to open URL: file:///Users/rvillulles/Library/Developer/CoreSimulator/Devices/C42C1C0A-B鈥-2721-492F-966E-50B08C355DAD/Documents/EmployeeHistoryExcelReport(1).xlsx
at createErrorFromErrorData (blob:file:///7737b9e3-3994-4d34-a998-d9bcdf0c3e10:2268:17)
at blob:file:///7737b9e3-3994-4d34-a998-d9bcdf0c3e10:2220:27
at MessageQueue.__invokeCallback (blob:file:///7737b9e3-3994-4d34-a998-d9bcdf0c3e10:2656:18)
at blob:file:///7737b9e3-3994-4d34-a998-d9bcdf0c3e10:2407:18
at MessageQueue.__guard (blob:file:///7737b9e3-3994-4d34-a998-d9bcdf0c3e10:2559:13)
at MessageQueue.invokeCallbackAndReturnFlushedQueue (blob:file:///7737b9e3-3994-4d34-a998-d9bcdf0c3e10:2406:14)
at t (file:///Users/rvillulles/Documents/Apps/React%20Native%20Debugger.app/Contents/Resources/app.asar/js/RNDebuggerWorker.js:1:42742)
To reproduce it exactly the same I do, you have to download a PDF file (or excel, I have the same problem) through internet and then try to open it. You should have this message.
Are you sure you are not having issue with :
From 0.56 patch notes:
Restrict WebView to only http(s) URLs: (634e7e1, 23f8f7a)
You can use originWhitelist prop to override
That was it, perfect ! Just had to add originWhitelist={["file://"]} to my webview !
Most helpful comment
That was it, perfect ! Just had to add originWhitelist={["file://"]} to my webview !