Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.

preact-compat breaks rc-dropdown and ant-design dropdown #355

Open
NickCarton opened this issue Apr 11, 2017 · 5 comments
Open

preact-compat breaks rc-dropdown and ant-design dropdown #355

NickCarton opened this issue Apr 11, 2017 · 5 comments

Comments

@NickCarton
Copy link

NickCarton commented Apr 11, 2017

I have noticed that this error is thrown when using ant-design dropdowns, which are based on rc-dropdown.

Uncaught TypeError: Cannot read property 'offsetWidth' of null at cl.afterVisibleChange (unpkg.com/antd@2.9.1/dist/antd-with-locales.js:83806) at unpkg.com/antd@2.9.1/dist/antd-with-locales.js:100420 at callback (unpkg.com/antd@2.9.1/dist/antd-with-locales.js:35087) at Object.renderSubtreeIntoContainer [as unstable_renderSubtreeIntoContainer] (preact-compat@3.14.3:173) at _renderComponent (unpkg.com/antd@2.9.1/dist/antd-with-locales.js:35084) at cl.renderComponent (unpkg.com/antd@2.9.1/dist/antd-with-locales.js:35107) at callMethod (preact-compat@3.14.3:483) at cl.renderComponent (preact-compat@3.14.3:494) at cl.componentDidUpdate (unpkg.com/antd@2.9.1/dist/antd-with-locales.js:100418) at renderComponent (preact@8.1.0:308)

You can reproduce this issue here: https://codepen.io/anon/pen/MmggqB

Does anyone know of a way I can proceed in the interim?

@developit
Copy link
Member

Ah, interesting - we could never figure out what the callback to render() was supposed to be for, and I wonder if it just needs to fire in the next tick?

@ben-pr-p
Copy link

@NickCarton Has this been fixed / have you got it working? I love preact, but I also love ant.design. It would be hype if it didn't have to be almost 1MB uglified!

@NickCarton
Copy link
Author

@ben-pr-p Last I attempted to use Preact, it wasn't working, so I switched to react-lite/react but I'm not sure if its working at the moment

@ben-pr-p
Copy link

@NickCarton could you share your babel / webpack config of a recent project using react-lite and ant-design? I'm running into this error: Lucifier129/react-lite#70, and it's not clear what the solution should be.

@NickCarton
Copy link
Author

NickCarton commented Jun 15, 2017

@ben-pr-p I use webpack merge so my config is spread amongst quite a few files, but here is all the config you should need:

webpack.config.js

resolve: {
extensions: ['.webpack-loader.js', '.web-loader.js', '.loader.js', '.ts', '.tsx', '.js', '.jsx']
alias: {
'react': 'react-lite',
'react-dom': 'react-lite'
}
},

.babelrc:

{
"plugins": [["import", {
"libraryName": "antd",
"style": true // or 'css'
}]]
}

BTW, I'm using "react-lite": "^0.15.34",

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants