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,110 @@
1
+ "use strict";
2
+
3
+ import { useRoute } from '@react-navigation/native';
4
+ import { Context } from "../context/TopTabContext.js";
5
+ import { useContext } from 'react';
6
+ import { useAnimatedProps, useAnimatedScrollHandler, useAnimatedStyle, useDerivedValue, withTiming } from 'react-native-reanimated';
7
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
8
+ import { useWindowDimensions } from 'react-native';
9
+ export const useTabContext = () => useContext(Context);
10
+ export const useScreenGesture = () => {
11
+ const {
12
+ key
13
+ } = useRoute();
14
+ const {
15
+ screenProperties
16
+ } = useTabContext();
17
+ const nativeRef = screenProperties[key]?.nativeGesture;
18
+ if (!nativeRef) throw 'GestureRef does not exist for this route';
19
+ return nativeRef;
20
+ };
21
+ export const useScreenScrollable = () => {
22
+ const {
23
+ key
24
+ } = useRoute();
25
+ const {
26
+ height
27
+ } = useWindowDimensions();
28
+ const {
29
+ bottom
30
+ } = useSafeAreaInsets();
31
+ const {
32
+ currentYPosition,
33
+ gestureEnabled,
34
+ headerHeight,
35
+ screenProperties,
36
+ topTabHeight,
37
+ transformationY
38
+ } = useTabContext();
39
+
40
+ //TODO: Navigation header hook is available if Tabs are rendered inside the Stack (createNavigationStack())
41
+ //useHeaderHeight();
42
+ const navigationHeader = 50;
43
+ const animatedProps = useAnimatedProps(() => ({
44
+ scrollEnabled: !gestureEnabled.value || currentYPosition.value === -headerHeight.value
45
+ }));
46
+ const onScroll = useAnimatedScrollHandler(({
47
+ contentOffset
48
+ }) => {
49
+ const scrollPosition = screenProperties[key]?.scrollY;
50
+ if (!scrollPosition) throw 'ScrollPosition property does not exist for this route';
51
+ scrollPosition.value = contentOffset.y;
52
+ });
53
+ const oppositeHeaderState = useDerivedValue(() => transformationY.value >= 0 ? headerHeight.value : 0);
54
+ const style = useAnimatedStyle(() => ({
55
+ minHeight: height - topTabHeight.value - oppositeHeaderState.value - navigationHeader
56
+ }));
57
+ return {
58
+ animatedProps,
59
+ bounces: false,
60
+ contentContainerStyle: {
61
+ paddingBottom: bottom
62
+ },
63
+ onScroll,
64
+ style
65
+ };
66
+ };
67
+ export const useScreenProperties = () => {
68
+ const {
69
+ key
70
+ } = useRoute();
71
+ const {
72
+ screenProperties
73
+ } = useTabContext();
74
+ const screen = screenProperties[key];
75
+ if (!screen) throw 'No screen properties registered for this route';
76
+ return screen;
77
+ };
78
+ export const useHeader = () => {
79
+ const {
80
+ headerHeight,
81
+ transformationX
82
+ } = useTabContext();
83
+ const hideHeader = () => {
84
+ transformationX.value = withTiming(-headerHeight.value);
85
+ };
86
+ return {
87
+ hideHeader
88
+ };
89
+ };
90
+ export const useScreenRefs = keys => {
91
+ const refs = {
92
+ current: keys.reduce((prev, key) => ({
93
+ ...prev,
94
+ [key]: {
95
+ current: null
96
+ }
97
+ }), {})
98
+ };
99
+ const setRef = (key, ref) => {
100
+ refs.current = {
101
+ ...refs.current,
102
+ [key]: ref
103
+ };
104
+ };
105
+ return {
106
+ setRef,
107
+ refs
108
+ };
109
+ };
110
+ //# sourceMappingURL=TopTab.hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useRoute","Context","useContext","useAnimatedProps","useAnimatedScrollHandler","useAnimatedStyle","useDerivedValue","withTiming","useSafeAreaInsets","useWindowDimensions","useTabContext","useScreenGesture","key","screenProperties","nativeRef","nativeGesture","useScreenScrollable","height","bottom","currentYPosition","gestureEnabled","headerHeight","topTabHeight","transformationY","navigationHeader","animatedProps","scrollEnabled","value","onScroll","contentOffset","scrollPosition","scrollY","y","oppositeHeaderState","style","minHeight","bounces","contentContainerStyle","paddingBottom","useScreenProperties","screen","useHeader","transformationX","hideHeader","useScreenRefs","keys","refs","current","reduce","prev","setRef","ref"],"sourceRoot":"../../../src","sources":["hooks/TopTab.hooks.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,0BAA0B;AACnD,SAASC,OAAO,QAAQ,6BAA0B;AAClD,SAASC,UAAU,QAAQ,OAAO;AAClC,SACEC,gBAAgB,EAChBC,wBAAwB,EACxBC,gBAAgB,EAChBC,eAAe,EACfC,UAAU,QACL,yBAAyB;AAChC,SAASC,iBAAiB,QAAQ,gCAAgC;AAClE,SAASC,mBAAmB,QAAQ,cAAc;AAElD,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAMR,UAAU,CAACD,OAAO,CAAC;AAEtD,OAAO,MAAMU,gBAAgB,GAAGA,CAAA,KAAM;EACpC,MAAM;IAAEC;EAAI,CAAC,GAAGZ,QAAQ,CAAC,CAAC;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;EAChD,CAAC;EAED,OAAO;IAAED,MAAM;IAAEJ;EAAK,CAAC;AACzB,CAAC","ignoreList":[]}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ export { Provider, Context } from "./context/TopTabContext.js";
4
+ export { createReanimatedTopTabNavigator } from "./navigator/createReanimatedTopTabNavigator.js";
5
+ export { ScrollView } from "./components/wrappers/ScrollView.js";
6
+ export { ScreenWrapper } from "./components/wrappers/ScreenWrapper.js";
7
+ export { GestureWrapper } from "./components/wrappers/GestureWrapper.js";
8
+ export { TabBarBaseComponent } from "./components/elements/TabBarBaseComponent.js";
9
+ export { TabBarLabelBaseComponent } from "./components/elements/TabBarLabelBaseComponent.js";
10
+ export { useTabContext, useHeader, useScreenProperties, useScreenScrollable, useScreenGesture } from "./hooks/TopTab.hooks.js";
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Provider","Context","createReanimatedTopTabNavigator","ScrollView","ScreenWrapper","GestureWrapper","TabBarBaseComponent","TabBarLabelBaseComponent","useTabContext","useHeader","useScreenProperties","useScreenScrollable","useScreenGesture"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,QAAQ,EAAEC,OAAO,QAAQ,4BAAyB;AAC3D,SAASC,+BAA+B,QAAQ,gDAA6C;AAC7F,SAASC,UAAU,QAAQ,qCAAkC;AAC7D,SAASC,aAAa,QAAQ,wCAAqC;AACnE,SAASC,cAAc,QAAQ,yCAAsC;AACrE,SAASC,mBAAmB,QAAQ,8CAA2C;AAC/E,SAASC,wBAAwB,QAAQ,mDAAgD;AACzF,SACEC,aAAa,EACbC,SAAS,EACTC,mBAAmB,EACnBC,mBAAmB,EACnBC,gBAAgB,QACX,yBAAsB","ignoreList":[]}
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+
3
+ import { createNavigatorFactory, TabActions, TabRouter, useNavigationBuilder } from '@react-navigation/native';
4
+ import { GestureWrapper } from "../components/wrappers/GestureWrapper.js";
5
+ import { TabBarBaseComponent } from "../components/elements/TabBarBaseComponent.js";
6
+ import { Provider } from "../context/TopTabContext.js";
7
+ import { omit } from 'lodash';
8
+ import { useCallback, useMemo, useRef } from 'react';
9
+ import { Gesture } from 'react-native-gesture-handler';
10
+ import Reanimated, { makeMutable } from 'react-native-reanimated';
11
+ import { ReanimatedTabView } from "../components/ReanimatedTopTab/ReanimatedTabView.js";
12
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
+ const TabViewNavigator = ({
14
+ HeaderComponent,
15
+ TabBarComponent = TabBarBaseComponent,
16
+ children,
17
+ config,
18
+ initialRouteName,
19
+ screenOptions = {}
20
+ }) => {
21
+ const {
22
+ NavigationContent,
23
+ descriptors,
24
+ navigation,
25
+ state
26
+ } = useNavigationBuilder(TabRouter, {
27
+ children,
28
+ defaultScreenOptions: screenOptions,
29
+ initialRouteName,
30
+ screenOptions
31
+ });
32
+ let _config = config;
33
+ if (!config) {
34
+ _config = state.routes.map(() => 'normal');
35
+ }
36
+ const screenProperties = useRef(state.routes.reduce((prev, route) => ({
37
+ ...prev,
38
+ [route.key]: {
39
+ innerLayout: makeMutable({
40
+ height: 0,
41
+ width: 0,
42
+ x: 0,
43
+ y: 0
44
+ }),
45
+ nativeGesture: Gesture.Native(),
46
+ outerLayout: makeMutable({
47
+ height: 0,
48
+ width: 0,
49
+ x: 0,
50
+ y: 0
51
+ }),
52
+ scrollY: makeMutable(0)
53
+ }
54
+ }), {})).current;
55
+ const onIndexChange = (currentScreenIndex, gestureEnabled) => index => {
56
+ navigation.navigate(state.routes[index]?.name ?? '');
57
+ currentScreenIndex.value = index;
58
+ switch (_config[index]) {
59
+ case 'normal':
60
+ {
61
+ gestureEnabled.value = true;
62
+ break;
63
+ }
64
+ case 'minimalized':
65
+ {
66
+ gestureEnabled.value = false;
67
+ break;
68
+ }
69
+ }
70
+ };
71
+ const navigationState = useMemo(() => ({
72
+ index: state.index,
73
+ routes: state.routes.map((route, index) => {
74
+ const restOptions = omit(descriptors[route.key]?.options, 'tabBarLabel');
75
+ const tabBarLabel = descriptors[route.key]?.options.tabBarLabel ? () => descriptors[route.key]?.options.tabBarLabel?.({
76
+ focused: state.index === index,
77
+ title: descriptors[route.key]?.options.title || route.name,
78
+ index
79
+ }) : undefined;
80
+ return {
81
+ ...route,
82
+ ...restOptions,
83
+ tabBarLabel,
84
+ title: descriptors[route.key]?.options.title || route.name
85
+ };
86
+ })
87
+ }), [state]);
88
+ const navigate = route => {
89
+ navigation.dispatch({
90
+ ...TabActions.jumpTo(route.name, route.params),
91
+ target: state.key
92
+ });
93
+ };
94
+ const renderTabBar = useCallback(props => /*#__PURE__*/_jsx(TabBarComponent, {
95
+ ...props,
96
+ navigate: navigate
97
+ }), []);
98
+ const renderScene = ({
99
+ route
100
+ }) => descriptors[route.key]?.render();
101
+ return /*#__PURE__*/_jsx(Provider, {
102
+ config: _config,
103
+ screenProperties: screenProperties,
104
+ children: ({
105
+ currentScreenIndex,
106
+ gestureEnabled,
107
+ headerHeight,
108
+ transformationY
109
+ }) => /*#__PURE__*/_jsxs(_Fragment, {
110
+ children: [/*#__PURE__*/_jsx(Reanimated.View, {
111
+ onLayout: ({
112
+ nativeEvent
113
+ }) => {
114
+ headerHeight.value = nativeEvent.layout.height;
115
+ },
116
+ children: HeaderComponent ? /*#__PURE__*/_jsx(HeaderComponent, {
117
+ headerHeight: headerHeight,
118
+ transformationY: transformationY
119
+ }) : null
120
+ }), /*#__PURE__*/_jsx(NavigationContent, {
121
+ children: /*#__PURE__*/_jsx(GestureWrapper, {
122
+ children: /*#__PURE__*/_jsx(ReanimatedTabView, {
123
+ navigationState: navigationState,
124
+ onIndexChange: onIndexChange(currentScreenIndex, gestureEnabled),
125
+ renderScene: renderScene,
126
+ renderTabBar: renderTabBar
127
+ })
128
+ })
129
+ })]
130
+ })
131
+ });
132
+ };
133
+ export const createReanimatedTopTabNavigator = () => createNavigatorFactory(TabViewNavigator)();
134
+ //# sourceMappingURL=createReanimatedTopTabNavigator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createNavigatorFactory","TabActions","TabRouter","useNavigationBuilder","GestureWrapper","TabBarBaseComponent","Provider","omit","useCallback","useMemo","useRef","Gesture","Reanimated","makeMutable","ReanimatedTabView","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","TabViewNavigator","HeaderComponent","TabBarComponent","children","config","initialRouteName","screenOptions","NavigationContent","descriptors","navigation","state","defaultScreenOptions","_config","routes","map","screenProperties","reduce","prev","route","key","innerLayout","height","width","x","y","nativeGesture","Native","outerLayout","scrollY","current","onIndexChange","currentScreenIndex","gestureEnabled","index","navigate","name","value","navigationState","restOptions","options","tabBarLabel","focused","title","undefined","dispatch","jumpTo","params","target","renderTabBar","props","renderScene","render","headerHeight","transformationY","View","onLayout","nativeEvent","layout","createReanimatedTopTabNavigator"],"sourceRoot":"../../../src","sources":["navigator/createReanimatedTopTabNavigator.tsx"],"mappings":";;AAAA,SACEA,sBAAsB,EAEtBC,UAAU,EAEVC,SAAS,EACTC,oBAAoB,QACf,0BAA0B;AAEjC,SAASC,cAAc,QAAQ,0CAAuC;AACtE,SAEEC,mBAAmB,QACd,+CAA4C;AACnD,SAASC,QAAQ,QAAQ,6BAA0B;AAEnD,SAASC,IAAI,QAAQ,QAAQ;AAC7B,SAASC,WAAW,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AACpD,SAASC,OAAO,QAAQ,8BAA8B;AACtD,OAAOC,UAAU,IACfC,WAAW,QAEN,yBAAyB;AAEhC,SAASC,iBAAiB,QAAQ,qDAAkD;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAErF,MAAMC,gBAAgB,GAAGA,CAAC;EACxBC,eAAe;EACfC,eAAe,GAAGlB,mBAAmB;EACrCmB,QAAQ;EACRC,MAAM;EACNC,gBAAgB;EAChBC,aAAa,GAAG,CAAC;AAC+B,CAAC,K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C/E,sBAAsB,CAKpBqB,gBAAgB,CAAC,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export let ReanimatedTopTabNavigation;
4
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ReanimatedTopTabNavigation"],"sourceRoot":"../../src","sources":["types.ts"],"mappings":";;WAQiBA,0BAA0B","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,11 @@
1
+ import type { GestureStateChangeEvent, GestureUpdateEvent, PanGestureChangeEventPayload, PanGestureHandlerEventPayload } from 'react-native-gesture-handler';
2
+ import type { ReanimatedTabViewTypes } from './types';
3
+ export declare const AnimationHelper: {
4
+ animation: (newValue: number, duration?: number) => number;
5
+ onChange: (event: GestureUpdateEvent<PanGestureHandlerEventPayload & PanGestureChangeEventPayload>, animationValue: number, width: number, navigationState: ReanimatedTabViewTypes.NavigationState) => number;
6
+ onEnd: (event: GestureStateChangeEvent<PanGestureHandlerEventPayload>, minimumValueToChangeView: number, width: number, navigationState: ReanimatedTabViewTypes.NavigationState) => {
7
+ index: number;
8
+ value: number;
9
+ };
10
+ };
11
+ //# sourceMappingURL=AnimationHelper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnimationHelper.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ReanimatedTopTab/AnimationHelper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,kBAAkB,EAClB,4BAA4B,EAC5B,6BAA6B,EAC9B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAkFtD,eAAO,MAAM,eAAe;0BALC,MAAM;sBA1E1B,kBAAkB,CACvB,6BAA6B,GAAG,4BAA4B,CAC7D,kBACe,MAAM,SACf,MAAM,mBACI,sBAAsB,CAAC,eAAe;mBA6BhD,uBAAuB,CAAC,6BAA6B,CAAC,4BACnC,MAAM,SACzB,MAAM,mBACI,sBAAsB,CAAC,eAAe;;;;CA8CxD,CAAC"}
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import type { ReanimatedTabViewTypes } from './types';
3
+ export interface ReanimatedTabViewProps {
4
+ LazyPlaceholder?: () => React.ReactNode;
5
+ lazy?: boolean;
6
+ navigationState: ReanimatedTabViewTypes.NavigationState;
7
+ onIndexChange: (index: number) => void;
8
+ percentageTrigger?: number;
9
+ positionInterpolation?: ReanimatedTabViewTypes.PositionInterpolation;
10
+ renderScene: (params: ReanimatedTabViewTypes.SceneProps) => React.ReactNode;
11
+ renderTabBar?: (params: ReanimatedTabViewTypes.RenderTabsParams) => React.ReactNode;
12
+ }
13
+ export declare const ReanimatedTabView: React.NamedExoticComponent<ReanimatedTabViewProps>;
14
+ //# sourceMappingURL=ReanimatedTabView.d.ts.map
@@ -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,M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C,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"}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,11 @@
1
+ import type { GestureStateChangeEvent, GestureUpdateEvent, PanGestureChangeEventPayload, PanGestureHandlerEventPayload } from 'react-native-gesture-handler';
2
+ import type { ReanimatedTabViewTypes } from './types';
3
+ export declare const AnimationHelper: {
4
+ animation: (newValue: number, duration?: number) => number;
5
+ onChange: (event: GestureUpdateEvent<PanGestureHandlerEventPayload & PanGestureChangeEventPayload>, animationValue: number, width: number, navigationState: ReanimatedTabViewTypes.NavigationState) => number;
6
+ onEnd: (event: GestureStateChangeEvent<PanGestureHandlerEventPayload>, minimumValueToChangeView: number, width: number, navigationState: ReanimatedTabViewTypes.NavigationState) => {
7
+ index: number;
8
+ value: number;
9
+ };
10
+ };
11
+ //# sourceMappingURL=AnimationHelper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnimationHelper.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ReanimatedTopTab/AnimationHelper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,kBAAkB,EAClB,4BAA4B,EAC5B,6BAA6B,EAC9B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAkFtD,eAAO,MAAM,eAAe;0BALC,MAAM;sBA1E1B,kBAAkB,CACvB,6BAA6B,GAAG,4BAA4B,CAC7D,kBACe,MAAM,SACf,MAAM,mBACI,sBAAsB,CAAC,eAAe;mBA6BhD,uBAAuB,CAAC,6BAA6B,CAAC,4BACnC,MAAM,SACzB,MAAM,mBACI,sBAAsB,CAAC,eAAe;;;;CA8CxD,CAAC"}
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import type { ReanimatedTabViewTypes } from './types';
3
+ export interface ReanimatedTabViewProps {
4
+ LazyPlaceholder?: () => React.ReactNode;
5
+ lazy?: boolean;
6
+ navigationState: ReanimatedTabViewTypes.NavigationState;
7
+ onIndexChange: (index: number) => void;
8
+ percentageTrigger?: number;
9
+ positionInterpolation?: ReanimatedTabViewTypes.PositionInterpolation;
10
+ renderScene: (params: ReanimatedTabViewTypes.SceneProps) => React.ReactNode;
11
+ renderTabBar?: (params: ReanimatedTabViewTypes.RenderTabsParams) => React.ReactNode;
12
+ }
13
+ export declare const ReanimatedTabView: React.NamedExoticComponent<ReanimatedTabViewProps>;
14
+ //# sourceMappingURL=ReanimatedTabView.d.ts.map