react-navigation-reanimated-top-tabs 0.2.0

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 (131) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +26 -0
  3. package/lib/commonjs/components/ReanimatedTopTab/AnimationHelper.js +76 -0
  4. package/lib/commonjs/components/ReanimatedTopTab/AnimationHelper.js.map +1 -0
  5. package/lib/commonjs/components/ReanimatedTopTab/ReanimatedTabView.js +125 -0
  6. package/lib/commonjs/components/ReanimatedTopTab/ReanimatedTabView.js.map +1 -0
  7. package/lib/commonjs/components/ReanimatedTopTab/types.js +8 -0
  8. package/lib/commonjs/components/ReanimatedTopTab/types.js.map +1 -0
  9. package/lib/commonjs/components/elements/TabBarBaseComponent.js +71 -0
  10. package/lib/commonjs/components/elements/TabBarBaseComponent.js.map +1 -0
  11. package/lib/commonjs/components/elements/TabBarLabelBaseComponent.js +48 -0
  12. package/lib/commonjs/components/elements/TabBarLabelBaseComponent.js.map +1 -0
  13. package/lib/commonjs/components/wrappers/GestureWrapper.js +100 -0
  14. package/lib/commonjs/components/wrappers/GestureWrapper.js.map +1 -0
  15. package/lib/commonjs/components/wrappers/ScreenWrapper.js +34 -0
  16. package/lib/commonjs/components/wrappers/ScreenWrapper.js.map +1 -0
  17. package/lib/commonjs/components/wrappers/ScrollView.js +58 -0
  18. package/lib/commonjs/components/wrappers/ScrollView.js.map +1 -0
  19. package/lib/commonjs/context/TopTabContext.hooks.js +48 -0
  20. package/lib/commonjs/context/TopTabContext.hooks.js.map +1 -0
  21. package/lib/commonjs/context/TopTabContext.js +86 -0
  22. package/lib/commonjs/context/TopTabContext.js.map +1 -0
  23. package/lib/commonjs/hooks/TopTab.hooks.js +120 -0
  24. package/lib/commonjs/hooks/TopTab.hooks.js.map +1 -0
  25. package/lib/commonjs/index.js +92 -0
  26. package/lib/commonjs/index.js.map +1 -0
  27. package/lib/commonjs/navigator/createReanimatedTopTabNavigator.js +141 -0
  28. package/lib/commonjs/navigator/createReanimatedTopTabNavigator.js.map +1 -0
  29. package/lib/commonjs/types.js +8 -0
  30. package/lib/commonjs/types.js.map +1 -0
  31. package/lib/module/components/ReanimatedTopTab/AnimationHelper.js +72 -0
  32. package/lib/module/components/ReanimatedTopTab/AnimationHelper.js.map +1 -0
  33. package/lib/module/components/ReanimatedTopTab/ReanimatedTabView.js +119 -0
  34. package/lib/module/components/ReanimatedTopTab/ReanimatedTabView.js.map +1 -0
  35. package/lib/module/components/ReanimatedTopTab/types.js +4 -0
  36. package/lib/module/components/ReanimatedTopTab/types.js.map +1 -0
  37. package/lib/module/components/elements/TabBarBaseComponent.js +64 -0
  38. package/lib/module/components/elements/TabBarBaseComponent.js.map +1 -0
  39. package/lib/module/components/elements/TabBarLabelBaseComponent.js +41 -0
  40. package/lib/module/components/elements/TabBarLabelBaseComponent.js.map +1 -0
  41. package/lib/module/components/wrappers/GestureWrapper.js +94 -0
  42. package/lib/module/components/wrappers/GestureWrapper.js.map +1 -0
  43. package/lib/module/components/wrappers/ScreenWrapper.js +28 -0
  44. package/lib/module/components/wrappers/ScreenWrapper.js.map +1 -0
  45. package/lib/module/components/wrappers/ScrollView.js +52 -0
  46. package/lib/module/components/wrappers/ScrollView.js.map +1 -0
  47. package/lib/module/context/TopTabContext.hooks.js +44 -0
  48. package/lib/module/context/TopTabContext.hooks.js.map +1 -0
  49. package/lib/module/context/TopTabContext.js +82 -0
  50. package/lib/module/context/TopTabContext.js.map +1 -0
  51. package/lib/module/hooks/TopTab.hooks.js +110 -0
  52. package/lib/module/hooks/TopTab.hooks.js.map +1 -0
  53. package/lib/module/index.js +11 -0
  54. package/lib/module/index.js.map +1 -0
  55. package/lib/module/navigator/createReanimatedTopTabNavigator.js +134 -0
  56. package/lib/module/navigator/createReanimatedTopTabNavigator.js.map +1 -0
  57. package/lib/module/types.js +4 -0
  58. package/lib/module/types.js.map +1 -0
  59. package/lib/typescript/commonjs/package.json +1 -0
  60. package/lib/typescript/commonjs/src/components/ReanimatedTopTab/AnimationHelper.d.ts +11 -0
  61. package/lib/typescript/commonjs/src/components/ReanimatedTopTab/AnimationHelper.d.ts.map +1 -0
  62. package/lib/typescript/commonjs/src/components/ReanimatedTopTab/ReanimatedTabView.d.ts +14 -0
  63. package/lib/typescript/commonjs/src/components/ReanimatedTopTab/ReanimatedTabView.d.ts.map +1 -0
  64. package/lib/typescript/commonjs/src/components/ReanimatedTopTab/types.d.ts +30 -0
  65. package/lib/typescript/commonjs/src/components/ReanimatedTopTab/types.d.ts.map +1 -0
  66. package/lib/typescript/commonjs/src/components/elements/TabBarBaseComponent.d.ts +24 -0
  67. package/lib/typescript/commonjs/src/components/elements/TabBarBaseComponent.d.ts.map +1 -0
  68. package/lib/typescript/commonjs/src/components/elements/TabBarLabelBaseComponent.d.ts +8 -0
  69. package/lib/typescript/commonjs/src/components/elements/TabBarLabelBaseComponent.d.ts.map +1 -0
  70. package/lib/typescript/commonjs/src/components/wrappers/GestureWrapper.d.ts +2 -0
  71. package/lib/typescript/commonjs/src/components/wrappers/GestureWrapper.d.ts.map +1 -0
  72. package/lib/typescript/commonjs/src/components/wrappers/ScreenWrapper.d.ts +6 -0
  73. package/lib/typescript/commonjs/src/components/wrappers/ScreenWrapper.d.ts.map +1 -0
  74. package/lib/typescript/commonjs/src/components/wrappers/ScrollView.d.ts +6 -0
  75. package/lib/typescript/commonjs/src/components/wrappers/ScrollView.d.ts.map +1 -0
  76. package/lib/typescript/commonjs/src/context/TopTabContext.d.ts +4 -0
  77. package/lib/typescript/commonjs/src/context/TopTabContext.d.ts.map +1 -0
  78. package/lib/typescript/commonjs/src/context/TopTabContext.hooks.d.ts +5 -0
  79. package/lib/typescript/commonjs/src/context/TopTabContext.hooks.d.ts.map +1 -0
  80. package/lib/typescript/commonjs/src/hooks/TopTab.hooks.d.ts +33 -0
  81. package/lib/typescript/commonjs/src/hooks/TopTab.hooks.d.ts.map +1 -0
  82. package/lib/typescript/commonjs/src/index.d.ts +10 -0
  83. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  84. package/lib/typescript/commonjs/src/navigator/createReanimatedTopTabNavigator.d.ts +4 -0
  85. package/lib/typescript/commonjs/src/navigator/createReanimatedTopTabNavigator.d.ts.map +1 -0
  86. package/lib/typescript/commonjs/src/types.d.ts +56 -0
  87. package/lib/typescript/commonjs/src/types.d.ts.map +1 -0
  88. package/lib/typescript/module/package.json +1 -0
  89. package/lib/typescript/module/src/components/ReanimatedTopTab/AnimationHelper.d.ts +11 -0
  90. package/lib/typescript/module/src/components/ReanimatedTopTab/AnimationHelper.d.ts.map +1 -0
  91. package/lib/typescript/module/src/components/ReanimatedTopTab/ReanimatedTabView.d.ts +14 -0
  92. package/lib/typescript/module/src/components/ReanimatedTopTab/ReanimatedTabView.d.ts.map +1 -0
  93. package/lib/typescript/module/src/components/ReanimatedTopTab/types.d.ts +30 -0
  94. package/lib/typescript/module/src/components/ReanimatedTopTab/types.d.ts.map +1 -0
  95. package/lib/typescript/module/src/components/elements/TabBarBaseComponent.d.ts +24 -0
  96. package/lib/typescript/module/src/components/elements/TabBarBaseComponent.d.ts.map +1 -0
  97. package/lib/typescript/module/src/components/elements/TabBarLabelBaseComponent.d.ts +8 -0
  98. package/lib/typescript/module/src/components/elements/TabBarLabelBaseComponent.d.ts.map +1 -0
  99. package/lib/typescript/module/src/components/wrappers/GestureWrapper.d.ts +2 -0
  100. package/lib/typescript/module/src/components/wrappers/GestureWrapper.d.ts.map +1 -0
  101. package/lib/typescript/module/src/components/wrappers/ScreenWrapper.d.ts +6 -0
  102. package/lib/typescript/module/src/components/wrappers/ScreenWrapper.d.ts.map +1 -0
  103. package/lib/typescript/module/src/components/wrappers/ScrollView.d.ts +6 -0
  104. package/lib/typescript/module/src/components/wrappers/ScrollView.d.ts.map +1 -0
  105. package/lib/typescript/module/src/context/TopTabContext.d.ts +4 -0
  106. package/lib/typescript/module/src/context/TopTabContext.d.ts.map +1 -0
  107. package/lib/typescript/module/src/context/TopTabContext.hooks.d.ts +5 -0
  108. package/lib/typescript/module/src/context/TopTabContext.hooks.d.ts.map +1 -0
  109. package/lib/typescript/module/src/hooks/TopTab.hooks.d.ts +33 -0
  110. package/lib/typescript/module/src/hooks/TopTab.hooks.d.ts.map +1 -0
  111. package/lib/typescript/module/src/index.d.ts +10 -0
  112. package/lib/typescript/module/src/index.d.ts.map +1 -0
  113. package/lib/typescript/module/src/navigator/createReanimatedTopTabNavigator.d.ts +4 -0
  114. package/lib/typescript/module/src/navigator/createReanimatedTopTabNavigator.d.ts.map +1 -0
  115. package/lib/typescript/module/src/types.d.ts +56 -0
  116. package/lib/typescript/module/src/types.d.ts.map +1 -0
  117. package/package.json +204 -0
  118. package/src/components/ReanimatedTopTab/AnimationHelper.ts +94 -0
  119. package/src/components/ReanimatedTopTab/ReanimatedTabView.tsx +200 -0
  120. package/src/components/ReanimatedTopTab/types.ts +29 -0
  121. package/src/components/elements/TabBarBaseComponent.tsx +99 -0
  122. package/src/components/elements/TabBarLabelBaseComponent.tsx +63 -0
  123. package/src/components/wrappers/GestureWrapper.tsx +135 -0
  124. package/src/components/wrappers/ScreenWrapper.tsx +27 -0
  125. package/src/components/wrappers/ScrollView.tsx +59 -0
  126. package/src/context/TopTabContext.hooks.ts +55 -0
  127. package/src/context/TopTabContext.tsx +115 -0
  128. package/src/hooks/TopTab.hooks.ts +112 -0
  129. package/src/index.tsx +15 -0
  130. package/src/navigator/createReanimatedTopTabNavigator.tsx +192 -0
  131. package/src/types.ts +63 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReanimatedTabView.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ReanimatedTopTab/ReanimatedTabView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAiBvE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtD,MAAM,WAAW,sBAAsB;IACrC,eAAe,CAAC,EAAE,MAAM,KAAK,CAAC,SAAS,CAAC;IACxC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,eAAe,EAAE,sBAAsB,CAAC,eAAe,CAAC;IACxD,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,qBAAqB,CAAC,EAAE,sBAAsB,CAAC,qBAAqB,CAAC;IACrE,WAAW,EAAE,CAAC,MAAM,EAAE,sBAAsB,CAAC,UAAU,KAAK,KAAK,CAAC,SAAS,CAAC;IAC5E,YAAY,CAAC,EAAE,CACb,MAAM,EAAE,sBAAsB,CAAC,gBAAgB,KAC5C,KAAK,CAAC,SAAS,CAAC;CACtB;AAED,eAAO,MAAM,iBAAiB,oDA6J7B,CAAC"}
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import type { SharedValue } from 'react-native-reanimated';
3
+ export declare namespace ReanimatedTabViewTypes {
4
+ interface Route {
5
+ key: string;
6
+ name: string;
7
+ tabBarLabel?: () => React.ReactNode;
8
+ title?: string;
9
+ }
10
+ type NavigationState = {
11
+ index: number;
12
+ routes: Route[];
13
+ };
14
+ interface RenderTabsParams {
15
+ navigationState: NavigationState;
16
+ position: SharedValue<number>;
17
+ }
18
+ interface SceneProps {
19
+ jumpTo?: (key: string) => void;
20
+ route: Route;
21
+ }
22
+ interface SceneMapRoutes {
23
+ [key: string]: React.ReactNode;
24
+ }
25
+ type PositionInterpolation = {
26
+ input: number[];
27
+ output: number[];
28
+ };
29
+ }
30
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ReanimatedTopTab/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,yBAAiB,sBAAsB,CAAC;IACtC,UAAiB,KAAK;QACpB,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,CAAC,EAAE,MAAM,KAAK,CAAC,SAAS,CAAC;QACpC,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB;IAED,KAAY,eAAe,GAAG;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,KAAK,EAAE,CAAA;KAAE,CAAC;IAEjE,UAAiB,gBAAgB;QAC/B,eAAe,EAAE,eAAe,CAAC;QACjC,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;KAC/B;IAED,UAAiB,UAAU;QACzB,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;QAC/B,KAAK,EAAE,KAAK,CAAC;KACd;IAED,UAAiB,cAAc;QAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;KAChC;IAED,KAAY,qBAAqB,GAAG;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CAC3E"}
@@ -0,0 +1,24 @@
1
+ import * as React from 'react';
2
+ import { type AnimatedStyle, type SharedValue } from 'react-native-reanimated';
3
+ export interface Route {
4
+ key: string;
5
+ name?: string;
6
+ tabBarLabel?: () => React.ReactNode;
7
+ title?: string;
8
+ }
9
+ export type NavigationState = {
10
+ index: number;
11
+ routes: Route[];
12
+ };
13
+ export interface RenderTabsParams {
14
+ navigationState: NavigationState;
15
+ position: SharedValue<number>;
16
+ }
17
+ interface TabBarProps extends RenderTabsParams {
18
+ children?: React.ReactNode;
19
+ navigate: (route: Route) => void;
20
+ style?: AnimatedStyle;
21
+ }
22
+ export declare const TabBarBaseComponent: ({ children, navigate, navigationState, position, style, }: TabBarProps) => import("react/jsx-runtime").JSX.Element;
23
+ export {};
24
+ //# sourceMappingURL=TabBarBaseComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TabBarBaseComponent.d.ts","sourceRoot":"","sources":["../../../../../../src/components/elements/TabBarBaseComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAmB,EACjB,KAAK,aAAa,EAElB,KAAK,WAAW,EAEjB,MAAM,yBAAyB,CAAC;AAGjC,MAAM,WAAW,KAAK;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,KAAK,CAAC,SAAS,CAAC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,eAAe,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,KAAK,EAAE,CAAA;CAAE,CAAC;AAEjE,MAAM,WAAW,gBAAgB;IAC/B,eAAe,EAAE,eAAe,CAAC;IACjC,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC/B;AAED,UAAU,WAAY,SAAQ,gBAAgB;IAC5C,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED,eAAO,MAAM,mBAAmB,8DAM7B,WAAW,4CA8Cb,CAAC"}
@@ -0,0 +1,8 @@
1
+ interface TabBarLabelTypes {
2
+ focused: boolean;
3
+ index: number;
4
+ title: string;
5
+ }
6
+ export declare const TabBarLabelBaseComponent: ({ index, ...props }: TabBarLabelTypes) => import("react/jsx-runtime").JSX.Element;
7
+ export {};
8
+ //# sourceMappingURL=TabBarLabelBaseComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TabBarLabelBaseComponent.d.ts","sourceRoot":"","sources":["../../../../../../src/components/elements/TabBarLabelBaseComponent.tsx"],"names":[],"mappings":"AAOA,UAAU,gBAAgB;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,wBAAwB,wBAGlC,gBAAgB,4CAgClB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const GestureWrapper: ({ children }: any) => import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=GestureWrapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GestureWrapper.d.ts","sourceRoot":"","sources":["../../../../../../src/components/wrappers/GestureWrapper.tsx"],"names":[],"mappings":"AAcA,eAAO,MAAM,cAAc,iBAAkB,GAAG,4CAwH/C,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { type ViewProps } from 'react-native';
2
+ import { type AnimatedProps } from 'react-native-reanimated';
3
+ export interface ScreenWrapperProps extends AnimatedProps<Omit<ViewProps, 'onLayout'>> {
4
+ }
5
+ export declare const ScreenWrapper: ({ children, ...viewProps }: ScreenWrapperProps) => import("react/jsx-runtime").JSX.Element;
6
+ //# sourceMappingURL=ScreenWrapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScreenWrapper.d.ts","sourceRoot":"","sources":["../../../../../../src/components/wrappers/ScreenWrapper.tsx"],"names":[],"mappings":"AACA,OAAO,EAA0B,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AACtE,OAAmB,EAAE,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGzE,MAAM,WAAW,kBACf,SAAQ,aAAa,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;CAAG;AAEvD,eAAO,MAAM,aAAa,+BAGvB,kBAAkB,4CAepB,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { type ScrollViewProps } from 'react-native';
2
+ import { type AnimatedProps } from 'react-native-reanimated';
3
+ export interface ScreenWrapperProps extends AnimatedProps<Omit<ScrollViewProps, 'onScroll'>> {
4
+ }
5
+ export declare const ScrollView: ({ children, style, ...props }: ScreenWrapperProps) => import("react/jsx-runtime").JSX.Element;
6
+ //# sourceMappingURL=ScrollView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScrollView.d.ts","sourceRoot":"","sources":["../../../../../../src/components/wrappers/ScrollView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,eAAe,EAErB,MAAM,cAAc,CAAC;AAEtB,OAAmB,EAAE,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAUzE,MAAM,WAAW,kBACf,SAAQ,aAAa,CAAC,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;CAAG;AAE7D,eAAO,MAAM,UAAU,kCAIpB,kBAAkB,4CA6BpB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { type ReanimatedTopTabNavigation } from '../types';
2
+ export declare const Context: import("react").Context<ReanimatedTopTabNavigation.ContextType>;
3
+ export declare const Provider: import("react").MemoExoticComponent<({ children, config, screenProperties, }: ReanimatedTopTabNavigation.TopTabContextProps) => import("react/jsx-runtime").JSX.Element>;
4
+ //# sourceMappingURL=TopTabContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TopTabContext.d.ts","sourceRoot":"","sources":["../../../../../src/context/TopTabContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,UAAU,CAAC;AAY3D,eAAO,MAAM,OAAO,iEAEnB,CAAC;AAEF,eAAO,MAAM,QAAQ,gFAKhB,0BAA0B,CAAC,kBAAkB,6CA6FjD,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { ReanimatedTopTabNavigation } from 'react-navigation-reanimated-top-tabs';
2
+ export declare const TopTabContextHooks: {
3
+ useResetApproachingScreenScrollOffset: ({ screenRefs, transformationX, screenProperties, currentYPosition, }: Pick<ReanimatedTopTabNavigation.ContextType, "screenRefs" | "screenProperties" | "currentYPosition" | "transformationX">) => void;
4
+ };
5
+ //# sourceMappingURL=TopTabContext.hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TopTabContext.hooks.d.ts","sourceRoot":"","sources":["../../../../../src/context/TopTabContext.hooks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAmDvF,eAAO,MAAM,kBAAkB;kHA5C5B,IAAI,CACL,0BAA0B,CAAC,WAAW,EACtC,YAAY,GAAG,kBAAkB,GAAG,kBAAkB,GAAG,iBAAiB,CAC3E;CA2CA,CAAC"}
@@ -0,0 +1,33 @@
1
+ export declare const useTabContext: () => import("..").ReanimatedTopTabNavigation.ContextType;
2
+ export declare const useScreenGesture: () => import("react-native-gesture-handler/lib/typescript/handlers/gestures/nativeGesture").NativeGesture;
3
+ export declare const useScreenScrollable: () => {
4
+ animatedProps: Partial<{
5
+ scrollEnabled: boolean;
6
+ }>;
7
+ bounces: boolean;
8
+ contentContainerStyle: {
9
+ paddingBottom: number;
10
+ };
11
+ onScroll: import("react-native-reanimated").ScrollHandlerProcessed<Record<string, unknown>>;
12
+ style: {
13
+ minHeight: number;
14
+ };
15
+ };
16
+ export declare const useScreenProperties: () => {
17
+ innerLayout: import("react-native-reanimated").SharedValue<import("react-native").LayoutRectangle>;
18
+ nativeGesture: import("react-native-gesture-handler").NativeGesture;
19
+ outerLayout: import("react-native-reanimated").SharedValue<import("react-native").LayoutRectangle>;
20
+ scrollY: import("react-native-reanimated").SharedValue<number>;
21
+ };
22
+ export declare const useHeader: () => {
23
+ hideHeader: () => void;
24
+ };
25
+ export declare const useScreenRefs: (keys: string[]) => {
26
+ setRef: (key: string, ref: any) => void;
27
+ refs: {
28
+ current: Record<string, {
29
+ current: any;
30
+ }>;
31
+ };
32
+ };
33
+ //# sourceMappingURL=TopTab.hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TopTab.hooks.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/TopTab.hooks.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,aAAa,2DAA4B,CAAC;AAEvD,eAAO,MAAM,gBAAgB,2GAS5B,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;CAgD/B,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;CAO/B,CAAC;AAEF,eAAO,MAAM,SAAS;;CAQrB,CAAC;AAEF,eAAO,MAAM,aAAa,SAAU,MAAM,EAAE;kBAWrB,MAAM,OAAO,GAAG;;;qBAJD,GAAG;;;CASxC,CAAC"}
@@ -0,0 +1,10 @@
1
+ export { Provider, Context } from './context/TopTabContext';
2
+ export { createReanimatedTopTabNavigator } from './navigator/createReanimatedTopTabNavigator';
3
+ export { ScrollView } from './components/wrappers/ScrollView';
4
+ export { ScreenWrapper } from './components/wrappers/ScreenWrapper';
5
+ export { GestureWrapper } from './components/wrappers/GestureWrapper';
6
+ export { TabBarBaseComponent } from './components/elements/TabBarBaseComponent';
7
+ export { TabBarLabelBaseComponent } from './components/elements/TabBarLabelBaseComponent';
8
+ export { useTabContext, useHeader, useScreenProperties, useScreenScrollable, useScreenGesture, } from './hooks/TopTab.hooks';
9
+ export { type ReanimatedTopTabNavigation } from './types';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,+BAA+B,EAAE,MAAM,6CAA6C,CAAC;AAC9F,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AAC1F,OAAO,EACL,aAAa,EACb,SAAS,EACT,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { type ParamListBase, type TabNavigationState } from '@react-navigation/native';
2
+ import { type ReanimatedTopTabNavigation } from '../types';
3
+ export declare const createReanimatedTopTabNavigator: <Params extends ParamListBase>() => import("@react-navigation/core").TypedNavigator<ParamListBase, TabNavigationState<Params>, ReanimatedTopTabNavigation.NavigationOptions, {}, ({ HeaderComponent, TabBarComponent, children, config, initialRouteName, screenOptions, }: ReanimatedTopTabNavigation.TabViewNavigatorProps) => import("react/jsx-runtime").JSX.Element>;
4
+ //# sourceMappingURL=createReanimatedTopTabNavigator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createReanimatedTopTabNavigator.d.ts","sourceRoot":"","sources":["../../../../../src/navigator/createReanimatedTopTabNavigator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,aAAa,EAElB,KAAK,kBAAkB,EAGxB,MAAM,0BAA0B,CAAC;AAQlC,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,UAAU,CAAC;AAwK3D,eAAO,MAAM,+BAA+B,GAC1C,MAAM,SAAS,aAAa,+OAvJ3B,0BAA0B,CAAC,qBAAqB,6CA8J5B,CAAC"}
@@ -0,0 +1,56 @@
1
+ import { TabBarBaseComponent } from './components/elements/TabBarBaseComponent';
2
+ import * as React from 'react';
3
+ import { type ReactNode } from 'react';
4
+ import { type LayoutRectangle } from 'react-native';
5
+ import { type NativeGesture } from 'react-native-gesture-handler';
6
+ import { type SharedValue } from 'react-native-reanimated';
7
+ import { type StackNavigationOptions } from '@react-navigation/stack';
8
+ export declare namespace ReanimatedTopTabNavigation {
9
+ interface ContextType {
10
+ screenRefs: {
11
+ refs: {
12
+ current: Record<string, {
13
+ current: any;
14
+ }>;
15
+ };
16
+ setRef(key: string, ref: any): void;
17
+ };
18
+ closeOffset: SharedValue<number>;
19
+ config: string[];
20
+ currentScreenIndex: SharedValue<number>;
21
+ currentYPosition: SharedValue<number>;
22
+ gestureEnabled: SharedValue<boolean>;
23
+ headerHeight: SharedValue<number>;
24
+ navHeight: SharedValue<number>;
25
+ screenProperties: Record<string, {
26
+ innerLayout: SharedValue<LayoutRectangle>;
27
+ nativeGesture: NativeGesture;
28
+ outerLayout: SharedValue<LayoutRectangle>;
29
+ scrollY: SharedValue<number>;
30
+ }>;
31
+ topTabHeight: SharedValue<number>;
32
+ topTapNativeRef: NativeGesture;
33
+ transformationX: SharedValue<number>;
34
+ transformationY: SharedValue<number>;
35
+ }
36
+ interface TabViewNavigatorProps {
37
+ HeaderComponent?: React.ComponentType<Pick<ContextType, 'transformationY' | 'headerHeight'>>;
38
+ TabBarComponent?: typeof TabBarBaseComponent;
39
+ children: ReactNode;
40
+ config?: string[];
41
+ initialRouteName?: string;
42
+ screenOptions?: StackNavigationOptions;
43
+ }
44
+ type TopTabContextProps = Pick<ContextType, 'screenProperties' | 'config'> & {
45
+ children: (props: ContextType) => React.ReactNode;
46
+ };
47
+ interface NavigationOptions {
48
+ tabBarLabel?: (props: {
49
+ focused: boolean;
50
+ index: number;
51
+ title: string;
52
+ }) => React.ReactNode;
53
+ title?: string;
54
+ }
55
+ }
56
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEtE,yBAAiB,0BAA0B,CAAC;IAC1C,UAAiB,WAAW;QAC1B,UAAU,EAAE;YACV,IAAI,EAAE;gBAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE;oBAAE,OAAO,EAAE,GAAG,CAAA;iBAAE,CAAC,CAAA;aAAE,CAAC;YACpD,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,IAAI,CAAC;SACrC,CAAC;QACF,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;QACjC,MAAM,EAAE,MAAM,EAAE,CAAC;QACjB,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;QACxC,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;QACtC,cAAc,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;QACrC,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;QAClC,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;QAC/B,gBAAgB,EAAE,MAAM,CACtB,MAAM,EACN;YACE,WAAW,EAAE,WAAW,CAAC,eAAe,CAAC,CAAC;YAC1C,aAAa,EAAE,aAAa,CAAC;YAC7B,WAAW,EAAE,WAAW,CAAC,eAAe,CAAC,CAAC;YAC1C,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;SAC9B,CACF,CAAC;QACF,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;QAClC,eAAe,EAAE,aAAa,CAAC;QAC/B,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;QACrC,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;KACtC;IAED,UAAiB,qBAAqB;QACpC,eAAe,CAAC,EAAE,KAAK,CAAC,aAAa,CACnC,IAAI,CAAC,WAAW,EAAE,iBAAiB,GAAG,cAAc,CAAC,CACtD,CAAC;QACF,eAAe,CAAC,EAAE,OAAO,mBAAmB,CAAC;QAC7C,QAAQ,EAAE,SAAS,CAAC;QACpB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;QAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,aAAa,CAAC,EAAE,sBAAsB,CAAC;KACxC;IAED,KAAY,kBAAkB,GAAG,IAAI,CACnC,WAAW,EACX,kBAAkB,GAAG,QAAQ,CAC9B,GAAG;QACF,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,KAAK,CAAC,SAAS,CAAC;KACnD,CAAC;IAEF,UAAiB,iBAAiB;QAChC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE;YACpB,OAAO,EAAE,OAAO,CAAC;YACjB,KAAK,EAAE,MAAM,CAAC;YACd,KAAK,EAAE,MAAM,CAAC;SACf,KAAK,KAAK,CAAC,SAAS,CAAC;QACtB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB;CACF"}
package/package.json ADDED
@@ -0,0 +1,204 @@
1
+ {
2
+ "name": "react-navigation-reanimated-top-tabs",
3
+ "version": "0.2.0",
4
+ "description": "react-navigation-reanimated-top-tabs",
5
+ "source": "./src/index.tsx",
6
+ "main": "./lib/commonjs/index.js",
7
+ "module": "./lib/module/index.js",
8
+ "exports": {
9
+ ".": {
10
+ "import": {
11
+ "types": "./lib/typescript/module/src/index.d.ts",
12
+ "default": "./lib/module/index.js"
13
+ },
14
+ "require": {
15
+ "types": "./lib/typescript/commonjs/src/index.d.ts",
16
+ "default": "./lib/commonjs/index.js"
17
+ }
18
+ }
19
+ },
20
+ "files": [
21
+ "src",
22
+ "lib",
23
+ "android",
24
+ "ios",
25
+ "cpp",
26
+ "*.podspec",
27
+ "!ios/build",
28
+ "!android/build",
29
+ "!android/gradle",
30
+ "!android/gradlew",
31
+ "!android/gradlew.bat",
32
+ "!android/local.properties",
33
+ "!**/__tests__",
34
+ "!**/__fixtures__",
35
+ "!**/__mocks__",
36
+ "!**/.*"
37
+ ],
38
+ "scripts": {
39
+ "example": "yarn workspace react-navigation-reanimated-top-tabs-example",
40
+ "test": "jest",
41
+ "typecheck": "tsc",
42
+ "lint": "eslint \"**/*.{js,ts,tsx}\"",
43
+ "clean": "del-cli lib",
44
+ "prepare": "bob build",
45
+ "release": "release-it"
46
+ },
47
+ "keywords": [
48
+ "react-native",
49
+ "ios",
50
+ "android"
51
+ ],
52
+ "repository": {
53
+ "type": "git",
54
+ "url": "git@github.com:irion94/react-navigation-reanimated-top-tabs.git"
55
+ },
56
+ "author": "irion94 <kozub@devanddeliver.com> (https://github.com/irion94)",
57
+ "license": "MIT",
58
+ "bugs": {
59
+ "url": "https://github.com/irion94/react-navigation-reanimated-top-tabs/issues"
60
+ },
61
+ "homepage": "https://github.com/irion94/react-navigation-reanimated-top-tabs",
62
+ "publishConfig": {
63
+ "registry": "https://registry.npmjs.org/"
64
+ },
65
+ "devDependencies": {
66
+ "@commitlint/config-conventional": "^17.0.2",
67
+ "@evilmartians/lefthook": "^1.5.0",
68
+ "@react-native/eslint-config": "^0.73.1",
69
+ "@release-it/conventional-changelog": "^5.0.0",
70
+ "@types/jest": "^29.5.5",
71
+ "@types/lodash": "^4.17.10",
72
+ "@types/react": "^18.2.44",
73
+ "babel-plugin-module-resolver": "^5.0.2",
74
+ "commitlint": "^17.0.2",
75
+ "del-cli": "^5.1.0",
76
+ "eslint": "^8.51.0",
77
+ "eslint-config-prettier": "^9.0.0",
78
+ "eslint-plugin-prettier": "^5.0.1",
79
+ "jest": "^29.7.0",
80
+ "prettier": "^3.0.3",
81
+ "react": "18.2.0",
82
+ "react-native": "0.74.5",
83
+ "react-native-builder-bob": "^0.30.2",
84
+ "release-it": "^15.0.0",
85
+ "typescript": "^5.2.2"
86
+ },
87
+ "resolutions": {
88
+ "@types/react": "^18.2.44"
89
+ },
90
+ "peerDependencies": {
91
+ "@react-navigation/native": "^5.*",
92
+ "react": ">=16.8.0 || ^17.0.0 || ^18.0.0",
93
+ "react-native-reanimated": ">3.0.0",
94
+ "react-native": ">=0.60.0",
95
+ "react-native-gesture-handler": ">=2.0.0",
96
+ "react-native-safe-area-context": ">=4.0.0"
97
+ },
98
+ "workspaces": [
99
+ "example"
100
+ ],
101
+ "packageManager": "yarn@3.6.1",
102
+ "jest": {
103
+ "preset": "react-native",
104
+ "modulePathIgnorePatterns": [
105
+ "<rootDir>/example/node_modules",
106
+ "<rootDir>/lib/"
107
+ ]
108
+ },
109
+ "commitlint": {
110
+ "extends": [
111
+ "@commitlint/config-conventional"
112
+ ]
113
+ },
114
+ "release-it": {
115
+ "git": {
116
+ "commitMessage": "chore: release ${version}",
117
+ "tagName": "v${version}"
118
+ },
119
+ "npm": {
120
+ "publish": true
121
+ },
122
+ "github": {
123
+ "release": true
124
+ },
125
+ "plugins": {
126
+ "@release-it/conventional-changelog": {
127
+ "preset": "angular"
128
+ }
129
+ }
130
+ },
131
+ "eslintConfig": {
132
+ "root": true,
133
+ "extends": [
134
+ "@react-native",
135
+ "prettier"
136
+ ],
137
+ "rules": {
138
+ "react/react-in-jsx-scope": "off",
139
+ "react-hooks/exhaustive-deps": "warn",
140
+ "prettier/prettier": [
141
+ "error",
142
+ {
143
+ "quoteProps": "consistent",
144
+ "singleQuote": true,
145
+ "tabWidth": 2,
146
+ "trailingComma": "es5",
147
+ "useTabs": false
148
+ }
149
+ ]
150
+ }
151
+ },
152
+ "eslintIgnore": [
153
+ "node_modules/",
154
+ "lib/"
155
+ ],
156
+ "prettier": {
157
+ "quoteProps": "consistent",
158
+ "singleQuote": true,
159
+ "tabWidth": 2,
160
+ "trailingComma": "es5",
161
+ "useTabs": false
162
+ },
163
+ "react-native-builder-bob": {
164
+ "source": "src",
165
+ "output": "lib",
166
+ "targets": [
167
+ [
168
+ "commonjs",
169
+ {
170
+ "esm": true
171
+ }
172
+ ],
173
+ [
174
+ "module",
175
+ {
176
+ "esm": true
177
+ }
178
+ ],
179
+ [
180
+ "typescript",
181
+ {
182
+ "project": "tsconfig.build.json",
183
+ "esm": true
184
+ }
185
+ ]
186
+ ]
187
+ },
188
+ "create-react-native-library": {
189
+ "type": "library",
190
+ "version": "0.41.2"
191
+ },
192
+ "dependencies": {
193
+ "@react-navigation/elements": "^1.3.31",
194
+ "@react-navigation/native": "6.1.18",
195
+ "@react-navigation/routers": "^6.1.9",
196
+ "@react-navigation/stack": "^6.4.1",
197
+ "lodash": "^4.17.21",
198
+ "react-native-gesture-handler": "2.16.1",
199
+ "react-native-reanimated": "3.10.1",
200
+ "react-native-safe-area-context": "4.10.5",
201
+ "react-native-screens": "3.31.1",
202
+ "react-native-web": "~0.19.10"
203
+ }
204
+ }
@@ -0,0 +1,94 @@
1
+ import type {
2
+ GestureStateChangeEvent,
3
+ GestureUpdateEvent,
4
+ PanGestureChangeEventPayload,
5
+ PanGestureHandlerEventPayload,
6
+ } from 'react-native-gesture-handler';
7
+ import { withTiming as reanimatedWithTiming } from 'react-native-reanimated';
8
+ import type { ReanimatedTabViewTypes } from './types';
9
+
10
+ const onChange = (
11
+ event: GestureUpdateEvent<
12
+ PanGestureHandlerEventPayload & PanGestureChangeEventPayload
13
+ >,
14
+ animationValue: number,
15
+ width: number,
16
+ navigationState: ReanimatedTabViewTypes.NavigationState
17
+ ) => {
18
+ 'worklet';
19
+ if (animationValue > 0) {
20
+ return 0;
21
+ }
22
+ const routesLength = navigationState.routes.length - 1;
23
+ if (animationValue < -width * routesLength) {
24
+ return -width * routesLength;
25
+ }
26
+ return animationValue + event.changeX;
27
+ };
28
+
29
+ const getIndex = (
30
+ navigationState: ReanimatedTabViewTypes.NavigationState,
31
+ type: 'increment' | 'decrement'
32
+ ) => {
33
+ 'worklet';
34
+ if (type === 'increment') {
35
+ return navigationState.index === navigationState.routes.length - 1
36
+ ? navigationState.index
37
+ : navigationState.index + 1;
38
+ }
39
+ return navigationState.index === 0
40
+ ? navigationState.index
41
+ : navigationState.index - 1;
42
+ };
43
+
44
+ const onEnd = (
45
+ event: GestureStateChangeEvent<PanGestureHandlerEventPayload>,
46
+ minimumValueToChangeView: number,
47
+ width: number,
48
+ navigationState: ReanimatedTabViewTypes.NavigationState
49
+ ) => {
50
+ 'worklet';
51
+ if (event.velocityX < -200) {
52
+ return {
53
+ index: getIndex(navigationState, 'increment'),
54
+ value: -width * (navigationState.index + 1),
55
+ };
56
+ }
57
+ if (event.velocityX > 200) {
58
+ return {
59
+ index: getIndex(navigationState, 'decrement'),
60
+ value: -width * (navigationState.index - 1),
61
+ };
62
+ }
63
+ if (event.translationX < 0) {
64
+ if (event.translationX < -minimumValueToChangeView) {
65
+ return {
66
+ index: getIndex(navigationState, 'increment'),
67
+ value: -width * (navigationState.index + 1),
68
+ };
69
+ }
70
+ }
71
+ if (event.translationX > 0) {
72
+ if (event.translationX > minimumValueToChangeView) {
73
+ return {
74
+ index: getIndex(navigationState, 'decrement'),
75
+ value: -width * (navigationState.index - 1),
76
+ };
77
+ }
78
+ }
79
+ return {
80
+ index: navigationState.index,
81
+ value: -width * navigationState.index,
82
+ };
83
+ };
84
+
85
+ const animation = (newValue: number, duration = 200) => {
86
+ 'worklet';
87
+ return reanimatedWithTiming(newValue, { duration });
88
+ };
89
+
90
+ export const AnimationHelper = {
91
+ animation,
92
+ onChange,
93
+ onEnd,
94
+ };