@momo-kits/foundation 0.92.1-rc.7 → 0.92.1-rc.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,9 +28,9 @@ import {EdgeInsets, useSafeAreaInsets} from 'react-native-safe-area-context';
28
28
  import {Radius} from '../../Consts';
29
29
  import {Icon} from '../../Icon';
30
30
  import {Text} from '../../Text';
31
+ import {FloatingButtonProps} from '../types';
31
32
  import {CurvedViewComponent} from './CurvedView';
32
33
  import {getPathUp} from './path';
33
- import {FloatingButtonProps} from '../types';
34
34
  const {width} = Dimensions.get('window');
35
35
 
36
36
  type Props = BottomTabBarProps & {
@@ -165,10 +165,10 @@ export default function BottomTabBar({
165
165
  tabStyle,
166
166
  });
167
167
  const focusedRoute = state.routes[state.index] as any;
168
- const focusedDescriptor = descriptors?.[focusedRoute.key] ?? ({} as any);
169
- const focusedOptions = focusedDescriptor.options;
168
+ const focusedDescriptor = descriptors[focusedRoute?.key] as any;
169
+ const focusedOptions = focusedDescriptor?.options;
170
170
  const shouldShowTabBar =
171
- focusedOptions.tabBarVisible !== false && !keyboardHidesTabBar;
171
+ focusedOptions?.tabBarVisible !== false && !keyboardHidesTabBar;
172
172
  const [visible] = React.useState(
173
173
  () => new Animated.Value(shouldShowTabBar ? 1 : 0),
174
174
  );
@@ -176,13 +176,13 @@ export default function BottomTabBar({
176
176
  const indicatorAnimated = React.useRef(new Animated.Value(0)).current;
177
177
 
178
178
  const visibilityAnimationConfigRef = React.useRef(
179
- focusedOptions.tabBarVisibilityAnimationConfig,
179
+ focusedOptions?.tabBarVisibilityAnimationConfig,
180
180
  );
181
181
  const onHeightChange = React.useContext(BottomTabBarHeightCallbackContext);
182
182
  const [isTabBarHidden, setIsTabBarHidden] = React.useState(!shouldShowTabBar);
183
183
  React.useEffect(() => {
184
184
  visibilityAnimationConfigRef.current =
185
- focusedOptions.tabBarVisibilityAnimationConfig;
185
+ focusedOptions?.tabBarVisibilityAnimationConfig;
186
186
  });
187
187
 
188
188
  const handleLayout = (e: LayoutChangeEvent) => {
@@ -265,7 +265,7 @@ export default function BottomTabBar({
265
265
  (data: any[]) => {
266
266
  return data?.map((route, index) => {
267
267
  const focused = route.params.name === focusedTab;
268
- const {options} = descriptors?.[route.key] ?? ({} as any);
268
+ const {options} = descriptors[route?.key] as any;
269
269
  const onPress = () => {
270
270
  const event = navigation.emit({
271
271
  type: 'tabPress',
@@ -305,7 +305,7 @@ export default function BottomTabBar({
305
305
  return (
306
306
  <NavigationContext.Provider
307
307
  key={route.key}
308
- value={(descriptors as any)?.[route.key]?.navigation}>
308
+ value={(descriptors as any)[route.key].navigation}>
309
309
  <NavigationRouteContext.Provider value={route}>
310
310
  <BottomTabBarItem
311
311
  route={route}
@@ -434,7 +434,9 @@ export default function BottomTabBar({
434
434
  {isFloating && (
435
435
  <CurvedViewComponent
436
436
  width={width}
437
- height={61 + Math.min(insets.bottom, 21)}
437
+ height={
438
+ Platform.OS == 'ios' ? 61 + Math.min(insets.bottom, 21) : 90
439
+ }
438
440
  style={styles.curved}
439
441
  bgColor="white"
440
442
  path={getPathUp(width, tabBarHeight, 50, false, 'CENTER')}
@@ -454,10 +456,9 @@ export default function BottomTabBar({
454
456
  ]}
455
457
  />
456
458
  </Animated.View>
457
-
458
- {renderTabItem(leftArr)}
459
+ {isFloating ? renderTabItem(leftArr) : renderTabItem(routes)}
459
460
  {isFloating && renderCenterComponent()}
460
- {renderTabItem(rightArr)}
461
+ {isFloating && renderTabItem(rightArr)}
461
462
  </View>
462
463
  </Animated.View>
463
464
  );
@@ -484,7 +485,7 @@ const styles = StyleSheet.create({
484
485
  alignItems: 'center',
485
486
  left: 0,
486
487
  right: 0,
487
- bottom: -6,
488
+ bottom: Platform.OS === 'ios' ? -6 : 0,
488
489
  },
489
490
  floatingContent: {
490
491
  alignItems: 'center',
@@ -4,13 +4,13 @@ import {createStackNavigator} from '@react-navigation/stack';
4
4
  import React, {useContext, useEffect} from 'react';
5
5
  import {Platform} from 'react-native';
6
6
  import {useSafeAreaInsets} from 'react-native-safe-area-context';
7
- import BottomTabBar from './BottomTabBar';
8
7
  import {Icon} from '../../Icon';
9
8
  import {Text} from '../../Text';
10
9
  import {ApplicationContext} from '../index';
11
- import {getAccessibilityID, getStackOptions} from '../utils';
12
10
  import StackScreen from '../StackScreen';
13
11
  import {BottomTabProps, NavigationScreenProps} from '../types';
12
+ import {getAccessibilityID, getStackOptions} from '../utils';
13
+ import BottomTabBar from './BottomTabBar';
14
14
 
15
15
  const Tab = createBottomTabNavigator();
16
16
  const Stack = createStackNavigator();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.92.1-rc.7",
3
+ "version": "0.92.1-rc.8",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {