Golden-layout: Support React 16 New Context API

Created on 30 Mar 2018  路  8Comments  路  Source: golden-layout/golden-layout

It's related to the issue https://github.com/facebook/react/issues/12493.

The problem is in ReactComponentHandler that uses ReactDOM.unstable_renderSubtreeIntoContainer, which is an outdated method that's not supported by new features of react and, as the "maintainer" of react said, will be deprecated in the nearest future.

UPDATE: ReactComponentHandler actually uses just "render" method which does not pass context at all, so unstable_renderSubtreeIntoContainer is a fix for that, but unstable_renderSubtreeIntoContainer doesn't support new context API, so the entire approach of ReactComponentHandler need to be completely revised to using React.createPortal. instead or render or unstable_renderSubtreeIntoContainer.

Help Wanted High Priority React

Most helpful comment

I created working demonstration, so probably someone would want to use it for creating PR: https://codesandbox.io/s/kw4pro8k27

All 8 comments

*note: I'm not a creator of React, just a maintainer. :-)

you're the front-man of react, Dan, suck it up :-)

Hi, looking to use a docker framework with the latest version of React, the samples in https://golden-layout.com/tutorials/getting-started-react.html don't render right with "react": "^16.2.0" and
"react-dom": "^16.2.0"

Any chance that you can update the documentation or mention that it doesn't support v16?

Yeah I just became the maintainer of this package, and this is on my todo list.

Help would be appreciated 馃檱

I created working demonstration, so probably someone would want to use it for creating PR: https://codesandbox.io/s/kw4pro8k27

@pmunin Thanks for your script, it works fine. But there is an issue in it. The opened popout is empty. How can we fix that?

Hi all, any updates on including this fix in the package itself?

I'm still fairly new to react and am struggling to apply the patch to our current project (keep running into a registerComponent is undefined), but did come up with a workaround that works for us - essentially passing down the context contents in props, but it would be ideal to get rid of the workaround altogether.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gadget60 picture gadget60  路  7Comments

KNaved picture KNaved  路  6Comments

soh1988 picture soh1988  路  6Comments

ldetomi picture ldetomi  路  5Comments

ldetomi picture ldetomi  路  5Comments