How to catch component shutdown caused by active reboot

[edit - I thought I was using Hot Reloading, but actually I am using Live Reload)

I have a native plugin that needs to be done when cleaning every time it finishes. Basically I want to prevent these errors:

Calling JS function after bridge has been destroyed: RCTDeviceEventEmitter.emit(..) 

componentWillUnmount () is not called.

+9
source share
1 answer

A quick restart will restart the application and load the application back to the original route when the file changes. ComponentWillUnmount will not be called.

When you reboot, behind the scenes, what happens is that the reaction context is destroyed and a new one is created.

This error is generated whenever the native module tries to do the work using the old reaction context.

0
source

Source: https://habr.com/ru/post/1270876/


All Articles