You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using the react-modal library and tested it under React 16 beta. It throws an error when I try to close the modal.
The reason is it calls renderSubtreeIntoContainerhere and expects an instance back. But sometimes it's null, so when it's closing and it's trying to read it's state here you get a null reference error.
If you use the API like <Modal isOpen={this.state.open} /> is works, but only because the component never tries to read from this.portal. If you use it like this.state.open && <Modal /> you get the error, because it tries to read it in componentWillUnmount: https://github.com/reactjs/react-modal/blob/master/src/components/Modal.js#L132
Do you want to request a feature or report a bug?
A bug
What is the current behavior?
I am using the react-modal library and tested it under React 16 beta. It throws an error when I try to close the modal.
The reason is it calls
renderSubtreeIntoContainer
here and expects an instance back. But sometimes it's null, so when it's closing and it's trying to read it's state here you get a null reference error.If you use the API like
<Modal isOpen={this.state.open} />
is works, but only because the component never tries to read fromthis.portal
. If you use it likethis.state.open && <Modal />
you get the error, because it tries to read it incomponentWillUnmount
: https://github.com/reactjs/react-modal/blob/master/src/components/Modal.js#L132If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net or similar (template: https://jsfiddle.net/84v837e9/).
https://github.com/jlongster/fiber-modal-error
What is the expected behavior?
renderSubtreeIntoContainer
should always return an instance so this modal librarly works (it will close).Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
React 16 beta. It works in all previous versions.
The text was updated successfully, but these errors were encountered: