File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed
packages/react-native-bottom-tabs/android/src/main/java/com/rcttabview Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -60,11 +60,7 @@ class ReactBottomNavigationView(context: Context) : LinearLayout(context) {
6060 private var hasCustomAppearance = false
6161 private var uiModeConfiguration: Int = Configuration .UI_MODE_NIGHT_UNDEFINED
6262
63- private val imageLoader = ImageLoader .Builder (context)
64- .components {
65- add(SvgDecoder .Factory ())
66- }
67- .build()
63+ private var imageLoader: ImageLoader ? = null
6864
6965 init {
7066 orientation = VERTICAL
@@ -315,6 +311,7 @@ class ReactBottomNavigationView(context: Context) : LinearLayout(context) {
315311
316312 @SuppressLint(" CheckResult" )
317313 private fun getDrawable (imageSource : ImageSource , onDrawableReady : (Drawable ? ) -> Unit ) {
314+
318315 drawableCache[imageSource]?.let {
319316 onDrawableReady(it)
320317 return
@@ -335,7 +332,14 @@ class ReactBottomNavigationView(context: Context) : LinearLayout(context) {
335332 )
336333 .build()
337334
338- imageLoader.enqueue(request)
335+ if (imageLoader == null ) {
336+ imageLoader = ImageLoader .Builder (context)
337+ .components {
338+ add(SvgDecoder .Factory ())
339+ }
340+ .build()
341+ }
342+ imageLoader?.enqueue(request)
339343 }
340344
341345 fun setBarTintColor (color : Int? ) {
@@ -458,6 +462,7 @@ class ReactBottomNavigationView(context: Context) : LinearLayout(context) {
458462
459463 override fun onDetachedFromWindow () {
460464 super .onDetachedFromWindow()
461- imageLoader.shutdown()
465+ imageLoader?.shutdown()
466+ imageLoader = null
462467 }
463468}
You can’t perform that action at this time.
0 commit comments