mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Deprecate NativeModule.onCatalystInstanceDestroy()
Summary: ## Rationale The CatalystInstance is going away after we delete the bridge. So, we should migrate away from onCatalystInstanceDestroy() to something else: invalidate(). ## Changes - Introduce the NativeModule.invalidate() cleanup hook. - Both the NativeModule and TurboModule infra now call this invalidate() method, **as opposed to** onCatalystInstanceDestroy(), to perform NativeModule cleanup. - **Is this safe?** All our NativeModules extend BaseJavaModule. BaseJavaModule.invalidate() delegates to NativeModule.onCatalystInstanceDestroy(), so NativeModules that implement onCatalystInstanceDestroy(), but not invalidate(), still have their onCatalystInstanceDestroy() method called. Changelog: [Android][Deprecated] - Deprecate NativeModule.onCatalystInstanceDestroy() for NativeModule.invalidate() Reviewed By: JoshuaGross Differential Revision: D26871001 fbshipit-source-id: e3bdfa0cf653ecbfe42791631bc6229af62f4817
This commit is contained in:
committed by
Facebook GitHub Bot
parent
d477f80113
commit
18c8417290
@@ -47,6 +47,13 @@ public interface NativeModule {
|
||||
*/
|
||||
boolean canOverrideExistingModule();
|
||||
|
||||
/** Called before {CatalystInstance#onHostDestroy} */
|
||||
/**
|
||||
* Allow NativeModule to clean up. Called before {CatalystInstance#onHostDestroy}
|
||||
*
|
||||
* @deprecated use {@link #invalidate()} instead.
|
||||
*/
|
||||
void onCatalystInstanceDestroy();
|
||||
|
||||
/** Allow NativeModule to clean up. Called before {CatalystInstance#onHostDestroy} */
|
||||
void invalidate();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user