@@ -219,14 +219,26 @@ class TabBar extends PureComponent {
219
219
const itemWidth = this . _itemsWidths [ index ] ;
220
220
const screenCenter = this . containerWidth / 2 ;
221
221
222
+ let targetOffset ;
223
+
222
224
if ( itemOffset && itemWidth ) {
223
225
if ( centerSelected ) {
224
- this . tabBar . current . scrollTo ( { x : itemOffset - screenCenter + itemWidth / 2 , animated } ) ;
226
+ targetOffset = itemOffset - screenCenter + itemWidth / 2 ;
225
227
} else if ( itemOffset < this . tabBarScrollOffset ) {
226
- this . tabBar . current . scrollTo ( { x : itemOffset - itemWidth , animated } ) ;
228
+ targetOffset = itemOffset - itemWidth ;
227
229
} else if ( itemOffset + itemWidth > this . tabBarScrollOffset + this . containerWidth ) {
228
230
const offsetChange = Math . max ( 0 , itemOffset - ( this . tabBarScrollOffset + this . containerWidth ) ) ;
229
- this . tabBar . current . scrollTo ( { x : this . tabBarScrollOffset + offsetChange + itemWidth , animated} ) ;
231
+ targetOffset = this . tabBarScrollOffset + offsetChange + itemWidth ;
232
+ }
233
+
234
+ if ( ! _ . isUndefined ( targetOffset ) ) {
235
+
236
+ if ( Constants . isRTL && Constants . isAndroid ) {
237
+ const scrollingWidth = Math . max ( 0 , this . contentWidth - this . containerWidth ) ;
238
+ targetOffset = scrollingWidth - targetOffset ;
239
+ }
240
+
241
+ this . tabBar . current . scrollTo ( { x : targetOffset , animated} ) ;
230
242
}
231
243
}
232
244
} ;
@@ -254,6 +266,10 @@ class TabBar extends PureComponent {
254
266
onScroll = ( { nativeEvent : { contentOffset} } ) => {
255
267
const { fadeLeft, fadeRight} = this . state ;
256
268
this . tabBarScrollOffset = contentOffset . x ;
269
+ if ( Constants . isRTL && Constants . isAndroid ) {
270
+ const scrollingWidth = Math . max ( 0 , this . contentWidth - this . containerWidth ) ;
271
+ this . tabBarScrollOffset = scrollingWidth - this . tabBarScrollOffset ;
272
+ }
257
273
const stateUpdate = { } ;
258
274
// TODO: extract this logic to scrollbar presenter or something
259
275
const leftThreshold = 50 ;
0 commit comments