From 574d8d63f1da35615fcb54696fa48527533bd5fa Mon Sep 17 00:00:00 2001 From: Johan Kasperi Date: Fri, 21 Feb 2025 10:27:54 +0100 Subject: [PATCH 1/2] fix: shutdown ImageLoader when onDropViewInstance --- .../android/src/main/java/com/rcttabview/RCTTabView.kt | 9 ++++----- .../android/src/newarch/RCTTabViewManager.kt | 5 +++++ .../android/src/oldarch/RCTTabViewManager.kt | 5 +++++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/packages/react-native-bottom-tabs/android/src/main/java/com/rcttabview/RCTTabView.kt b/packages/react-native-bottom-tabs/android/src/main/java/com/rcttabview/RCTTabView.kt index 0bea1c16..38a6c364 100644 --- a/packages/react-native-bottom-tabs/android/src/main/java/com/rcttabview/RCTTabView.kt +++ b/packages/react-native-bottom-tabs/android/src/main/java/com/rcttabview/RCTTabView.kt @@ -384,6 +384,10 @@ class ReactBottomNavigationView(context: Context) : LinearLayout(context) { updateTextAppearance() } + fun onDropViewInstance() { + imageLoader.shutdown() + } + private fun updateTextAppearance() { if (fontSize != null || fontFamily != null || fontWeight != null) { val menuView = bottomNavigation.getChildAt(0) as? ViewGroup ?: return @@ -455,9 +459,4 @@ class ReactBottomNavigationView(context: Context) : LinearLayout(context) { updateItems(items) uiModeConfiguration = newConfig?.uiMode ?: uiModeConfiguration } - - override fun onDetachedFromWindow() { - super.onDetachedFromWindow() - imageLoader.shutdown() - } } diff --git a/packages/react-native-bottom-tabs/android/src/newarch/RCTTabViewManager.kt b/packages/react-native-bottom-tabs/android/src/newarch/RCTTabViewManager.kt index 228e43ea..5d919760 100644 --- a/packages/react-native-bottom-tabs/android/src/newarch/RCTTabViewManager.kt +++ b/packages/react-native-bottom-tabs/android/src/newarch/RCTTabViewManager.kt @@ -43,6 +43,11 @@ class RCTTabViewManager(context: ReactApplicationContext) : } + override fun onDropViewInstance(view: ReactBottomNavigationView) { + super.onDropViewInstance(view) + view.onDropViewInstance() + } + override fun getName(): String { return tabViewImpl.getName() } diff --git a/packages/react-native-bottom-tabs/android/src/oldarch/RCTTabViewManager.kt b/packages/react-native-bottom-tabs/android/src/oldarch/RCTTabViewManager.kt index 6208b8de..1f07658e 100644 --- a/packages/react-native-bottom-tabs/android/src/oldarch/RCTTabViewManager.kt +++ b/packages/react-native-bottom-tabs/android/src/oldarch/RCTTabViewManager.kt @@ -39,6 +39,11 @@ class RCTTabViewManager(context: ReactApplicationContext) : ViewGroupManager Date: Fri, 21 Feb 2025 20:18:42 +0100 Subject: [PATCH 2/2] Create lucky-dots-cheat.md --- .changeset/lucky-dots-cheat.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/lucky-dots-cheat.md diff --git a/.changeset/lucky-dots-cheat.md b/.changeset/lucky-dots-cheat.md new file mode 100644 index 00000000..dc269f9a --- /dev/null +++ b/.changeset/lucky-dots-cheat.md @@ -0,0 +1,5 @@ +--- +"react-native-bottom-tabs": patch +--- + +fix: propery destroy image loader on Android