Skip to content

Chart is not rendering after generating apk file and installed on mobile #130

@Gangeshwar3

Description

@Gangeshwar3

Hello,

i am using highcharts in my project,it worked well in development mode and when it is installed on mobile through apk or publish through expo, the charts are not rendering, i have done all the things adding merto.config.js, editing the method

    getAssetAsString = async (asset) => {
        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)
    }

and also edited this method:
` setLayout = async () => {
const indexHtml = Asset.fromModule(require('../highcharts-layout/index.html'))

    this.setState({
        layoutHTML: await this.getAssetAsString(indexHtml)
    })
}`

as per the comments from github issues nothing worked for me.

my package.json file
{ "main": "node_modules/expo/AppEntry.js", "scripts": { "start": "expo start", "android": "expo start --android", "ios": "expo start --ios", "web": "expo start --web", "eject": "expo eject" }, "dependencies": { "@highcharts/highcharts-react-native": "^3.1.3", "expo": "~40.0.0", "expo-status-bar": "~1.0.3", "react": "16.13.1", "react-dom": "16.13.1", "react-native": "https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz", "react-native-web": "~0.13.12", "react-native-webview": "^11.0.3", "react-select": "^3.2.0" }, "devDependencies": { "@babel/core": "~7.9.0" }, "private": true }

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: {
sourceExts,
assetExts: [...assetExts, "hcscript"]
}
};
})();`

I have created project using the command:expo init myProject.
build the project by using the command: expo build:android.

any other configuration is required to render the charts after build, any one can help on this.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions