dapi-labs / react-nice-avatar

react library for generating avatar
https://nice-avatar.wwayne.com
MIT License
1.07k stars 91 forks source link

ReactNiceAvatar not working in production #48

Closed VaneeOfficialNet closed 1 year ago

VaneeOfficialNet commented 1 year ago

Locally the package works fine in Vite React Typescript.. However, getting error with getConfig(). TypeError: propTypes$1.exports.arrayOf is not a function. (In 'propTypes$1.exports.arrayOf(propTypes$1.exports.node)', 'propTypes$1.exports.arrayOf' is undefined)

wwayne commented 1 year ago

is it because of the propTypes's version? the error message looks the arrayOf if not a funciton, but this lib is not using arrayOf in any places, no idea to be honest

jzombie commented 1 year ago

I had this issue myself and if I can remember correctly it is because this library literally exports the wrong component types for some of the components.

I wound up just copying the source code into my project instead, fixing some silly bugs like one of the male avatars only being able to have one hair style or color.

wwayne commented 1 year ago

Hi @VaneeOfficialNet I tried myself with vite+react+ts, but I don't get any errors in both dev and preview, any attributes you passed into the genConfig?

My local testing simply is:

import './App.css'

import Avatar, { genConfig } from 'react-nice-avatar'

function App() {
  const config = genConfig() 

  return (
    <>
      <Avatar style={{ width: '8rem', height: '8rem' }} {...config} />
    </>
  )
}

export default App