Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Root component seems to not being unmounted when closing the editor [iOS only] #5755

Open
fluiddot opened this issue May 10, 2023 · 0 comments
Labels
[OS] iOS [Type] Bug Something isn't working

Comments

@fluiddot
Copy link
Contributor

Describe the bug
While working on wordpress-mobile/WordPress-iOS#20657, I noticed that the React Native root component is not being unmounted or at least the function componentWillUnmount is not being called. I understand that the component is destroyed/deallocated at some point after closing the editor, but I wanted to reflect this unexpected behavior in a GitHub issue for reference.

To Reproduce

  1. Apply the following patch:
diff --git forkSrcPrefix/packages/react-native-editor/src/index.js forkDstPrefix/packages/react-native-editor/src/index.js
index adb33b8943bdeb9e432d1bb85ee100c1363ea7fa..ca3f58fb5407b9baf27a7aa6b35edbbf8374de2e 100644
--- forkSrcPrefix/packages/react-native-editor/src/index.js
+++ forkDstPrefix/packages/react-native-editor/src/index.js
@@ -62,9 +62,14 @@ const registerGutenberg = ( {
 
 		componentDidMount() {
 			// Dispatch post-render hooks.
+			console.log( 'root tag mounted' );
 			doAction( 'native.render', this.filteredProps );
 		}
 
+		componentWillUnmount() {
+			console.log( 'root tag unmounted' );
+		}
+
 		render() {
 			return cloneElement( this.editorComponent, this.filteredProps );
 		}
  1. Open the editor.
  2. Observe in the console that the message root tag mounted is printed.
  3. Close the editor.
  4. Observe in the console that the message root tag unmounted is NOT printed.

Expected behavior
The componentWillUnmount function should be called when closing the editor.

Screenshots
N/A

Smartphone (please complete the following information):

  • Device: iPhone 11
  • OS: iOS 15.4.1
  • Version 22.3

Additional context
N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[OS] iOS [Type] Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant