Saranshmalik / react-native-zendesk

React native wrapper for Zendesk SDK
MIT License
29 stars 42 forks source link

Url error #6

Closed hanaechahid closed 3 years ago

hanaechahid commented 3 years ago

Screenshot_20201130-141017_IZI Check Hi @Saranshmalik , it works fine for ios but isnt in android

Saranshmalik commented 3 years ago

Feels like URL field is not being passed. Make sure the RNZendesk.init function has url key in it since its required. All the props in init function are required. If you just need chat functionality, use RNZendesk.initChat function instead

hanaechahid commented 3 years ago

but I didn't change the init function, is the same code as ios

Saranshmalik commented 3 years ago

Can you post it here?, Just hide the values or put in garbage values

hanaechahid commented 3 years ago

I initialize it in componentdidmount like this:

import RNZendesk from 'react-native-zendesk-v2'
componentDidMount(){
    RNZendesk.init({
      key: "key",
      appId: "appid",
      zendeskUrl:"url",
      clientId: "mobile_sdk_client"
    })
}

and here i start the chat in the same file:

goToChat() {
    RNZendesk.startChat({
      name: this.props.currentUser.firstName,
      email: this.props.currentUser.mail,
      phone: this.props.currentUser.phone,
      tags: ['tags'],
      department: "Your department",
      chatOnly: true
    });
  }
hanaechahid commented 3 years ago

i unlink the library, but i get new issue "Cannot read property startChat of undefined" cause RNZendesk is undefined

Saranshmalik commented 3 years ago

You don't need to unlink the library, it will cause issues. Also the exact line says the url being passed is not a string and thus causing issues. Make sure the support url is correct and type is string

hanaechahid commented 3 years ago

if the url is not correct it should not be working on ios, as I said I made one initialization and one configuration in the same file for both ios and android so i dont think the problem is using wrong url.

of linking the library, when I linked it always get url error, and when i unlink it RNZendesk always undefined

hanaechahid commented 3 years ago

I've made a mistake, I should use url instead of zendeskUrl while initialization

thank you for everything @Saranshmalik