|
9 | 9 | type ParamListBase, |
10 | 10 | StackActions, |
11 | 11 | type TabNavigationState, |
12 | | - useLocale, |
13 | 12 | } from '@react-navigation/native'; |
14 | 13 | import * as React from 'react'; |
15 | 14 | import { Animated, Platform, StyleSheet } from 'react-native'; |
@@ -87,8 +86,6 @@ export function BottomTabView(props: Props) { |
87 | 86 |
|
88 | 87 | const focusedRouteKey = state.routes[state.index].key; |
89 | 88 |
|
90 | | - const { direction } = useLocale(); |
91 | | - |
92 | 89 | /** |
93 | 90 | * List of loaded tabs, tabs will be loaded when navigated to. |
94 | 91 | */ |
@@ -233,24 +230,29 @@ export function BottomTabView(props: Props) { |
233 | 230 |
|
234 | 231 | const { tabBarPosition = 'bottom' } = descriptors[focusedRouteKey].options; |
235 | 232 |
|
| 233 | + const tabBarElement = ( |
| 234 | + <BottomTabBarHeightCallbackContext.Provider |
| 235 | + key="tabbar" |
| 236 | + value={setTabBarHeight} |
| 237 | + > |
| 238 | + {renderTabBar()} |
| 239 | + </BottomTabBarHeightCallbackContext.Provider> |
| 240 | + ); |
| 241 | + |
236 | 242 | return ( |
237 | 243 | <SafeAreaProviderCompat |
238 | 244 | style={{ |
239 | 245 | flexDirection: |
240 | 246 | tabBarPosition === 'left' || tabBarPosition === 'right' |
241 | | - ? (tabBarPosition === 'left' && direction === 'ltr') || |
242 | | - (tabBarPosition === 'right' && direction === 'rtl') |
243 | | - ? 'row-reverse' |
244 | | - : 'row' |
| 247 | + ? 'row' |
245 | 248 | : 'column', |
246 | 249 | }} |
247 | 250 | > |
248 | | - {tabBarPosition === 'top' ? ( |
249 | | - <BottomTabBarHeightCallbackContext.Provider value={setTabBarHeight}> |
250 | | - {renderTabBar()} |
251 | | - </BottomTabBarHeightCallbackContext.Provider> |
252 | | - ) : null} |
| 251 | + {tabBarPosition === 'top' || tabBarPosition === 'left' |
| 252 | + ? tabBarElement |
| 253 | + : null} |
253 | 254 | <MaybeScreenContainer |
| 255 | + key="screens" |
254 | 256 | enabled={detachInactiveScreens} |
255 | 257 | hasTwoStates={hasTwoStates} |
256 | 258 | style={styles.screens} |
@@ -348,11 +350,9 @@ export function BottomTabView(props: Props) { |
348 | 350 | ); |
349 | 351 | })} |
350 | 352 | </MaybeScreenContainer> |
351 | | - {tabBarPosition !== 'top' ? ( |
352 | | - <BottomTabBarHeightCallbackContext.Provider value={setTabBarHeight}> |
353 | | - {renderTabBar()} |
354 | | - </BottomTabBarHeightCallbackContext.Provider> |
355 | | - ) : null} |
| 353 | + {tabBarPosition === 'bottom' || tabBarPosition === 'right' |
| 354 | + ? tabBarElement |
| 355 | + : null} |
356 | 356 | </SafeAreaProviderCompat> |
357 | 357 | ); |
358 | 358 | } |
|
0 commit comments