Skip to content
This repository was archived by the owner on Feb 25, 2020. It is now read-only.

Commit c8e1cd2

Browse files
committed
fix: fix issue when setting position to absolute for tab bar
1 parent b5a7a5c commit c8e1cd2

File tree

1 file changed

+33
-4
lines changed

1 file changed

+33
-4
lines changed

src/views/BottomTabBar.tsx

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -343,14 +343,45 @@ class TabBarBottom extends React.Component<BottomTabBarProps, State> {
343343
const activeBackgroundColor = this._getActiveBackgroundColor();
344344
const inactiveBackgroundColor = this._getInactiveBackgroundColor();
345345

346+
const {
347+
position,
348+
top,
349+
left = 0,
350+
bottom = 0,
351+
right = 0,
352+
margin,
353+
marginTop,
354+
marginLeft,
355+
marginBottom,
356+
marginRight,
357+
marginHorizontal,
358+
marginVertical,
359+
...innerStyle
360+
} = StyleSheet.flatten(style || {});
361+
362+
const containerStyle = {
363+
position,
364+
top,
365+
left,
366+
bottom,
367+
right,
368+
margin,
369+
marginTop,
370+
marginLeft,
371+
marginBottom,
372+
marginRight,
373+
marginHorizontal,
374+
marginVertical,
375+
};
376+
346377
const tabBarStyle = [
347378
styles.tabBar,
348379
isDark ? styles.tabBarDark : styles.tabBarLight,
349380
// @ts-ignore
350381
this._shouldUseHorizontalLabels() && !Platform.isPad
351382
? styles.tabBarCompact
352383
: styles.tabBarRegular,
353-
style,
384+
innerStyle,
354385
];
355386

356387
return (
@@ -374,6 +405,7 @@ class TabBarBottom extends React.Component<BottomTabBarProps, State> {
374405
position: this.state.keyboard ? 'absolute' : null,
375406
}
376407
: null,
408+
containerStyle,
377409
]}
378410
pointerEvents={
379411
keyboardHidesTabBar && this.state.keyboard ? 'none' : 'auto'
@@ -454,9 +486,6 @@ const styles = StyleSheet.create({
454486
borderTopColor: ThemeColors.dark.headerBorder,
455487
},
456488
container: {
457-
left: 0,
458-
right: 0,
459-
bottom: 0,
460489
elevation: 8,
461490
},
462491
tabBarCompact: {

0 commit comments

Comments
 (0)