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

[Expo] : ReferenceError: Can't find variable: Platform to import ZohoSalesIQ #80

Closed
JoseEncinoza opened this issue Feb 8, 2024 · 1 comment

Comments

@JoseEncinoza
Copy link

Hi! I'm currently having this error trying to import ZohoSalesIQ:

ReferenceError: Can't find variable: Platform

image

my Code :

import { ZohoSalesIQ } from 'react-native-zohosalesiq-mobilisten';

ZohoSales = {

    setKeys: async function () {

        let appKey = "...";
        let accessKey = "...";

        ZohoSalesIQ.initWithCallback(appKey, accessKey, (success) => {
            if (success) {
                ZohoSalesIQ.setLauncherVisibility(true);
            } else {
                console.log("Zoho Error: no se cargo chat")
            }
        });
    },

    openChat: async function () {
        console.log("Zoho: Abrimos Chat")
        ZohoSalesIQ.openChat();
    }
}
export default ZohoSales;

After a trace, the error occurs right at the import of ZohoSalesIQ:

import { ZohoSalesIQ } from 'react-native-zohosalesiq-mobilisten';

The message "ReferenceError: Can't find variable: Platform" refers to the file zohosalesiqJSWrapper.js in ./node_modules/react-native-zohosalesiq-mobilisten/components/. where it is using the following code in line 385:

if (Platform.OS === 'android') {
  Dimensions.addEventListener('change', ({ window: { width, height } }) => {
    RNZohoSalesIQ.refreshLauncherPropertiesForAndroid();
  });
}

But it fails to get the Platform from react-native as it is not being imported in this file.
By importing Platform into this file. works correctly!!

const { NativeModules, Dimensions, Platform } = require('react-native');    //No I18N

but I guess should not make this changes at the node_modules level.

thanks :)

Node: v18.17.0
npm: 9.6.7
packages:
"expo": "~50.0.5",
"react-native": "0.73.4",
"react-native-zohosalesiq-mobilisten": "^8.0.4",

@bhahirathan-mb-11956
Copy link
Collaborator

Hi @JoseEncinoza ,

Thank you for your patience. We have fixed this issue.

We recommend you update to the latest version 8.0.5, and verify. Please feel free to write back to us at (support@zohosalesiq.com) in case of any issues.

Regards,
Bhahirathan M
Zoho SalesIQ.

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

2 participants