File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed
src/components/tabController Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -231,16 +231,17 @@ class TabBar extends PureComponent {
231
231
}
232
232
} ;
233
233
234
- onItemLayout = ( { width, x } , itemIndex ) => {
234
+ onItemLayout = ( { width} , itemIndex ) => {
235
235
this . _itemsWidths [ itemIndex ] = width ;
236
- this . _itemsOffsets [ itemIndex ] = x ;
237
236
if ( ! _ . includes ( this . _itemsWidths , null ) ) {
238
237
this . setItemsLayouts ( ) ;
239
238
}
240
239
} ;
241
240
242
241
setItemsLayouts = ( ) => {
243
242
const { selectedIndex} = this . context ;
243
+ // It's important to calculate itemOffsets for RTL support
244
+ this . _itemsOffsets = _ . times ( this . _itemsWidths . length , ( i ) => _ . chain ( this . _itemsWidths ) . take ( i ) . sum ( ) . value ( ) ) ;
244
245
const itemsOffsets = _ . map ( this . _itemsOffsets , ( offset ) => offset + INDICATOR_INSET ) ;
245
246
const itemsWidths = _ . map ( this . _itemsWidths , ( width ) => width - INDICATOR_INSET * 2 ) ;
246
247
this . contentWidth = _ . sum ( this . _itemsWidths ) ;
Original file line number Diff line number Diff line change @@ -127,7 +127,7 @@ export default class TabBarItem extends PureComponent {
127
127
this . itemWidth = width ;
128
128
this . itemRef . current . setNativeProps ( { style : { width, paddingHorizontal : null , flex : null } } ) ;
129
129
if ( onLayout ) {
130
- onLayout ( { width, x } , index ) ;
130
+ onLayout ( { width} , index ) ;
131
131
}
132
132
}
133
133
} ;
You can’t perform that action at this time.
0 commit comments