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) {
60
60
private var hasCustomAppearance = false
61
61
private var uiModeConfiguration: Int = Configuration .UI_MODE_NIGHT_UNDEFINED
62
62
63
- private val imageLoader = ImageLoader .Builder (context)
64
- .components {
65
- add(SvgDecoder .Factory ())
66
- }
67
- .build()
63
+ private var imageLoader: ImageLoader ? = null
68
64
69
65
init {
70
66
orientation = VERTICAL
@@ -315,6 +311,7 @@ class ReactBottomNavigationView(context: Context) : LinearLayout(context) {
315
311
316
312
@SuppressLint(" CheckResult" )
317
313
private fun getDrawable (imageSource : ImageSource , onDrawableReady : (Drawable ? ) -> Unit ) {
314
+
318
315
drawableCache[imageSource]?.let {
319
316
onDrawableReady(it)
320
317
return
@@ -335,7 +332,14 @@ class ReactBottomNavigationView(context: Context) : LinearLayout(context) {
335
332
)
336
333
.build()
337
334
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)
339
343
}
340
344
341
345
fun setBarTintColor (color : Int? ) {
@@ -458,6 +462,7 @@ class ReactBottomNavigationView(context: Context) : LinearLayout(context) {
458
462
459
463
override fun onDetachedFromWindow () {
460
464
super .onDetachedFromWindow()
461
- imageLoader.shutdown()
465
+ imageLoader?.shutdown()
466
+ imageLoader = null
462
467
}
463
468
}
You can’t perform that action at this time.
0 commit comments