react-native-tab-view 4.0.0-alpha.0 → 4.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/Pager.android.js.map +1 -1
- package/lib/commonjs/Pager.ios.js.map +1 -1
- package/lib/commonjs/Pager.js.map +1 -1
- package/lib/commonjs/PagerViewAdapter.js +9 -13
- package/lib/commonjs/PagerViewAdapter.js.map +1 -1
- package/lib/commonjs/PanResponderAdapter.js +4 -4
- package/lib/commonjs/PanResponderAdapter.js.map +1 -1
- package/lib/commonjs/PlatformPressable.js +24 -3
- package/lib/commonjs/PlatformPressable.js.map +1 -1
- package/lib/commonjs/SceneMap.js +2 -2
- package/lib/commonjs/SceneMap.js.map +1 -1
- package/lib/commonjs/SceneView.js +3 -4
- package/lib/commonjs/SceneView.js.map +1 -1
- package/lib/commonjs/TabBar.js +112 -97
- package/lib/commonjs/TabBar.js.map +1 -1
- package/lib/commonjs/TabBarIndicator.js +21 -16
- package/lib/commonjs/TabBarIndicator.js.map +1 -1
- package/lib/commonjs/TabBarItem.js +58 -80
- package/lib/commonjs/TabBarItem.js.map +1 -1
- package/lib/commonjs/TabBarItemLabel.js +4 -4
- package/lib/commonjs/TabBarItemLabel.js.map +1 -1
- package/lib/commonjs/TabView.js +3 -3
- package/lib/commonjs/TabView.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/useAnimatedValue.js +2 -2
- package/lib/commonjs/useAnimatedValue.js.map +1 -1
- package/lib/module/Pager.android.js.map +1 -1
- package/lib/module/Pager.ios.js.map +1 -1
- package/lib/module/Pager.js.map +1 -1
- package/lib/module/PagerViewAdapter.js +7 -11
- package/lib/module/PagerViewAdapter.js.map +1 -1
- package/lib/module/PanResponderAdapter.js +2 -2
- package/lib/module/PanResponderAdapter.js.map +1 -1
- package/lib/module/PlatformPressable.js +22 -1
- package/lib/module/PlatformPressable.js.map +1 -1
- package/lib/module/SceneMap.js.map +1 -1
- package/lib/module/SceneView.js +1 -2
- package/lib/module/SceneView.js.map +1 -1
- package/lib/module/TabBar.js +110 -95
- package/lib/module/TabBar.js.map +1 -1
- package/lib/module/TabBarIndicator.js +19 -14
- package/lib/module/TabBarIndicator.js.map +1 -1
- package/lib/module/TabBarItem.js +56 -78
- package/lib/module/TabBarItem.js.map +1 -1
- package/lib/module/TabBarItemLabel.js +3 -2
- package/lib/module/TabBarItemLabel.js.map +1 -1
- package/lib/module/TabView.js +1 -1
- package/lib/module/TabView.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/useAnimatedValue.js.map +1 -1
- package/lib/typescript/src/PlatformPressable.d.ts +4 -3
- package/lib/typescript/src/PlatformPressable.d.ts.map +1 -1
- package/lib/typescript/src/SceneMap.d.ts +2 -2
- package/lib/typescript/src/SceneMap.d.ts.map +1 -1
- package/lib/typescript/src/SceneView.d.ts +2 -2
- package/lib/typescript/src/SceneView.d.ts.map +1 -1
- package/lib/typescript/src/TabBar.d.ts +7 -18
- package/lib/typescript/src/TabBar.d.ts.map +1 -1
- package/lib/typescript/src/TabBarIndicator.d.ts +3 -3
- package/lib/typescript/src/TabBarIndicator.d.ts.map +1 -1
- package/lib/typescript/src/TabBarItem.d.ts +4 -19
- package/lib/typescript/src/TabBarItem.d.ts.map +1 -1
- package/lib/typescript/src/TabBarItemLabel.d.ts +1 -1
- package/lib/typescript/src/TabBarItemLabel.d.ts.map +1 -1
- package/lib/typescript/src/TabView.d.ts +5 -5
- package/lib/typescript/src/TabView.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +25 -1
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/package.json +11 -11
- package/src/PagerViewAdapter.tsx +2 -2
- package/src/PanResponderAdapter.tsx +4 -4
- package/src/PlatformPressable.tsx +31 -2
- package/src/SceneMap.tsx +1 -3
- package/src/SceneView.tsx +4 -4
- package/src/TabBar.tsx +178 -179
- package/src/TabBarIndicator.tsx +22 -14
- package/src/TabBarItem.tsx +92 -118
- package/src/TabBarItemLabel.tsx +2 -1
- package/src/TabView.tsx +5 -5
- package/src/index.tsx +6 -1
- package/src/types.tsx +25 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { Animated, LayoutChangeEvent, PressableAndroidRippleConfig, StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
3
|
-
import type { NavigationState, Route,
|
|
4
|
-
export type Props<T extends Route> = {
|
|
2
|
+
import { Animated, type LayoutChangeEvent, type PressableAndroidRippleConfig, type StyleProp, type TextStyle, type ViewStyle } from 'react-native';
|
|
3
|
+
import type { NavigationState, Route, TabDescriptor } from './types';
|
|
4
|
+
export type Props<T extends Route> = TabDescriptor<T> & {
|
|
5
5
|
position: Animated.AnimatedInterpolation<number>;
|
|
6
6
|
route: T;
|
|
7
7
|
navigationState: NavigationState<T>;
|
|
@@ -9,21 +9,6 @@ export type Props<T extends Route> = {
|
|
|
9
9
|
inactiveColor?: string;
|
|
10
10
|
pressColor?: string;
|
|
11
11
|
pressOpacity?: number;
|
|
12
|
-
getLabelText: (scene: Scene<T>) => string | undefined;
|
|
13
|
-
getAccessible: (scene: Scene<T>) => boolean | undefined;
|
|
14
|
-
getAccessibilityLabel: (scene: Scene<T>) => string | undefined;
|
|
15
|
-
getTestID: (scene: Scene<T>) => string | undefined;
|
|
16
|
-
renderLabel?: (scene: {
|
|
17
|
-
route: T;
|
|
18
|
-
focused: boolean;
|
|
19
|
-
color: string;
|
|
20
|
-
}) => React.ReactNode;
|
|
21
|
-
renderIcon?: (scene: {
|
|
22
|
-
route: T;
|
|
23
|
-
focused: boolean;
|
|
24
|
-
color: string;
|
|
25
|
-
}) => React.ReactNode;
|
|
26
|
-
renderBadge?: (scene: Scene<T>) => React.ReactNode;
|
|
27
12
|
onLayout?: (event: LayoutChangeEvent) => void;
|
|
28
13
|
onPress: () => void;
|
|
29
14
|
onLongPress: () => void;
|
|
@@ -32,5 +17,5 @@ export type Props<T extends Route> = {
|
|
|
32
17
|
style: StyleProp<ViewStyle>;
|
|
33
18
|
android_ripple?: PressableAndroidRippleConfig;
|
|
34
19
|
};
|
|
35
|
-
export declare function TabBarItem<T extends Route>(props: Props<T>): JSX.Element;
|
|
20
|
+
export declare function TabBarItem<T extends Route>(props: Props<T>): React.JSX.Element;
|
|
36
21
|
//# sourceMappingURL=TabBarItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabBarItem.d.ts","sourceRoot":"","sources":["../../../src/TabBarItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,QAAQ,EACR,iBAAiB,
|
|
1
|
+
{"version":3,"file":"TabBarItem.d.ts","sourceRoot":"","sources":["../../../src/TabBarItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,QAAQ,EACR,KAAK,iBAAiB,EACtB,KAAK,4BAA4B,EACjC,KAAK,SAAS,EAEd,KAAK,SAAS,EAEd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAKtB,OAAO,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAErE,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,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,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,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAClC,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC5B,cAAc,CAAC,EAAE,4BAA4B,CAAC;CAC/C,CAAC;AA6NF,wBAAgB,UAAU,CAAC,CAAC,SAAS,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,qBAsB1D"}
|
|
@@ -6,6 +6,6 @@ interface TabBarItemLabelProps {
|
|
|
6
6
|
labelStyle: StyleProp<ViewStyle>;
|
|
7
7
|
icon: React.ReactNode;
|
|
8
8
|
}
|
|
9
|
-
export declare const TabBarItemLabel: React.MemoExoticComponent<({ color, label, labelStyle, icon }: TabBarItemLabelProps) => JSX.Element | null>;
|
|
9
|
+
export declare const TabBarItemLabel: React.MemoExoticComponent<({ color, label, labelStyle, icon }: TabBarItemLabelProps) => React.JSX.Element | null>;
|
|
10
10
|
export {};
|
|
11
11
|
//# sourceMappingURL=TabBarItemLabel.d.ts.map
|
|
@@ -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;AAGzD,UAAU,oBAAoB;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACjC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;CACvB;AAED,eAAO,MAAM,eAAe,iEACW,oBAAoB,
|
|
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;AAGzD,UAAU,oBAAoB;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACjC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;CACvB;AAED,eAAO,MAAM,eAAe,iEACW,oBAAoB,8BAkB1D,CAAC"}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
3
3
|
import type { Layout, LocaleDirection, NavigationState, PagerProps, Route, SceneRendererProps } from './types';
|
|
4
4
|
export type Props<T extends Route> = Omit<PagerProps, 'layoutDirection'> & {
|
|
5
5
|
onIndexChange: (index: number) => void;
|
|
6
6
|
navigationState: NavigationState<T>;
|
|
7
|
-
renderScene: (props: SceneRendererProps & {
|
|
8
|
-
route: T;
|
|
9
|
-
}) => React.ReactNode;
|
|
10
7
|
renderLazyPlaceholder?: (props: {
|
|
11
8
|
route: T;
|
|
12
9
|
}) => React.ReactNode;
|
|
@@ -23,6 +20,9 @@ export type Props<T extends Route> = Omit<PagerProps, 'layoutDirection'> & {
|
|
|
23
20
|
direction?: LocaleDirection;
|
|
24
21
|
pagerStyle?: StyleProp<ViewStyle>;
|
|
25
22
|
style?: StyleProp<ViewStyle>;
|
|
23
|
+
renderScene: (props: SceneRendererProps & {
|
|
24
|
+
route: T;
|
|
25
|
+
}) => React.ReactNode;
|
|
26
26
|
};
|
|
27
|
-
export declare function TabView<T extends Route>({ onIndexChange, navigationState, renderScene, initialLayout, keyboardDismissMode, lazy, lazyPreloadDistance, onSwipeStart, onSwipeEnd, renderLazyPlaceholder, renderTabBar, sceneContainerStyle, pagerStyle, style, direction, swipeEnabled, tabBarPosition, animationEnabled, overScrollMode, }: Props<T>): JSX.Element;
|
|
27
|
+
export declare function TabView<T extends Route>({ onIndexChange, navigationState, renderScene, initialLayout, keyboardDismissMode, lazy, lazyPreloadDistance, onSwipeStart, onSwipeEnd, renderLazyPlaceholder, renderTabBar, sceneContainerStyle, pagerStyle, style, direction, swipeEnabled, tabBarPosition, animationEnabled, overScrollMode, }: Props<T>): React.JSX.Element;
|
|
28
28
|
//# sourceMappingURL=TabView.d.ts.map
|
|
@@ -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,SAAS,
|
|
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,EACnB,MAAM,SAAS,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,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;QAAE,eAAe,EAAE,eAAe,CAAC,CAAC,CAAC,CAAA;KAAE,KAChE,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,mBAAmB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC3C,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;CAC5E,CAAC;AAEF,wBAAgB,OAAO,CAAC,CAAC,SAAS,KAAK,EAAE,EACvC,aAAa,EACb,eAAe,EACf,WAAW,EACX,aAAa,EACb,mBAA4B,EAC5B,IAAY,EACZ,mBAAuB,EACvB,YAAY,EACZ,UAAU,EACV,qBAAkC,EAClC,YAA+C,EAC/C,mBAAmB,EACnB,UAAU,EACV,KAAK,EACL,SAA4D,EAC5D,YAAmB,EACnB,cAAsB,EACtB,gBAAuB,EACvB,cAAc,GACf,EAAE,KAAK,CAAC,CAAC,CAAC,qBAuGV"}
|
|
@@ -7,5 +7,5 @@ export type { Props as TabBarItemProps } from './TabBarItem';
|
|
|
7
7
|
export { TabBarItem } from './TabBarItem';
|
|
8
8
|
export type { Props as TabViewProps } from './TabView';
|
|
9
9
|
export { TabView } from './TabView';
|
|
10
|
-
export type { NavigationState, Route, SceneRendererProps } from './types';
|
|
10
|
+
export type { NavigationState, Route, SceneRendererProps, TabDescriptor, } from './types';
|
|
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,YAAY,CAAC;AACtC,YAAY,EAAE,KAAK,IAAI,WAAW,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,KAAK,IAAI,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,KAAK,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,KAAK,IAAI,YAAY,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EAAE,KAAK,IAAI,WAAW,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,KAAK,IAAI,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,KAAK,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,KAAK,IAAI,YAAY,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EACV,eAAe,EACf,KAAK,EACL,kBAAkB,EAClB,aAAa,GACd,MAAM,SAAS,CAAC"}
|
|
@@ -1,5 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { Animated, StyleProp, TextStyle } from 'react-native';
|
|
2
3
|
import type { PagerViewProps } from 'react-native-pager-view';
|
|
4
|
+
export type TabDescriptor<T extends Route> = {
|
|
5
|
+
accessibilityLabel?: string;
|
|
6
|
+
accessible?: boolean;
|
|
7
|
+
testID?: string;
|
|
8
|
+
labelText?: string;
|
|
9
|
+
labelAllowFontScaling?: boolean;
|
|
10
|
+
href?: string;
|
|
11
|
+
label?: (props: {
|
|
12
|
+
focused: boolean;
|
|
13
|
+
color: string;
|
|
14
|
+
style?: StyleProp<TextStyle>;
|
|
15
|
+
allowFontScaling?: boolean;
|
|
16
|
+
label?: string;
|
|
17
|
+
route: T;
|
|
18
|
+
}) => React.ReactElement;
|
|
19
|
+
icon?: (props: {
|
|
20
|
+
focused: boolean;
|
|
21
|
+
color: string;
|
|
22
|
+
size: number;
|
|
23
|
+
route: T;
|
|
24
|
+
}) => React.ReactElement;
|
|
25
|
+
badge?: () => React.ReactElement;
|
|
26
|
+
};
|
|
3
27
|
export type LocaleDirection = 'ltr' | 'rtl';
|
|
4
28
|
export type Route = {
|
|
5
29
|
key: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAA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
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-tab-view",
|
|
3
3
|
"description": "Tab view component for React Native",
|
|
4
|
-
"version": "4.0.0-alpha.
|
|
4
|
+
"version": "4.0.0-alpha.10",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native-component",
|
|
7
7
|
"react-component",
|
|
@@ -39,20 +39,20 @@
|
|
|
39
39
|
"clean": "del lib"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"use-latest-callback": "^0.1.
|
|
42
|
+
"use-latest-callback": "^0.1.9"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"del-cli": "^5.
|
|
45
|
+
"del-cli": "^5.1.0",
|
|
46
46
|
"react": "18.2.0",
|
|
47
|
-
"react-native": "0.
|
|
48
|
-
"react-native-builder-bob": "^0.
|
|
49
|
-
"react-native-pager-view": "6.
|
|
50
|
-
"typescript": "^
|
|
47
|
+
"react-native": "0.73.2",
|
|
48
|
+
"react-native-builder-bob": "^0.23.2",
|
|
49
|
+
"react-native-pager-view": "6.2.3",
|
|
50
|
+
"typescript": "^5.3.3"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"react": "
|
|
54
|
-
"react-native": "
|
|
55
|
-
"react-native-pager-view": "
|
|
53
|
+
"react": ">= 18.2.0",
|
|
54
|
+
"react-native": ">= 0.72.0",
|
|
55
|
+
"react-native-pager-view": ">= 6.0.0"
|
|
56
56
|
},
|
|
57
57
|
"react-native-builder-bob": {
|
|
58
58
|
"source": "src",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
]
|
|
69
69
|
]
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "a601b72a5ae354900ab21f0e0293cb2c573ba8d0"
|
|
72
72
|
}
|
package/src/PagerViewAdapter.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Animated, Keyboard, StyleSheet } from 'react-native';
|
|
3
3
|
import ViewPager, {
|
|
4
|
-
PageScrollStateChangedNativeEvent,
|
|
4
|
+
type PageScrollStateChangedNativeEvent,
|
|
5
5
|
} from 'react-native-pager-view';
|
|
6
6
|
|
|
7
7
|
import type {
|
|
@@ -49,7 +49,7 @@ export function PagerViewAdapter<T extends Route>({
|
|
|
49
49
|
|
|
50
50
|
const listenersRef = React.useRef<Listener[]>([]);
|
|
51
51
|
|
|
52
|
-
const pagerRef = React.useRef<ViewPager>();
|
|
52
|
+
const pagerRef = React.useRef<ViewPager>(null);
|
|
53
53
|
const indexRef = React.useRef<number>(index);
|
|
54
54
|
const navigationStateRef = React.useRef(navigationState);
|
|
55
55
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Animated,
|
|
4
|
-
GestureResponderEvent,
|
|
4
|
+
type GestureResponderEvent,
|
|
5
5
|
Keyboard,
|
|
6
6
|
PanResponder,
|
|
7
|
-
PanResponderGestureState,
|
|
7
|
+
type PanResponderGestureState,
|
|
8
8
|
StyleSheet,
|
|
9
9
|
View,
|
|
10
10
|
} from 'react-native';
|
|
@@ -320,8 +320,8 @@ export function PanResponderAdapter<T extends Route>({
|
|
|
320
320
|
layout.width
|
|
321
321
|
? { width: layout.width }
|
|
322
322
|
: focused
|
|
323
|
-
|
|
324
|
-
|
|
323
|
+
? StyleSheet.absoluteFill
|
|
324
|
+
: null
|
|
325
325
|
}
|
|
326
326
|
>
|
|
327
327
|
{focused || layout.width ? child : null}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
type GestureResponderEvent,
|
|
4
|
+
Platform,
|
|
5
|
+
Pressable,
|
|
6
|
+
type PressableProps,
|
|
7
|
+
} from 'react-native';
|
|
3
8
|
|
|
4
9
|
export type Props = PressableProps & {
|
|
10
|
+
children: React.ReactNode;
|
|
5
11
|
pressColor?: string;
|
|
6
12
|
pressOpacity?: number;
|
|
7
|
-
|
|
13
|
+
href?: string;
|
|
8
14
|
};
|
|
9
15
|
|
|
10
16
|
const ANDROID_VERSION_LOLLIPOP = 21;
|
|
@@ -19,12 +25,34 @@ const ANDROID_SUPPORTS_RIPPLE =
|
|
|
19
25
|
* On other platforms, you can pass the props of TouchableOpacity.
|
|
20
26
|
*/
|
|
21
27
|
export function PlatformPressable({
|
|
28
|
+
disabled,
|
|
22
29
|
android_ripple,
|
|
23
30
|
pressColor = 'rgba(0, 0, 0, .32)',
|
|
24
31
|
pressOpacity,
|
|
25
32
|
style,
|
|
33
|
+
onPress,
|
|
26
34
|
...rest
|
|
27
35
|
}: Props) {
|
|
36
|
+
const handlePress = (e: GestureResponderEvent) => {
|
|
37
|
+
// @ts-expect-error: these properties exist on web, but not in React Native
|
|
38
|
+
const hasModifierKey = e.metaKey || e.altKey || e.ctrlKey || e.shiftKey; // ignore clicks with modifier keys
|
|
39
|
+
// @ts-expect-error: these properties exist on web, but not in React Native
|
|
40
|
+
const isLeftClick = e.button == null || e.button === 0; // only handle left clicks
|
|
41
|
+
const isSelfTarget = [undefined, null, '', 'self'].includes(
|
|
42
|
+
// @ts-expect-error: these properties exist on web, but not in React Native
|
|
43
|
+
e.currentTarget?.target
|
|
44
|
+
); // let browser handle "target=_blank" etc.
|
|
45
|
+
|
|
46
|
+
if (Platform.OS === 'web' && rest.href != null) {
|
|
47
|
+
if (!hasModifierKey && isLeftClick && isSelfTarget) {
|
|
48
|
+
e.preventDefault();
|
|
49
|
+
onPress?.(e);
|
|
50
|
+
}
|
|
51
|
+
} else {
|
|
52
|
+
onPress?.(e);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
28
56
|
return (
|
|
29
57
|
<Pressable
|
|
30
58
|
android_ripple={
|
|
@@ -36,6 +64,7 @@ export function PlatformPressable({
|
|
|
36
64
|
{ opacity: pressed && !ANDROID_SUPPORTS_RIPPLE ? pressOpacity : 1 },
|
|
37
65
|
typeof style === 'function' ? style({ pressed }) : style,
|
|
38
66
|
]}
|
|
67
|
+
onPress={disabled ? undefined : handlePress}
|
|
39
68
|
{...rest}
|
|
40
69
|
/>
|
|
41
70
|
);
|
package/src/SceneMap.tsx
CHANGED
|
@@ -15,9 +15,7 @@ const SceneComponent = React.memo(
|
|
|
15
15
|
}
|
|
16
16
|
);
|
|
17
17
|
|
|
18
|
-
export function SceneMap<T
|
|
19
|
-
[key: string]: React.ComponentType<T>;
|
|
20
|
-
}) {
|
|
18
|
+
export function SceneMap<T>(scenes: { [key: string]: React.ComponentType<T> }) {
|
|
21
19
|
return ({ route, jumpTo, position }: SceneProps) => (
|
|
22
20
|
<SceneComponent
|
|
23
21
|
key={route.key}
|
package/src/SceneView.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { StyleProp, StyleSheet, View, ViewStyle } from 'react-native';
|
|
2
|
+
import { type StyleProp, StyleSheet, View, type ViewStyle } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import type {
|
|
5
5
|
EventEmitterProps,
|
|
@@ -54,7 +54,7 @@ export function SceneView<T extends Route>({
|
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
let unsubscribe: (() => void) | undefined;
|
|
57
|
-
let timer:
|
|
57
|
+
let timer: NodeJS.Timeout | undefined;
|
|
58
58
|
|
|
59
59
|
if (lazy && isLoading) {
|
|
60
60
|
// If lazy mode is enabled, listen to when we enter screens
|
|
@@ -84,8 +84,8 @@ export function SceneView<T extends Route>({
|
|
|
84
84
|
layout.width
|
|
85
85
|
? { width: layout.width }
|
|
86
86
|
: focused
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
? StyleSheet.absoluteFill
|
|
88
|
+
: null,
|
|
89
89
|
style,
|
|
90
90
|
]}
|
|
91
91
|
>
|