highcharts / highcharts-react-native

Other
103 stars 79 forks source link

Unable to resolve "../highcharts-files/highcharts.hcscript" #93

Closed epfromer closed 4 years ago

epfromer commented 4 years ago

I am following the blog post at https://www.highcharts.com/blog/post/creating-mobile-charts-with-highcharts-react-native/ but am getting the following error when I connect with Expo:

Failed building JavaScript bundle. Unable to resolve "../highcharts-files/highcharts.hcscript" from "node_modules\@highcharts\highcharts-react-native\src\HighchartsModules.js"

My dependencies are:

    "@highcharts/highcharts-react-native": "^3.0.1",
    "expo": "~38.0.8",
    "expo-status-bar": "^1.0.2",
    "react": "~16.11.0",
    "react-dom": "~16.11.0",
    "react-native": "https://github.com/expo/react-native/archive/sdk-38.0.2.tar.gz",
    "react-native-unimodules": "^0.10.1",
    "react-native-web": "~0.11.7",
    "react-native-webview": "^9.4.0"
epfromer commented 4 years ago

Apologies, I didn't see the new instructions to add the .hcscript into the asset extensions section of metro.config.js. I did that, and the app launches, but on iOS I just get blank screen with the basic example.

sebastianbochan commented 4 years ago

Are you able to share your app ? Do you use ejected expo or native expo?

epfromer commented 4 years ago

Sure, it's here: https://github.com/epfromer/foo

Native expo I believe (I haven't ejected it).

sebastianbochan commented 4 years ago

Hi @epfromer, Thank you for demo, I will debug it and get back to you, tomorrow.

sebastianbochan commented 4 years ago

Hi @epfromer, I debugged your code and it looks like the alignItems: 'center' style breaks the View.

epfromer commented 4 years ago

Just confirmed you are right - not sure why. Anyway, thanks for the help.

Joshuaasare commented 4 years ago

Hi @epfromer how were you able to add the hcscript file?

sebastianbochan commented 4 years ago

You should add / edit your metro file.

Please check our docs here: https://github.com/highcharts/highcharts-react-native#installing

epfromer commented 4 years ago

I have a monorepo with Yarn Workspaces, which also requires editing the metro config file. I added the hscript asset this way:

const { createMetroConfiguration } = require('expo-yarn-workspaces')
const config = createMetroConfiguration(__dirname)
config.resolver.assetExts = [...config.resolver.assetExts, 'hcscript']
module.exports = config
Joshuaasare commented 4 years ago
Screenshot 2020-08-18 at 1 07 40 PM

That's my metro config file, i added it just like the docs recommend but still getting this error

sebastianbochan commented 4 years ago

What kind of error ? About missing .hcscript? Do you have metro-config package?

abhiburk commented 2 years ago

Even after using metro config file code I get

Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect.
This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native., js engine: hermes