File tree Expand file tree Collapse file tree 3 files changed +19
-12
lines changed
Expand file tree Collapse file tree 3 files changed +19
-12
lines changed Original file line number Diff line number Diff line change @@ -158,17 +158,22 @@ class ReactBottomNavigationView(context: Context) : BottomNavigationView(context
158158 itemRippleColor = color
159159 }
160160
161- private fun getDrawable (imageSource : ImageSource ): Drawable {
162- // TODO: Check if this can be done using some built-in React Native class
163- val imageRequest = ImageRequestBuilder .newBuilderWithSource(imageSource.uri).build()
164- val dataSource = Fresco .getImagePipeline().fetchDecodedImage(imageRequest, context)
165- val result = DataSources .waitForFinalResult(dataSource) as CloseableReference <CloseableBitmap >
166- val bitmap = result.get().underlyingBitmap
167-
168- CloseableReference .closeSafely(result)
169- dataSource.close()
161+ private fun getDrawable (imageSource : ImageSource ): Drawable ? {
162+ try {
163+ val imageRequest = ImageRequestBuilder .newBuilderWithSource(imageSource.uri).build()
164+ val dataSource = Fresco .getImagePipeline().fetchDecodedImage(imageRequest, context)
165+ val result = DataSources .waitForFinalResult(dataSource) as CloseableReference <CloseableBitmap >
166+ val bitmap = result.get().underlyingBitmap
167+
168+ CloseableReference .closeSafely(result)
169+ dataSource.close()
170+
171+ return BitmapDrawable (resources, bitmap)
172+ } catch (_: Exception ) {
173+ // Asset doesn't exist
174+ }
170175
171- return BitmapDrawable (resources, bitmap)
176+ return null
172177 }
173178
174179 override fun onDetachedFromWindow () {
Original file line number Diff line number Diff line change @@ -121,7 +121,8 @@ class RCTTabViewManager(context: ReactApplicationContext) :
121121 val bottomInset = RCTTabViewImpl .getNavigationBarInset(contextInner)
122122
123123 return YogaMeasureOutput .make(
124- toDIPFromPixel(view.measuredWidth.toFloat()),
124+ // TabBar should always stretch to the width of the screen.
125+ toDIPFromPixel(width),
125126 toDIPFromPixel(view.measuredHeight.toFloat() + bottomInset)
126127 )
127128 }
Original file line number Diff line number Diff line change @@ -143,7 +143,8 @@ class RCTTabViewManager(context: ReactApplicationContext) : SimpleViewManager<Re
143143
144144 val navigationBarInset = RCTTabViewImpl .getNavigationBarInset(themedContext)
145145 tabView.measure(spec, spec)
146- this .mWidth = tabView.measuredWidth
146+ // TabBar should always stretch to the width of the screen.
147+ this .mWidth = width.toInt()
147148 this .mHeight = tabView.measuredHeight + navigationBarInset
148149 this .mMeasured = true
149150
You can’t perform that action at this time.
0 commit comments