Comments (7)
This is quite easy, but requires you to take a couple of extra steps.
First, is you need to "import RNFS from 'react-native-fs';"
Then in your class get the absolute path to the resources folder eg:
const localPath = ${RNFS.MainBundlePath}
;
then in your script you simply modify like: "<script src="${localPath}/jquery-2.1.4.min.js"></script>"
This assumes you include the resources in the root. For my projects I typically put the helper JS in a folder such as ./app/resources. The most important part, which I'm not sure how to automate, but someone who knows how the react-native link, or the bundler, would. Is from within your xcode project, you must go to the build phases tab, and in the Copy Bundle Resources section, be sure to include the files. There are other way's you could do this as other suggest using NPM to pull down highcharts, and perhaps include it from the node_modules folder rather than in your project direct. I haven't done that though.
I use the above method for several other libraries, and custom code that we display in webviews, and it works offline as well.
Hope that helps, sorry I haven't had a chance to put it in a pull request, not sure how much help is is cause its just about a one line code change, but it depends on a few other things being done.
from react-native-highcharts.
PR are welcome for this I tried it and failed
from react-native-highcharts.
I may be wrong, but doesn't browser caching store the libraries after the first loading regardless of the connection?
from react-native-highcharts.
It might but would require a connection on startup. This way also let’s you manage your versions a little better. I’m sure the cache expires, in the end it all depends on your usecase and app user expectations.
from react-native-highcharts.
This pull request, once merged, might help. I removed dependency on jQuery.
https://github.com/TradingPal/react-native-highcharts/pull/75/files
from react-native-highcharts.
now that I think about it, theoretically you don't even need to have the scripts as assets. All you need to do is inject them via https://facebook.github.io/react-native/docs/webview.html#injectjavascript into the webview. Am I missing something?
from react-native-highcharts.
@novellizator That would be awesome if this could work without having to rely on assets at all (for jquery and also for highchart).
from react-native-highcharts.
Related Issues (20)
- Highchart 1.0.2 not rendering properly in real device in react-native 0.57.8 HOT 5
- Multiple Chart on the same View
- the events callback functions can`t do console.log(1) but can alert(1)
- High Chart is not supporting in React Native HOT 1
- Is it possible to use 'nodata' with the react native version?
- Charts not show data HOT 4
- Invalid SemVer Version HOT 2
- Is there any way of implementing Organisation chart ?
- the chart is not rendering in ios. HOT 4
- WebView has been removed from React Native. HOT 4
- charts not visible ... HOT 7
- Can't access external variables inside events.load method and I want to access all the highchart apis outside the scope, please help HOT 3
- Show loading before the charts is loaded,
- Can't use word cloud in this package
- Tooltip not showing on Android but on iOS it does.
- variablepie chart not working HOT 1
- Time and Date both are not showing on X-Axis.
- Highlight chart Organizational hierarchy
- Data Points(Marker as a SVG) do not fully render when compiling Android Build HOT 1
- Unable to sync zooming of multiple charts.Is there any choice to sync zoom of charts in React native.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-highcharts.