-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not rendering in iOS release mode #104
Comments
HotfixModifiy
@Denyllon I don't understand the original flow (downloading a local file to cache folder and read that). |
@fattomhk We need to load the local highcharts-react-native/dist/src/HighchartsReactNative.js Lines 209 to 213 in 64f6d61
Could you provide us with the minimal project where the problem occurs? |
Sorry for not setting up a repo as I made this in work. Here is the minimal project.(setup ios only.) You can run there is a patch in |
@fattomhk Thank you. We will take a look on it as soon as possible. |
I have the same problem. In debug mode it works perfectly, but in realease mode I get this error message on Xcode. "Failed to fetch scripts or layout. File 'file:///Users/Vinas/Library/Developer/CoreSimulator/Devices/C375A33E-EFA3-4983-B644-2E66FFD7C5BA/data/Containers/Data/Application/868BF4A0-E28C-4C4F-9485-95D94CA0BB3C/Library/Caches/ExponentAsset-ffceb4b4585b380fc666d3882abee7e5.html' could not be read." |
Is there any update on this ticket? I'm not getting any charts on a real iOS device. (in the emulator it's fine) |
It works! |
@jenniferburch If you are rushing, you might apply my hotfix yourself or apply the patch in my google drive's zip by copying I don't understand the original flow otherwise I would create a pull request. So, if you are not rushing, you better wait for the official fix. |
This doesn't work for me. With a different but similar error message.
|
My hotfix is solving the html asset loading problem only. I think that is the same problem with the html one. a guess, haven't tried:
Btw, maybe setting |
@fattomhk Apologize for that takes so long, though unfortunately I still haven't had chance to run your project due to general overload of work this week (many things to close in other projects before going on vacation). I will get back to this issue right after back to the office (29th of September). Kind regards, and than you for your patience! |
nvm, enjoy your holiday. |
I also have this issue, and can not resolve with the above solution. |
The patch did work in my project if running from Xcode but is still broken if running through the command line, react-native run-ios, (still unable to fetch the script) but as a stop gap (and this is a SUPER hack), in src/HighChartsReactNative.js
You will also need to set useCDN={true} when you render |
What error did you get after applying the patch and set useCDN to true? |
@fattomhk error in debugger: ExceptionsManager.js:179 Failed to fetch scripts or layout. Unsupported URI scheme for 'http://localhost:8081/assets/node_modules/@highcharts/highcharts-react-native/highcharts-layout/index.html?platform=ios&hash=ffceb4b4585b380fc666d3882abee7e5' |
Hello @fattomhk @jenniferburch @zjhiphop, For example, when using the Furthermore, while I've tried to always use the path from downloaded asset As you can see, for now, we are not able to give you any perfect and universal solution, which could be applied to resolve all of reported issues. Kind regards! |
is this only happening on some versions of react native? we just updated to rn63.3, and now we are seeing this issue, but was fine on 61.2 with react-native-unimodules on 0.7.0 |
I guess that's what it comes to. Or, the |
I'm getting the same behavior here. I have tried the suggestions above. The one that worked was the "guess" comment by @fattomhk. So I applied this diff --git a/node_modules/@highcharts/highcharts-react-native/src/HighchartsReactNative.js b/node_modules/@highcharts/highcharts-react-native/src/HighchartsReactNative.js
index fabd55a..c284c26 100755
--- a/node_modules/@highcharts/highcharts-react-native/src/HighchartsReactNative.js
+++ b/node_modules/@highcharts/highcharts-react-native/src/HighchartsReactNative.js
@@ -74,15 +74,14 @@ export default class HighchartsReactNative extends React.PureComponent {
name !== 'highcharts-3d' ?
HighchartsModules.modules[name] : HighchartsModules[name]
)
- stringifiedScripts[name] = await this.getAssetAsString(script)
+ stringifiedScripts[name] = await FileSystem.readAsStringAsync(script.uri)
}
}
setLayout = async () => {
const indexHtml = Asset.fromModule(require('../highcharts-layout/index.html'))
-
this.setState({
- layoutHTML: await this.getAssetAsString(indexHtml)
+ layoutHTML: await FileSystem.readAsStringAsync(indexHtml.uri)
})
} My package.json: {
"@highcharts/highcharts-react-native": "^3.1.2",
"react": "16.13.1",
"react-native": "0.63.3",
"react-native-unimodules": "^0.11.0",
"react-native-webview": "^10.9.2",
} |
@AnthonyTailer @fattomhk I tried your solution in develop mode, it reported "Failed to fetch scripts or layout. Unsupported URI scheme for '....' '". Is there any solution could support both develop and release mode? |
Minimal code change to fix the issue and support for both dev and release mode. Just update getAssetAsString = async (asset) => {
if (!__DEV__) {
return await FileSystem.readAsStringAsync(asset.uri);
}
const downloadedModules = await FileSystem.readDirectoryAsync(FileSystem.cacheDirectory)
let fileName = 'ExponentAsset-' + asset.hash + '.' + asset.type
if (!downloadedModules.includes(fileName)) {
await asset.downloadAsync()
}
return await FileSystem.readAsStringAsync(FileSystem.cacheDirectory + fileName)
} |
You should try this one. It's working on both modes: |
I faced the problem and tried this fix this week. Thanks for saving my hours. |
Working fine. |
Hey Falas, Failed to fetch scripts or layout. Calling the 'readAsStringAsync' function has failed |
getting error:
The text was updated successfully, but these errors were encountered: