vue-advanced-chat icon indicating copy to clipboard operation
vue-advanced-chat copied to clipboard

Can't use props 'styles' in React

Open mr-teddy-bear opened this issue 2 years ago • 4 comments

Describe the bug

When i try use props "styles" from my chat, i get error "[Vue warn]: Invalid prop: type check failed for prop "styles". Expected Object, got String with value "[object Object]"."

My component image

Error in console image

My styles, which i try for use image

Please, help me)

mr-teddy-bear avatar Jul 13 '22 22:07 mr-teddy-bear

Hi, First your styles object is not correct, it should look like this:

styles="{
  general: {
    color: '#0a0a0a',
    colorSpinner: '#333',
    borderStyle: '1px solid #e1e4e8'
  },

  footer: {
    background: '#f8f9fa',
    backgroundReply: 'rgba(0, 0, 0, 0.08)'
  },

  icons: {
    search: '#9ca6af'
  }
}"

Second, you need to check this repo for React compatibility example: https://github.com/antoine92190/vue-advanced-chat-sandbox/tree/react You will need to use reactify-wc package to make it work. If you manage to make the chat work with React in a more simple way, I would be glad to know how.

antoine92190 avatar Jul 14 '22 08:07 antoine92190

Reactify-wc not working with React 17+ I can't use reactify Maybe you know other way for using 'styles', because if I use styles like in your example, it's also not worked, and i get same error about [Object object]

mr-teddy-bear avatar Jul 14 '22 09:07 mr-teddy-bear

You need to use an alternative to reactify-wc if it’s not working. I don’t know which one, but you can try to find one. Otherwise you can also change styles by overriding CSS classes

antoine92190 avatar Jul 14 '22 09:07 antoine92190

You can also check this, someone seems to have a working solution for that: https://stackoverflow.com/a/69672662

antoine92190 avatar Jul 19 '22 05:07 antoine92190

This issue will be fixed in the next migration of this plugin, which will become focused on web component only.

antoine92190 avatar Aug 13 '22 04:08 antoine92190