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 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
If 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.
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
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 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?
renderSubtreeIntoContainershould 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.