@zoverdoser/react-native-tab-view 1.0.2 → 1.3.1
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.
- package/lib/module/PagerViewAdapter.js +1 -1
- package/lib/module/PagerViewAdapter.js.map +1 -1
- package/lib/module/TabBar.js +7 -30
- package/lib/module/TabBar.js.map +1 -1
- package/lib/module/TabBarIndicator.js +110 -35
- package/lib/module/TabBarIndicator.js.map +1 -1
- package/lib/module/TabBarItem.js +1 -1
- package/lib/module/TabBarItem.js.map +1 -1
- package/lib/module/TabBarItemLabel.js.map +1 -1
- package/lib/module/useAnimatedValue.js.map +1 -1
- package/lib/typescript/src/Pager.android.d.ts +1 -1
- package/lib/typescript/src/Pager.android.d.ts.map +1 -1
- package/lib/typescript/src/Pager.d.ts +1 -1
- package/lib/typescript/src/Pager.d.ts.map +1 -1
- package/lib/typescript/src/Pager.ios.d.ts +1 -1
- package/lib/typescript/src/Pager.ios.d.ts.map +1 -1
- package/lib/typescript/src/PagerViewAdapter.d.ts +1 -1
- package/lib/typescript/src/PagerViewAdapter.d.ts.map +1 -1
- package/lib/typescript/src/PanResponderAdapter.d.ts +1 -1
- package/lib/typescript/src/PanResponderAdapter.d.ts.map +1 -1
- package/lib/typescript/src/SceneMap.d.ts +1 -1
- package/lib/typescript/src/SceneMap.d.ts.map +1 -1
- package/lib/typescript/src/SceneView.d.ts +1 -1
- package/lib/typescript/src/SceneView.d.ts.map +1 -1
- package/lib/typescript/src/TabBar.d.ts +3 -3
- package/lib/typescript/src/TabBar.d.ts.map +1 -1
- package/lib/typescript/src/TabBarIndicator.d.ts +1 -1
- package/lib/typescript/src/TabBarIndicator.d.ts.map +1 -1
- package/lib/typescript/src/TabBarItem.d.ts +1 -1
- package/lib/typescript/src/TabBarItem.d.ts.map +1 -1
- package/lib/typescript/src/TabBarItemLabel.d.ts.map +1 -1
- package/lib/typescript/src/TabView.d.ts +1 -1
- package/lib/typescript/src/TabView.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +10 -10
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/useAnimatedValue.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/PagerViewAdapter.tsx +1 -1
- package/src/TabBar.tsx +11 -45
- package/src/TabBarIndicator.tsx +182 -41
- package/src/TabBarItem.tsx +1 -1
- package/src/TabBarItemLabel.tsx +1 -0
- package/src/useAnimatedValue.tsx +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SceneView.d.ts","sourceRoot":"","sources":["../../../src/SceneView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,SAAS,EAAoB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEhF,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,KAAK,EACL,kBAAkB,EACnB,MAAM,
|
|
1
|
+
{"version":3,"file":"SceneView.d.ts","sourceRoot":"","sources":["../../../src/SceneView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,SAAS,EAAoB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEhF,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,KAAK,EACL,kBAAkB,EACnB,MAAM,YAAS,CAAC;AAEjB,KAAK,KAAK,CAAC,CAAC,SAAS,KAAK,IAAI,kBAAkB,GAC9C,iBAAiB,GAAG;IAClB,eAAe,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;IACpC,IAAI,EAAE,OAAO,CAAC;IACd,mBAAmB,EAAE,MAAM,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,KAAK,KAAK,CAAC,SAAS,CAAC;IAC3D,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC;AAEJ,wBAAgB,SAAS,CAAC,CAAC,SAAS,KAAK,EAAE,EACzC,QAAQ,EACR,eAAe,EACf,IAAI,EACJ,MAAM,EACN,KAAK,EACL,mBAAmB,EACnB,gBAAgB,EAChB,KAAK,GACN,EAAE,KAAK,CAAC,CAAC,CAAC,2CAqEV"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type PressableAndroidRippleConfig, type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
-
import { type Props as IndicatorProps } from './TabBarIndicator';
|
|
4
|
-
import { type Props as TabBarItemProps } from './TabBarItem';
|
|
5
|
-
import type { AnimatedStyles, Event, LocaleDirection, NavigationState, Route, Scene, SceneRendererProps, TabDescriptor } from './types';
|
|
3
|
+
import { type Props as IndicatorProps } from './TabBarIndicator.js';
|
|
4
|
+
import { type Props as TabBarItemProps } from './TabBarItem.js';
|
|
5
|
+
import type { AnimatedStyles, Event, LocaleDirection, NavigationState, Route, Scene, SceneRendererProps, TabDescriptor } from './types.js';
|
|
6
6
|
export type Props<T extends Route> = SceneRendererProps & {
|
|
7
7
|
navigationState: NavigationState<T>;
|
|
8
8
|
scrollEnabled?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabBar.d.ts","sourceRoot":"","sources":["../../../src/TabBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAQL,KAAK,4BAA4B,EACjC,KAAK,SAAS,EAGd,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"TabBar.d.ts","sourceRoot":"","sources":["../../../src/TabBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAQL,KAAK,4BAA4B,EACjC,KAAK,SAAS,EAGd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,KAAK,KAAK,IAAI,cAAc,EAE7B,MAAM,sBAAmB,CAAC;AAC3B,OAAO,EAAE,KAAK,KAAK,IAAI,eAAe,EAAc,MAAM,iBAAc,CAAC;AACzE,OAAO,KAAK,EACV,cAAc,EACd,KAAK,EAEL,eAAe,EACf,eAAe,EACf,KAAK,EACL,KAAK,EACL,kBAAkB,EAClB,aAAa,EACd,MAAM,YAAS,CAAC;AAGjB,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,KAAK,IAAI,kBAAkB,GAAG;IACxD,eAAe,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;IACpC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;IAChE,gBAAgB,CAAC,EAAE,CACjB,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,KACxC,KAAK,CAAC,YAAY,CAAC;IACxB,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,KAAK,IAAI,CAAC;IAC/C,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IAC3C,QAAQ,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAChC,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACtC,uBAAuB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC/C,qBAAqB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7C,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,4BAA4B,CAAC;IAC9C,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC,CAAC;AAkRF,wBAAgB,MAAM,CAAC,CAAC,SAAS,KAAK,EAAE,EACtC,eAAwC,EACxC,GAAO,EACP,aAAa,EACb,MAAM,EACN,eAAe,EACf,QAAQ,EACR,OAAO,EACP,qBAAqB,EACrB,uBAAuB,EACvB,cAAc,EACd,cAAc,EACd,UAAU,EACV,UAAU,EACV,YAAY,EACZ,SAA4D,EAC5D,gBAAgB,EAChB,KAAK,EACL,QAAQ,EACR,MAAM,EAAE,UAAU,EAClB,MAAM,EACN,cAAc,EACd,OAAO,EACP,cAAc,GACf,EAAE,KAAK,CAAC,CAAC,CAAC,2CA0SV"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
-
import type { LocaleDirection, NavigationState, Route, SceneRendererProps } from './types';
|
|
3
|
+
import type { LocaleDirection, NavigationState, Route, SceneRendererProps } from './types.js';
|
|
4
4
|
export type GetTabWidth = (index: number) => number;
|
|
5
5
|
export type Props<T extends Route> = SceneRendererProps & {
|
|
6
6
|
navigationState: NavigationState<T>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabBarIndicator.d.ts","sourceRoot":"","sources":["../../../src/TabBarIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAIL,KAAK,SAAS,EAEd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EACf,KAAK,EACL,kBAAkB,EACnB,MAAM,
|
|
1
|
+
{"version":3,"file":"TabBarIndicator.d.ts","sourceRoot":"","sources":["../../../src/TabBarIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAIL,KAAK,SAAS,EAEd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EACf,KAAK,EACL,kBAAkB,EACnB,MAAM,YAAS,CAAC;AAGjB,MAAM,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;AAEpD,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,KAAK,IAAI,kBAAkB,GAAG;IACxD,eAAe,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;IACpC,KAAK,EAAE,MAAM,GAAG,GAAG,MAAM,GAAG,GAAG,MAAM,CAAC;IACtC,WAAW,EAAE,WAAW,CAAC;IACzB,SAAS,EAAE,eAAe,CAAC;IAC3B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AAsGF,wBAAgB,eAAe,CAAC,CAAC,SAAS,KAAK,EAAE,EAC/C,WAAW,EACX,MAAM,EACN,eAAe,EACf,QAAQ,EACR,KAAK,EACL,SAAS,EACT,GAAG,EACH,KAAK,EACL,QAAQ,GACT,EAAE,KAAK,CAAC,CAAC,CAAC,2CAmLV"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Animated, type LayoutChangeEvent, type PressableAndroidRippleConfig, type StyleProp, type ViewStyle } from 'react-native';
|
|
2
|
-
import type { AnimatedStyles, NavigationState, Route, TabDescriptor } from './types';
|
|
2
|
+
import type { AnimatedStyles, NavigationState, Route, TabDescriptor } from './types.js';
|
|
3
3
|
export type Props<T extends Route> = TabDescriptor<T> & {
|
|
4
4
|
position: Animated.AnimatedInterpolation<number>;
|
|
5
5
|
route: T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabBarItem.d.ts","sourceRoot":"","sources":["../../../src/TabBarItem.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EACR,KAAK,iBAAiB,EAEtB,KAAK,4BAA4B,EACjC,KAAK,SAAS,EAGd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAUtB,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,KAAK,EACL,aAAa,EACd,MAAM,
|
|
1
|
+
{"version":3,"file":"TabBarItem.d.ts","sourceRoot":"","sources":["../../../src/TabBarItem.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EACR,KAAK,iBAAiB,EAEtB,KAAK,4BAA4B,EACjC,KAAK,SAAS,EAGd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAUtB,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,KAAK,EACL,aAAa,EACd,MAAM,YAAS,CAAC;AAEjB,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,KAAK,IAAI,aAAa,CAAC,CAAC,CAAC,GAAG;IACtD,QAAQ,EAAE,QAAQ,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;IACjD,KAAK,EAAE,CAAC,CAAC;IACT,eAAe,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC9C,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC5B,cAAc,CAAC,EAAE,4BAA4B,CAAC;IAC9C,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC,CAAC;AAkNF,wBAAgB,UAAU,CAAC,CAAC,SAAS,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,2CAsB1D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabBarItemLabel.d.ts","sourceRoot":"","sources":["../../../src/TabBarItemLabel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,OAAiB,EAAE,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"TabBarItemLabel.d.ts","sourceRoot":"","sources":["../../../src/TabBarItemLabel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,OAAiB,EAAE,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAEvE,UAAU,oBAAoB;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC5B,cAAc,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IACzC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,eAAO,MAAM,eAAe,6FAOvB,oBAAoB,oDAmBxB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
-
import type { Layout, LocaleDirection, NavigationState, PagerProps, Route, SceneRendererProps, TabDescriptor } from './types';
|
|
3
|
+
import type { Layout, LocaleDirection, NavigationState, PagerProps, Route, SceneRendererProps, TabDescriptor } from './types.js';
|
|
4
4
|
export type Props<T extends Route> = Omit<PagerProps, 'layoutDirection'> & {
|
|
5
5
|
onIndexChange: (index: number) => void;
|
|
6
6
|
onTabSelect?: (props: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabView.d.ts","sourceRoot":"","sources":["../../../src/TabView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAIL,KAAK,SAAS,EAGd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAKtB,OAAO,KAAK,EACV,MAAM,EACN,eAAe,EACf,eAAe,EACf,UAAU,EACV,KAAK,EACL,kBAAkB,EAClB,aAAa,EACd,MAAM,
|
|
1
|
+
{"version":3,"file":"TabView.d.ts","sourceRoot":"","sources":["../../../src/TabView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAIL,KAAK,SAAS,EAGd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAKtB,OAAO,KAAK,EACV,MAAM,EACN,eAAe,EACf,eAAe,EACf,UAAU,EACV,KAAK,EACL,kBAAkB,EAClB,aAAa,EACd,MAAM,YAAS,CAAC;AAEjB,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,KAAK,IAAI,IAAI,CAAC,UAAU,EAAE,iBAAiB,CAAC,GAAG;IACzE,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACjD,eAAe,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;IACpC,qBAAqB,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,KAAK,EAAE,CAAC,CAAA;KAAE,KAAK,KAAK,CAAC,SAAS,CAAC;IACjE,YAAY,CAAC,EAAE,CACb,KAAK,EAAE,kBAAkB,GAAG;QAC1B,eAAe,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;QACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;KACvD,KACE,KAAK,CAAC,SAAS,CAAC;IACrB,cAAc,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;IAClC,aAAa,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAChC,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE;QAAE,KAAK,EAAE,CAAC,CAAA;KAAE,KAAK,OAAO,CAAC,GAAG,OAAO,CAAC;IACpD,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAClC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,WAAW,EAAE,CAAC,KAAK,EAAE,kBAAkB,GAAG;QAAE,KAAK,EAAE,CAAC,CAAA;KAAE,KAAK,KAAK,CAAC,SAAS,CAAC;IAC3E,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,aAAa,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;CAClC,CAAC;AAIF,wBAAgB,OAAO,CAAC,CAAC,SAAS,KAAK,EAAE,EACvC,aAAa,EACb,WAAW,EACX,eAAe,EACf,WAAW,EACX,aAAa,EACb,mBAA4B,EAC5B,IAAY,EACZ,mBAAuB,EACvB,YAAY,EACZ,UAAU,EACV,qBAAoD,EAEpD,YAA+C,EAC/C,UAAU,EACV,KAAK,EACL,SAA4D,EAC5D,YAAmB,EACnB,cAAsB,EACtB,gBAAuB,EACvB,cAAc,EACd,OAAO,EAAE,YAAY,EACrB,aAAa,GACd,EAAE,KAAK,CAAC,CAAC,CAAC,2CAsHV"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { SceneMap } from './SceneMap';
|
|
2
|
-
export type { Props as TabBarProps } from './TabBar';
|
|
3
|
-
export { TabBar } from './TabBar';
|
|
4
|
-
export type { Props as TabBarIndicatorProps } from './TabBarIndicator';
|
|
5
|
-
export { TabBarIndicator } from './TabBarIndicator';
|
|
6
|
-
export type { Props as TabBarItemProps } from './TabBarItem';
|
|
7
|
-
export { TabBarItem } from './TabBarItem';
|
|
8
|
-
export type { Props as TabViewProps } from './TabView';
|
|
9
|
-
export { TabView } from './TabView';
|
|
10
|
-
export type { AnimatedStyles, NavigationState, Route, SceneRendererProps, TabDescriptor, } from './types';
|
|
1
|
+
export { SceneMap } from './SceneMap.js';
|
|
2
|
+
export type { Props as TabBarProps } from './TabBar.js';
|
|
3
|
+
export { TabBar } from './TabBar.js';
|
|
4
|
+
export type { Props as TabBarIndicatorProps } from './TabBarIndicator.js';
|
|
5
|
+
export { TabBarIndicator } from './TabBarIndicator.js';
|
|
6
|
+
export type { Props as TabBarItemProps } from './TabBarItem.js';
|
|
7
|
+
export { TabBarItem } from './TabBarItem.js';
|
|
8
|
+
export type { Props as TabViewProps } from './TabView.js';
|
|
9
|
+
export { TabView } from './TabView.js';
|
|
10
|
+
export type { AnimatedStyles, NavigationState, Route, SceneRendererProps, TabDescriptor, } from './types.js';
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAY,CAAC;AACtC,YAAY,EAAE,KAAK,IAAI,WAAW,EAAE,MAAM,aAAU,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAU,CAAC;AAClC,YAAY,EAAE,KAAK,IAAI,oBAAoB,EAAE,MAAM,sBAAmB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAmB,CAAC;AACpD,YAAY,EAAE,KAAK,IAAI,eAAe,EAAE,MAAM,iBAAc,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAc,CAAC;AAC1C,YAAY,EAAE,KAAK,IAAI,YAAY,EAAE,MAAM,cAAW,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAW,CAAC;AACpC,YAAY,EACV,cAAc,EACd,eAAe,EACf,KAAK,EACL,kBAAkB,EAClB,aAAa,GACd,MAAM,YAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAnimatedValue.d.ts","sourceRoot":"","sources":["../../../src/useAnimatedValue.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useAnimatedValue.d.ts","sourceRoot":"","sources":["../../../src/useAnimatedValue.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,QAAQ,CAAC,KAAK,CAQrE"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zoverdoser/react-native-tab-view",
|
|
3
3
|
"description": "Tab view component for React Native",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.3.1",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native-component",
|
|
7
7
|
"react-component",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"del-cli": "^6.0.0",
|
|
53
53
|
"react": "19.1.0",
|
|
54
54
|
"react-native": "0.81.5",
|
|
55
|
-
"react-native-builder-bob": "^0.
|
|
55
|
+
"react-native-builder-bob": "^0.42.1",
|
|
56
56
|
"react-native-pager-view": "6.9.1",
|
|
57
57
|
"react-test-renderer": "19.1.0",
|
|
58
58
|
"typescript": "^5.9.2"
|
package/src/PagerViewAdapter.tsx
CHANGED
package/src/TabBar.tsx
CHANGED
|
@@ -12,9 +12,7 @@ import {
|
|
|
12
12
|
StyleSheet,
|
|
13
13
|
View,
|
|
14
14
|
type ViewStyle,
|
|
15
|
-
type ViewToken,
|
|
16
15
|
} from 'react-native';
|
|
17
|
-
import useLatestCallback from 'use-latest-callback';
|
|
18
16
|
|
|
19
17
|
import {
|
|
20
18
|
type Props as IndicatorProps,
|
|
@@ -363,7 +361,6 @@ export function TabBar<T extends Route>({
|
|
|
363
361
|
const flatListRef = React.useRef<FlatList | null>(null);
|
|
364
362
|
const isFirst = React.useRef(true);
|
|
365
363
|
const scrollAmount = useAnimatedValue(0);
|
|
366
|
-
const measuredTabWidths = React.useRef<Record<string, number>>({});
|
|
367
364
|
const { routes } = navigationState;
|
|
368
365
|
const flattenedTabWidth = getFlattenedTabWidth(tabStyle);
|
|
369
366
|
const isWidthDynamic = flattenedTabWidth === 'auto';
|
|
@@ -443,6 +440,10 @@ export function TabBar<T extends Route>({
|
|
|
443
440
|
[direction, layout.width, scrollAmount, tabBarWidth]
|
|
444
441
|
);
|
|
445
442
|
|
|
443
|
+
const measuredTabWidths = React.useRef<Record<string, number>>({});
|
|
444
|
+
const animationFrameHandle =
|
|
445
|
+
React.useRef<ReturnType<typeof requestAnimationFrame>>(null);
|
|
446
|
+
|
|
446
447
|
const renderItem = React.useCallback(
|
|
447
448
|
({ item: route, index }: ListRenderItemInfo<T>) => {
|
|
448
449
|
const {
|
|
@@ -457,28 +458,13 @@ export function TabBar<T extends Route>({
|
|
|
457
458
|
? (e: LayoutChangeEvent) => {
|
|
458
459
|
measuredTabWidths.current[route.key] = e.nativeEvent.layout.width;
|
|
459
460
|
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
// If we have more than 10 routes divide updating tabWidths into multiple batches. Here we update only first batch of 10 items.
|
|
463
|
-
if (
|
|
464
|
-
routes.length > MEASURE_PER_BATCH &&
|
|
465
|
-
index === MEASURE_PER_BATCH &&
|
|
466
|
-
routes
|
|
467
|
-
.slice(0, MEASURE_PER_BATCH)
|
|
468
|
-
.every(
|
|
469
|
-
(r) => typeof measuredTabWidths.current[r.key] === 'number'
|
|
470
|
-
)
|
|
471
|
-
) {
|
|
472
|
-
setTabWidths({ ...measuredTabWidths.current });
|
|
473
|
-
} else if (
|
|
474
|
-
routes.every(
|
|
475
|
-
(r) => typeof measuredTabWidths.current[r.key] === 'number'
|
|
476
|
-
)
|
|
477
|
-
) {
|
|
478
|
-
// When we have measured widths for all of the tabs, we should updates the state
|
|
479
|
-
// We avoid doing separate setState for each layout since it triggers multiple renders and slows down app
|
|
480
|
-
setTabWidths({ ...measuredTabWidths.current });
|
|
461
|
+
if (animationFrameHandle.current != null) {
|
|
462
|
+
cancelAnimationFrame(animationFrameHandle.current);
|
|
481
463
|
}
|
|
464
|
+
|
|
465
|
+
animationFrameHandle.current = requestAnimationFrame(() => {
|
|
466
|
+
setTabWidths({ ...measuredTabWidths.current });
|
|
467
|
+
});
|
|
482
468
|
}
|
|
483
469
|
: undefined;
|
|
484
470
|
|
|
@@ -597,32 +583,13 @@ export function TabBar<T extends Route>({
|
|
|
597
583
|
[scrollAmount]
|
|
598
584
|
);
|
|
599
585
|
|
|
600
|
-
const handleViewableItemsChanged = useLatestCallback(
|
|
601
|
-
({ changed }: { changed: ViewToken[] }) => {
|
|
602
|
-
if (routes.length <= MEASURE_PER_BATCH) {
|
|
603
|
-
return;
|
|
604
|
-
}
|
|
605
|
-
// Get next vievable item
|
|
606
|
-
const item = changed[changed.length - 1];
|
|
607
|
-
const index = item?.index || 0;
|
|
608
|
-
if (
|
|
609
|
-
item.isViewable &&
|
|
610
|
-
(index % 10 === 0 ||
|
|
611
|
-
index === navigationState.index ||
|
|
612
|
-
index === routes.length - 1)
|
|
613
|
-
) {
|
|
614
|
-
setTabWidths({ ...measuredTabWidths.current });
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
);
|
|
618
|
-
|
|
619
586
|
return (
|
|
620
587
|
<Animated.View onLayout={handleLayout} style={[styles.tabBar, style]}>
|
|
621
588
|
<Animated.View
|
|
622
589
|
pointerEvents="none"
|
|
623
590
|
style={[
|
|
624
591
|
styles.indicatorContainer,
|
|
625
|
-
scrollEnabled ? { transform: [{ translateX }]
|
|
592
|
+
scrollEnabled ? { transform: [{ translateX }] } : null,
|
|
626
593
|
scrollEnabled ? { width: tabBarWidth } : null,
|
|
627
594
|
indicatorContainerStyle,
|
|
628
595
|
]}
|
|
@@ -668,7 +635,6 @@ export function TabBar<T extends Route>({
|
|
|
668
635
|
scrollEnabled={scrollEnabled}
|
|
669
636
|
bounces={bounces}
|
|
670
637
|
initialNumToRender={MEASURE_PER_BATCH}
|
|
671
|
-
onViewableItemsChanged={handleViewableItemsChanged}
|
|
672
638
|
alwaysBounceHorizontal={false}
|
|
673
639
|
scrollsToTop={false}
|
|
674
640
|
showsHorizontalScrollIndicator={false}
|
package/src/TabBarIndicator.tsx
CHANGED
|
@@ -30,35 +30,94 @@ export type Props<T extends Route> = SceneRendererProps & {
|
|
|
30
30
|
|
|
31
31
|
const useNativeDriver = Platform.OS !== 'web';
|
|
32
32
|
|
|
33
|
+
const calculateSize = (
|
|
34
|
+
value: ViewStyle['width'] | undefined,
|
|
35
|
+
referenceWidth: number
|
|
36
|
+
): number | undefined => {
|
|
37
|
+
if (typeof value === 'number') {
|
|
38
|
+
return value;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (typeof value === 'string' && value.endsWith('%')) {
|
|
42
|
+
const parsed = parseFloat(value);
|
|
43
|
+
|
|
44
|
+
if (Number.isFinite(parsed)) {
|
|
45
|
+
return referenceWidth * (parsed / 100);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return undefined;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const getIndicatorWidthWithMargins = (
|
|
53
|
+
width: number,
|
|
54
|
+
style: ViewStyle | undefined,
|
|
55
|
+
direction: LocaleDirection
|
|
56
|
+
) => {
|
|
57
|
+
const marginHorizontal = style?.marginHorizontal ?? style?.margin;
|
|
58
|
+
|
|
59
|
+
const leftMargin =
|
|
60
|
+
(direction === 'ltr' ? style?.marginStart : style?.marginEnd) ??
|
|
61
|
+
style?.marginLeft ??
|
|
62
|
+
marginHorizontal;
|
|
63
|
+
|
|
64
|
+
const rightMargin =
|
|
65
|
+
(direction === 'rtl' ? style?.marginStart : style?.marginEnd) ??
|
|
66
|
+
style?.marginRight ??
|
|
67
|
+
marginHorizontal;
|
|
68
|
+
|
|
69
|
+
return Math.max(
|
|
70
|
+
0,
|
|
71
|
+
width -
|
|
72
|
+
(calculateSize(leftMargin, width) ?? 0) -
|
|
73
|
+
(calculateSize(rightMargin, width) ?? 0)
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const getIndicatorWidth = (
|
|
78
|
+
tabWidth: number,
|
|
79
|
+
width: number | `${number}%`,
|
|
80
|
+
style: ViewStyle | undefined,
|
|
81
|
+
direction: LocaleDirection
|
|
82
|
+
): number | `${number}%` => {
|
|
83
|
+
const customWidth = calculateSize(style?.width, tabWidth);
|
|
84
|
+
|
|
85
|
+
if (customWidth !== undefined) {
|
|
86
|
+
return customWidth;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (typeof width === 'number') {
|
|
90
|
+
return getIndicatorWidthWithMargins(width, style, direction);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return width;
|
|
94
|
+
};
|
|
95
|
+
|
|
33
96
|
const getTranslateX = (
|
|
34
97
|
position: Animated.AnimatedInterpolation<number>,
|
|
35
98
|
routes: Route[],
|
|
36
99
|
getTabWidth: GetTabWidth,
|
|
37
100
|
direction: LocaleDirection,
|
|
38
101
|
gap?: number,
|
|
39
|
-
|
|
102
|
+
getWidth?: (index: number) => number | undefined
|
|
40
103
|
) => {
|
|
41
104
|
const inputRange = routes.map((_, i) => i);
|
|
105
|
+
const outputRange = routes.map((_, i) => {
|
|
106
|
+
let sumTabWidth = 0;
|
|
42
107
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (i === 0) return [getTabWidth(i) / 2 - width / 2];
|
|
108
|
+
for (let j = 0; j < i; j++) {
|
|
109
|
+
sumTabWidth += getTabWidth(j);
|
|
110
|
+
}
|
|
47
111
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
sumTabWidth += getTabWidth(j);
|
|
51
|
-
}
|
|
112
|
+
const indicatorWidth = getWidth?.(i);
|
|
113
|
+
const tabOffset = sumTabWidth + (gap ? gap * i : 0);
|
|
52
114
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
sumTabWidth + getTabWidth(i) / 2 + (gap ? gap * i : 0) - width / 2,
|
|
56
|
-
];
|
|
57
|
-
} else {
|
|
58
|
-
if (i === 0) return [0];
|
|
59
|
-
return [...acc, acc[i - 1] + getTabWidth(i - 1) + (gap ?? 0)];
|
|
115
|
+
if (indicatorWidth === undefined) {
|
|
116
|
+
return tabOffset;
|
|
60
117
|
}
|
|
61
|
-
|
|
118
|
+
|
|
119
|
+
return tabOffset + getTabWidth(i) / 2 - indicatorWidth / 2;
|
|
120
|
+
});
|
|
62
121
|
|
|
63
122
|
const translateX = position.interpolate({
|
|
64
123
|
inputRange,
|
|
@@ -83,31 +142,60 @@ export function TabBarIndicator<T extends Route>({
|
|
|
83
142
|
const isIndicatorShown = React.useRef(false);
|
|
84
143
|
const isWidthDynamic = width === 'auto';
|
|
85
144
|
|
|
145
|
+
const flattenedStyle = StyleSheet.flatten(style);
|
|
146
|
+
|
|
147
|
+
const hasCustomIndicatorWidth =
|
|
148
|
+
typeof flattenedStyle?.width === 'number' ||
|
|
149
|
+
(typeof flattenedStyle?.width === 'string' &&
|
|
150
|
+
flattenedStyle?.width.endsWith('%'));
|
|
151
|
+
|
|
152
|
+
const constantIndicatorWidth =
|
|
153
|
+
typeof flattenedStyle?.width === 'number'
|
|
154
|
+
? flattenedStyle.width
|
|
155
|
+
: undefined;
|
|
156
|
+
|
|
157
|
+
const isCentered =
|
|
158
|
+
hasCustomIndicatorWidth &&
|
|
159
|
+
(flattenedStyle?.margin === 'auto' ||
|
|
160
|
+
flattenedStyle?.marginHorizontal === 'auto');
|
|
161
|
+
|
|
162
|
+
// If indicator has a custom width, we need to adjust calculations to account for it
|
|
163
|
+
// It should be centered relative to the tab if the margin is set to auto
|
|
164
|
+
const getCenteredIndicatorWidth = (tabWidth: number) => {
|
|
165
|
+
if (isCentered) {
|
|
166
|
+
return calculateSize(flattenedStyle?.width, tabWidth);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (typeof width === 'number') {
|
|
170
|
+
return width;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return undefined;
|
|
174
|
+
};
|
|
175
|
+
|
|
86
176
|
const opacity = useAnimatedValue(isWidthDynamic ? 0 : 1);
|
|
87
177
|
|
|
178
|
+
// We should fade-in the indicator when we have widths for all the tab items
|
|
88
179
|
const indicatorVisible = isWidthDynamic
|
|
89
180
|
? layout.width &&
|
|
90
181
|
navigationState.routes
|
|
91
|
-
.slice(0, navigationState.index)
|
|
182
|
+
.slice(0, navigationState.index + 1)
|
|
92
183
|
.every((_, r) => getTabWidth(r))
|
|
93
184
|
: true;
|
|
94
185
|
|
|
95
186
|
React.useEffect(() => {
|
|
96
187
|
const fadeInIndicator = () => {
|
|
97
|
-
if (
|
|
98
|
-
!isIndicatorShown.current &&
|
|
99
|
-
isWidthDynamic &&
|
|
100
|
-
// We should fade-in the indicator when we have widths for all the tab items
|
|
101
|
-
indicatorVisible
|
|
102
|
-
) {
|
|
103
|
-
isIndicatorShown.current = true;
|
|
104
|
-
|
|
188
|
+
if (!isIndicatorShown.current && isWidthDynamic && indicatorVisible) {
|
|
105
189
|
Animated.timing(opacity, {
|
|
106
190
|
toValue: 1,
|
|
107
191
|
duration: 150,
|
|
108
192
|
easing: Easing.in(Easing.linear),
|
|
109
193
|
useNativeDriver,
|
|
110
|
-
}).start()
|
|
194
|
+
}).start(({ finished }) => {
|
|
195
|
+
if (finished) {
|
|
196
|
+
isIndicatorShown.current = true;
|
|
197
|
+
}
|
|
198
|
+
});
|
|
111
199
|
}
|
|
112
200
|
};
|
|
113
201
|
|
|
@@ -120,18 +208,25 @@ export function TabBarIndicator<T extends Route>({
|
|
|
120
208
|
|
|
121
209
|
const transform = [];
|
|
122
210
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
routes
|
|
126
|
-
|
|
127
|
-
|
|
211
|
+
const translateX =
|
|
212
|
+
layout.width && routes.length > 1
|
|
213
|
+
? getTranslateX(position, routes, getTabWidth, direction, gap, (index) =>
|
|
214
|
+
getCenteredIndicatorWidth(getTabWidth(index))
|
|
215
|
+
)
|
|
216
|
+
: 0;
|
|
128
217
|
|
|
129
|
-
|
|
130
|
-
}
|
|
218
|
+
transform.push({ translateX });
|
|
131
219
|
|
|
132
|
-
if (width === 'auto') {
|
|
220
|
+
if (width === 'auto' && constantIndicatorWidth == null) {
|
|
133
221
|
const inputRange = routes.map((_, i) => i);
|
|
134
|
-
const outputRange = inputRange.map(
|
|
222
|
+
const outputRange = inputRange.map((i) => {
|
|
223
|
+
const tabW = getTabWidth(i);
|
|
224
|
+
|
|
225
|
+
return (
|
|
226
|
+
calculateSize(flattenedStyle?.width, tabW) ??
|
|
227
|
+
getIndicatorWidthWithMargins(tabW, flattenedStyle, direction)
|
|
228
|
+
);
|
|
229
|
+
});
|
|
135
230
|
|
|
136
231
|
transform.push(
|
|
137
232
|
{
|
|
@@ -150,27 +245,73 @@ export function TabBarIndicator<T extends Route>({
|
|
|
150
245
|
|
|
151
246
|
const styleList: StyleProp<ViewStyle> = [];
|
|
152
247
|
|
|
153
|
-
//
|
|
154
|
-
|
|
248
|
+
// transform doesn't work properly on chrome and opera for linux and android
|
|
249
|
+
// so we need to use width and left/right instead of scaleX and translateX
|
|
250
|
+
// https://github.com/react-navigation/react-navigation/pull/11440
|
|
251
|
+
if (
|
|
252
|
+
Platform.OS === 'web' &&
|
|
253
|
+
width === 'auto' &&
|
|
254
|
+
constantIndicatorWidth == null
|
|
255
|
+
) {
|
|
256
|
+
const start = flattenedStyle?.start;
|
|
257
|
+
const translate =
|
|
258
|
+
direction === 'rtl' ? Animated.multiply(translateX, -1) : translateX;
|
|
259
|
+
const offset =
|
|
260
|
+
typeof start === 'number' ? Animated.add(translate, start) : translate;
|
|
261
|
+
|
|
155
262
|
styleList.push(
|
|
156
263
|
{ width: transform[1].scaleX },
|
|
157
|
-
{ left:
|
|
264
|
+
direction === 'rtl' ? { right: offset } : { left: offset }
|
|
158
265
|
);
|
|
159
266
|
} else {
|
|
160
267
|
styleList.push(
|
|
161
|
-
{
|
|
268
|
+
{
|
|
269
|
+
width:
|
|
270
|
+
width === 'auto'
|
|
271
|
+
? // if the indicator has a constant width, use it as is
|
|
272
|
+
// we don't need to scale it to match tab width
|
|
273
|
+
(constantIndicatorWidth ?? 1)
|
|
274
|
+
: getIndicatorWidth(
|
|
275
|
+
getTabWidth(navigationState.index),
|
|
276
|
+
width,
|
|
277
|
+
flattenedStyle,
|
|
278
|
+
direction
|
|
279
|
+
),
|
|
280
|
+
},
|
|
162
281
|
{ start: `${(100 / routes.length) * navigationState.index}%` },
|
|
163
282
|
{ transform }
|
|
164
283
|
);
|
|
165
284
|
}
|
|
166
285
|
|
|
286
|
+
let finalStyle;
|
|
287
|
+
|
|
288
|
+
if (hasCustomIndicatorWidth && style != null) {
|
|
289
|
+
const rest = { ...flattenedStyle };
|
|
290
|
+
|
|
291
|
+
delete rest.width;
|
|
292
|
+
|
|
293
|
+
if (isCentered) {
|
|
294
|
+
if (rest.margin === 'auto') {
|
|
295
|
+
delete rest.margin;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
if (rest.marginHorizontal === 'auto') {
|
|
299
|
+
delete rest.marginHorizontal;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
finalStyle = rest;
|
|
304
|
+
} else {
|
|
305
|
+
finalStyle = style;
|
|
306
|
+
}
|
|
307
|
+
|
|
167
308
|
return (
|
|
168
309
|
<Animated.View
|
|
169
310
|
style={[
|
|
170
311
|
styles.indicator,
|
|
171
312
|
styleList,
|
|
172
313
|
width === 'auto' ? { opacity: opacity } : null,
|
|
173
|
-
|
|
314
|
+
finalStyle,
|
|
174
315
|
]}
|
|
175
316
|
>
|
|
176
317
|
{children}
|
package/src/TabBarItem.tsx
CHANGED
|
@@ -169,7 +169,7 @@ const TabBarItemInternal = <T extends Route>({
|
|
|
169
169
|
<Animated.View style={{ opacity }}>{iconEle}</Animated.View>
|
|
170
170
|
</View>
|
|
171
171
|
);
|
|
172
|
-
}, [
|
|
172
|
+
}, [route, customIcon, isFocused, ReAnimatedStyleRef, opacity]);
|
|
173
173
|
|
|
174
174
|
const renderLabel = React.useCallback(
|
|
175
175
|
() =>
|
package/src/TabBarItemLabel.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import type { StyleProp, TextStyle } from 'react-native';
|
|
3
3
|
import { StyleSheet } from 'react-native';
|
|
4
4
|
import Animated, { type AnimatedStyle } from 'react-native-reanimated';
|
|
5
|
+
|
|
5
6
|
interface TabBarItemLabelProps {
|
|
6
7
|
label?: string;
|
|
7
8
|
style: StyleProp<TextStyle>;
|
package/src/useAnimatedValue.tsx
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Animated } from 'react-native';
|
|
3
3
|
|
|
4
|
-
export function useAnimatedValue(initialValue: number) {
|
|
4
|
+
export function useAnimatedValue(initialValue: number): Animated.Value {
|
|
5
5
|
const lazyRef = React.useRef<Animated.Value>(undefined);
|
|
6
6
|
|
|
7
7
|
if (lazyRef.current === undefined) {
|
|
8
8
|
lazyRef.current = new Animated.Value(initialValue);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
return lazyRef.current
|
|
11
|
+
return lazyRef.current;
|
|
12
12
|
}
|