@onekeyfe/react-native-bottom-tabs 0.0.0-stage → 6.7.0-10

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.
Files changed (78) hide show
  1. package/LICENSE +46 -0
  2. package/README.md +94 -2
  3. package/android/build.gradle +119 -0
  4. package/android/gradle.properties +4 -0
  5. package/android/src/main/AndroidManifest.xml +3 -0
  6. package/android/src/main/AndroidManifestNew.xml +2 -0
  7. package/android/src/main/java/com/onekey/bottomtabs/BottomBarBlurRenderer.kt +92 -0
  8. package/android/src/main/java/com/onekey/bottomtabs/BottomTabsPackage.kt +16 -0
  9. package/android/src/main/java/com/onekey/bottomtabs/BottomTabsView.kt +1558 -0
  10. package/android/src/main/java/com/onekey/bottomtabs/BottomTabsViewManager.kt +220 -0
  11. package/android/src/main/java/com/onekey/bottomtabs/FloatingTabBarStyle.kt +50 -0
  12. package/android/src/main/java/com/onekey/bottomtabs/ImageSource.kt +86 -0
  13. package/android/src/main/java/com/onekey/bottomtabs/TabInfo.kt +13 -0
  14. package/android/src/main/java/com/onekey/bottomtabs/Utils.kt +31 -0
  15. package/android/src/main/java/com/onekey/bottomtabs/events/OnNativeLayoutEvent.kt +20 -0
  16. package/android/src/main/java/com/onekey/bottomtabs/events/OnTabBarMeasuredEvent.kt +19 -0
  17. package/android/src/main/java/com/onekey/bottomtabs/events/PageSelectedEvent.kt +21 -0
  18. package/android/src/main/java/com/onekey/bottomtabs/events/TabDoublePressEvent.kt +19 -0
  19. package/common/cpp/react/renderer/components/RNBottomTabs/RNBottomTabsViewComponentDescriptor.h +32 -0
  20. package/common/cpp/react/renderer/components/RNBottomTabs/RNBottomTabsViewShadowNode.cpp +18 -0
  21. package/common/cpp/react/renderer/components/RNBottomTabs/RNBottomTabsViewShadowNode.h +35 -0
  22. package/common/cpp/react/renderer/components/RNBottomTabs/RNBottomTabsViewState.cpp +15 -0
  23. package/common/cpp/react/renderer/components/RNBottomTabs/RNBottomTabsViewState.h +25 -0
  24. package/docs/SPEC.md +168 -0
  25. package/ios/Extensions.swift +46 -0
  26. package/ios/RCTBottomAccessoryComponentView.h +12 -0
  27. package/ios/RCTBottomAccessoryComponentView.mm +67 -0
  28. package/ios/RCTBottomAccessoryContainerView.swift +51 -0
  29. package/ios/RCTBottomTabsComponentView.h +12 -0
  30. package/ios/RCTBottomTabsComponentView.mm +338 -0
  31. package/ios/RCTBottomTabsContainerView.swift +777 -0
  32. package/ios/RCTBottomTabsLog.h +7 -0
  33. package/ios/RCTBottomTabsLog.m +32 -0
  34. package/ios/SVG/CoreSVG.h +13 -0
  35. package/ios/SVG/CoreSVG.mm +177 -0
  36. package/ios/SVG/SvgDecoder.h +10 -0
  37. package/ios/SVG/SvgDecoder.mm +32 -0
  38. package/ios/TabBarFontSize.swift +55 -0
  39. package/lib/module/BottomAccessoryView.js +45 -0
  40. package/lib/module/BottomAccessoryViewNativeComponent.ts +27 -0
  41. package/lib/module/BottomTabs.js +325 -0
  42. package/lib/module/BottomTabsNativeComponent.ts +70 -0
  43. package/lib/module/DelayedFreeze.js +31 -0
  44. package/lib/module/NativeSVGDecoder.js +5 -0
  45. package/lib/module/SceneMap.js +28 -0
  46. package/lib/module/codegen-types.d.js +2 -0
  47. package/lib/module/index.js +20 -0
  48. package/lib/module/package.json +1 -0
  49. package/lib/module/types.js +4 -0
  50. package/lib/module/utils/BottomTabBarHeightContext.js +5 -0
  51. package/lib/module/utils/useBottomTabBarHeight.js +12 -0
  52. package/lib/typescript/package.json +1 -0
  53. package/lib/typescript/src/BottomAccessoryView.d.ts +8 -0
  54. package/lib/typescript/src/BottomAccessoryViewNativeComponent.d.ts +16 -0
  55. package/lib/typescript/src/BottomTabs.d.ts +209 -0
  56. package/lib/typescript/src/BottomTabsNativeComponent.d.ts +59 -0
  57. package/lib/typescript/src/DelayedFreeze.d.ts +9 -0
  58. package/lib/typescript/src/NativeSVGDecoder.d.ts +6 -0
  59. package/lib/typescript/src/SceneMap.d.ts +10 -0
  60. package/lib/typescript/src/index.d.ts +16 -0
  61. package/lib/typescript/src/types.d.ts +29 -0
  62. package/lib/typescript/src/utils/BottomTabBarHeightContext.d.ts +3 -0
  63. package/lib/typescript/src/utils/useBottomTabBarHeight.d.ts +2 -0
  64. package/package.json +117 -4
  65. package/react-native-bottom-tabs.podspec +36 -0
  66. package/react-native.config.js +13 -0
  67. package/src/BottomAccessoryView.tsx +58 -0
  68. package/src/BottomAccessoryViewNativeComponent.ts +27 -0
  69. package/src/BottomTabs.tsx +559 -0
  70. package/src/BottomTabsNativeComponent.ts +70 -0
  71. package/src/DelayedFreeze.tsx +33 -0
  72. package/src/NativeSVGDecoder.ts +5 -0
  73. package/src/SceneMap.tsx +34 -0
  74. package/src/codegen-types.d.ts +28 -0
  75. package/src/index.tsx +18 -0
  76. package/src/types.ts +31 -0
  77. package/src/utils/BottomTabBarHeightContext.ts +5 -0
  78. package/src/utils/useBottomTabBarHeight.ts +15 -0
@@ -0,0 +1,28 @@
1
+ declare module 'react-native/Libraries/Types/CodegenTypes' {
2
+ import type { NativeSyntheticEvent } from 'react-native';
3
+
4
+ export type Double = number;
5
+ export type Float = number;
6
+ export type Int32 = number;
7
+ export type WithDefault<T, V> = T;
8
+ export type DirectEventHandler<T> = (
9
+ event: NativeSyntheticEvent<T>
10
+ ) => void;
11
+ export type BubblingEventHandler<T> = (
12
+ event: NativeSyntheticEvent<T>
13
+ ) => void;
14
+ }
15
+
16
+ declare module 'react-native/Libraries/Utilities/codegenNativeComponent' {
17
+ import type { HostComponent } from 'react-native';
18
+
19
+ export default function codegenNativeComponent<P>(
20
+ componentName: string,
21
+ options?: {
22
+ interfaceOnly?: boolean;
23
+ paperComponentName?: string;
24
+ paperComponentNameDeprecated?: string;
25
+ excludedPlatforms?: ReadonlyArray<'iOS' | 'android'>;
26
+ }
27
+ ): HostComponent<P>;
28
+ }
package/src/index.tsx ADDED
@@ -0,0 +1,18 @@
1
+ import BottomTabs from './BottomTabs';
2
+
3
+ /**
4
+ * Views
5
+ */
6
+ export default BottomTabs;
7
+
8
+ /**
9
+ * Utilities
10
+ */
11
+ export { SceneMap } from './SceneMap';
12
+ export { useBottomTabBarHeight } from './utils/useBottomTabBarHeight';
13
+ export { BottomTabBarHeightContext } from './utils/BottomTabBarHeightContext';
14
+
15
+ /**
16
+ * Types
17
+ */
18
+ export type { AppleIcon, TabRole } from './types';
package/src/types.ts ADDED
@@ -0,0 +1,31 @@
1
+ import type { ImageSourcePropType, StyleProp, ViewStyle } from 'react-native';
2
+ import type { SFSymbol } from 'sf-symbols-typescript';
3
+
4
+ export type IconSource = string | ImageSourcePropType;
5
+
6
+ export type AppleIcon = { sfSymbol: SFSymbol };
7
+
8
+ export type TabRole = 'search';
9
+
10
+ export type BaseRoute = {
11
+ key: string;
12
+ title?: string;
13
+ badge?: string;
14
+ badgeBackgroundColor?: string;
15
+ badgeTextColor?: string;
16
+ lazy?: boolean;
17
+ focusedIcon?: ImageSourcePropType | AppleIcon;
18
+ unfocusedIcon?: ImageSourcePropType | AppleIcon;
19
+ activeTintColor?: string;
20
+ hidden?: boolean;
21
+ testID?: string;
22
+ role?: TabRole;
23
+ freezeOnBlur?: boolean;
24
+ style?: StyleProp<ViewStyle>;
25
+ preventsDefault?: boolean;
26
+ };
27
+
28
+ export type NavigationState<Route extends BaseRoute> = {
29
+ index: number;
30
+ routes: Route[];
31
+ };
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+
3
+ export const BottomTabBarHeightContext = React.createContext<
4
+ number | undefined
5
+ >(undefined);
@@ -0,0 +1,15 @@
1
+ import * as React from 'react';
2
+
3
+ import { BottomTabBarHeightContext } from './BottomTabBarHeightContext';
4
+
5
+ export function useBottomTabBarHeight() {
6
+ const height = React.useContext(BottomTabBarHeightContext);
7
+
8
+ if (height === undefined) {
9
+ throw new Error(
10
+ "Couldn't find the bottom tab bar height. Are you inside a screen in Native Bottom Tab Navigator?"
11
+ );
12
+ }
13
+
14
+ return height;
15
+ }