Skip to content

fix: shutdown ImageLoader onDropViewInstance on android #311

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/lucky-dots-cheat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"react-native-bottom-tabs": patch
---

fix: propery destroy image loader on Android
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -455,9 +459,4 @@ class ReactBottomNavigationView(context: Context) : LinearLayout(context) {
updateItems(items)
uiModeConfiguration = newConfig?.uiMode ?: uiModeConfiguration
}

override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
imageLoader.shutdown()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ class RCTTabViewManager(context: ReactApplicationContext) : ViewGroupManager<Rea
return view
}

override fun onDropViewInstance(view: ReactBottomNavigationView) {
super.onDropViewInstance(view)
view.onDropViewInstance()
}

override fun getChildCount(parent: ReactBottomNavigationView): Int {
return tabViewImpl.getChildCount(parent)
}
Expand Down
Loading