From 74c9ef8fdebd57159f1839fedbe82c9f5e53263b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Norte?= Date: Mon, 26 Aug 2024 15:54:18 -0700 Subject: [PATCH] Remove incorrect state update during unmount in Modal (#46218) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/46218 Changelog: [internal] https://github.com/facebook/react-native/pull/42975 added some logic to fix modal on iOS for Paper but introduced a state update in `componentWillUnmount`. Doing this is incorrect and we've seen cases where it leads to forcing passive effects synchronously, which can affect performance. This removes that unnecessary call to update the state, because the component will be unmounted anyway. Reviewed By: bgirard Differential Revision: D61813988 fbshipit-source-id: bb203578376d86a907544fa62a0d04e93ca132ef --- packages/react-native/Libraries/Modal/Modal.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/react-native/Libraries/Modal/Modal.js b/packages/react-native/Libraries/Modal/Modal.js index 1942d9e567d..f0cb2144532 100644 --- a/packages/react-native/Libraries/Modal/Modal.js +++ b/packages/react-native/Libraries/Modal/Modal.js @@ -218,7 +218,6 @@ class Modal extends React.Component { } componentWillUnmount() { - this.setState({isRendered: false}); if (this._eventSubscription) { this._eventSubscription.remove(); }