Skip to content
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

ios - non-expo - Failed to fetch script or layout - hcsript count not be read #122

Open
appjitsu opened this issue Dec 18, 2020 · 7 comments

Comments

@appjitsu
Copy link

image0

metro-config.js

const { getDefaultConfig } = require('metro-config');

module.exports = (async () => {
  const {
    resolver: { sourceExts, assetExts },
  } = await getDefaultConfig();

  return {
    transformer: {
      getTransformOptions: async () => ({
        transform: {
          experimentalImportSupport: false,
          inlineRequires: false,
        },
      }),
    },
    resolver: {
      assetExts: [...assetExts, 'hcscript'],
      sourceExts,
    },
  };
})();

package.json

"@highcharts/highcharts-react-native": "^3.1.2",
"react": "16.13.1",
"react-native": "0.63.3",
"react-native-webview": "^11.0.2",
@appjitsu appjitsu changed the title Failed to fetch script or layout - hcsript count not be read ios - non-expo - Failed to fetch script or layout - hcsript count not be read Dec 18, 2020
@appjitsu
Copy link
Author

appjitsu commented Dec 18, 2020

did the fixes mentioned here: #104

it works, but it would be nice to use bundled assets and not the cdn

@musangowope
Copy link

@appjitsu have u have managed to get the chart show in the ios release? if so could you show me spec u have ur package json and in HighchartsReactNative.js. my chart shows in expo but not when the apk has been generated.help would greatly appreciated

@Denyllon
Copy link
Contributor

Hi @musangowope ,

Have you also tried this one by editing the package files: #104 (comment) ?

Kind regards!

@appjitsu
Copy link
Author

I got it working for both the emulator and device with:

setLayout = async () => {
        this.setState({
            layoutHTML: '<html><head><meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0" /><style>#container{width:100%;height:100%;top:0;left:0;right:0;bottom:0;position:absolute;user-select:none;-webkit-user-select:none}*{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}</style><script>;const hcUtils={</script></head><body><div id="container"></div></body></html>'
        }) 
    }

@musangowope
Copy link

@Denyllon #104 (comment) actually worked. thanks

@sebastianbochan
Copy link
Contributor

@musangowope can we close the ticket?

@appjitsu
Copy link
Author

appjitsu commented Dec 29, 2020

im having to do this as a hack in addition to the solution in #104 (comment). if i dont do a setTimeout i still get the error randomly.

setLayout = async () => {
  setTimeout(() =>
    this.setState({
      layoutHTML: '<html><head><meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0" /><style>#container{width:100%;height:100%;top:0;left:0;right:0;bottom:0;position:absolute;user-select:none;-webkit-user-select:none}*{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}</style><script>;const hcUtils={</script></head><body><div id="container"></div></body></html>',
    })
  , 150);
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants