Git Product home page Git Product logo

Comments (7)

PvanHengel avatar PvanHengel commented on May 23, 2024 2

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.

Infinity0106 avatar Infinity0106 commented on May 23, 2024

PR are welcome for this I tried it and failed

from react-native-highcharts.

ShMcK avatar ShMcK commented on May 23, 2024

I may be wrong, but doesn't browser caching store the libraries after the first loading regardless of the connection?

from react-native-highcharts.

PvanHengel avatar PvanHengel commented on May 23, 2024

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.

novellizator avatar novellizator commented on May 23, 2024

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.

novellizator avatar novellizator commented on May 23, 2024

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.

msevestre avatar msevestre commented on May 23, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.