@amazon-devices/react-navigation__react-native-tab-view 7.0.1758683737 → 8.0.9000000000
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/README.md +2 -646
- package/SystemBundles/6f915df16edbc21a601928d99e844a99397b9428146027dcf0d86b2a798f21f4.bundle +8563 -0
- package/SystemBundles/6f915df16edbc21a601928d99e844a99397b9428146027dcf0d86b2a798f21f4.map +3217 -0
- package/SystemModules/amzn__react-navigation__react-native-tab-view-8.modules.txt +12 -0
- package/SystemModules/amzn__react-navigation__react-native-tab-view-8.private.modules.txt +63 -0
- package/SystemModules/keplerscript-system-bundle-config.json +4 -4
- package/kepler-compatibility.json +2 -4
- package/lib/module/Pager.android.js +3 -1
- package/lib/module/Pager.android.js.map +1 -1
- package/lib/module/Pager.ios.js +3 -1
- package/lib/module/Pager.ios.js.map +1 -1
- package/lib/module/Pager.js +3 -1
- package/lib/module/Pager.js.map +1 -1
- package/lib/module/PagerViewAdapter.js +29 -22
- package/lib/module/PagerViewAdapter.js.map +1 -1
- package/lib/module/PanResponderAdapter.js +46 -32
- package/lib/module/PanResponderAdapter.js.map +1 -1
- package/lib/module/PlatformPressable.js +38 -12
- package/lib/module/PlatformPressable.js.map +1 -1
- package/lib/module/SceneMap.js +7 -4
- package/lib/module/SceneMap.js.map +1 -1
- package/lib/module/SceneView.js +16 -14
- package/lib/module/SceneView.js.map +1 -1
- package/lib/module/TabBar.js +232 -156
- package/lib/module/TabBar.js.map +1 -1
- package/lib/module/TabBarIndicator.js +47 -26
- package/lib/module/TabBarIndicator.js.map +1 -1
- package/lib/module/TabBarItem.js +106 -107
- package/lib/module/TabBarItem.js.map +1 -1
- package/lib/module/TabBarItemLabel.js +33 -0
- package/lib/module/TabBarItemLabel.js.map +1 -0
- package/lib/module/TabView.js +91 -63
- package/lib/module/TabView.js.map +1 -1
- package/lib/module/index.js +7 -5
- package/lib/module/index.js.map +1 -1
- package/lib/module/package.json +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -1
- package/lib/module/useAnimatedValue.js +4 -2
- package/lib/module/useAnimatedValue.js.map +1 -1
- package/lib/typescript/package.json +1 -0
- 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 +4 -1
- package/lib/typescript/src/PagerViewAdapter.d.ts.map +1 -1
- package/lib/typescript/src/PanResponderAdapter.d.ts +4 -1
- package/lib/typescript/src/PanResponderAdapter.d.ts.map +1 -1
- package/lib/typescript/src/PlatformPressable.d.ts +6 -8
- 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 -19
- package/lib/typescript/src/TabBar.d.ts.map +1 -1
- package/lib/typescript/src/TabBarIndicator.d.ts +8 -6
- package/lib/typescript/src/TabBarIndicator.d.ts.map +1 -1
- package/lib/typescript/src/TabBarItem.d.ts +4 -22
- package/lib/typescript/src/TabBarItem.d.ts.map +1 -1
- package/lib/typescript/src/TabBarItemLabel.d.ts +11 -0
- package/lib/typescript/src/TabBarItemLabel.d.ts.map +1 -0
- package/lib/typescript/src/TabView.d.ts +14 -8
- package/lib/typescript/src/TabView.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +6 -6
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +29 -1
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/useAnimatedValue.d.ts +1 -1
- package/lib/typescript/src/useAnimatedValue.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Pager.android.tsx +1 -1
- package/src/Pager.ios.tsx +1 -1
- package/src/Pager.tsx +1 -1
- package/src/PagerViewAdapter.tsx +26 -21
- package/src/PanResponderAdapter.tsx +32 -28
- package/src/PlatformPressable.tsx +59 -10
- package/src/SceneMap.tsx +3 -3
- package/src/SceneView.tsx +6 -7
- package/src/TabBar.tsx +282 -193
- package/src/TabBarIndicator.tsx +65 -28
- package/src/TabBarItem.tsx +119 -130
- package/src/TabBarItemLabel.tsx +42 -0
- package/src/TabView.tsx +59 -16
- package/src/index.tsx +11 -6
- package/src/types.tsx +29 -1
- package/src/useAnimatedValue.tsx +2 -2
- package/SystemBundles/0c296a88d0023a3995e190db70259767d1ef39c9da6cd47f3d76cd128687f1f6.bundle +0 -14497
- package/SystemBundles/0c296a88d0023a3995e190db70259767d1ef39c9da6cd47f3d76cd128687f1f6.map +0 -1
- package/SystemModules/amzn__react-navigation__react-native-tab-view-7.modules.txt +0 -41
- package/SystemModules/amzn__react-navigation__react-native-tab-view-7.private.modules.txt +0 -98
- package/THIRD_PARTY_NOTICES.txt +0 -24
- package/lib/commonjs/Pager.android.js +0 -14
- package/lib/commonjs/Pager.android.js.map +0 -1
- package/lib/commonjs/Pager.ios.js +0 -14
- package/lib/commonjs/Pager.ios.js.map +0 -1
- package/lib/commonjs/Pager.js +0 -14
- package/lib/commonjs/Pager.js.map +0 -1
- package/lib/commonjs/PagerViewAdapter.js +0 -132
- package/lib/commonjs/PagerViewAdapter.js.map +0 -1
- package/lib/commonjs/PanResponderAdapter.js +0 -204
- package/lib/commonjs/PanResponderAdapter.js.map +0 -1
- package/lib/commonjs/PlatformPressable.js +0 -43
- package/lib/commonjs/PlatformPressable.js.map +0 -1
- package/lib/commonjs/SceneMap.js +0 -29
- package/lib/commonjs/SceneMap.js.map +0 -1
- package/lib/commonjs/SceneView.js +0 -78
- package/lib/commonjs/SceneView.js.map +0 -1
- package/lib/commonjs/TabBar.js +0 -405
- package/lib/commonjs/TabBar.js.map +0 -1
- package/lib/commonjs/TabBarIndicator.js +0 -110
- package/lib/commonjs/TabBarIndicator.js.map +0 -1
- package/lib/commonjs/TabBarItem.js +0 -227
- package/lib/commonjs/TabBarItem.js.map +0 -1
- package/lib/commonjs/TabView.js +0 -122
- package/lib/commonjs/TabView.js.map +0 -1
- package/lib/commonjs/index.js +0 -42
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/types.js +0 -6
- package/lib/commonjs/types.js.map +0 -1
- package/lib/commonjs/useAnimatedValue.js +0 -18
- package/lib/commonjs/useAnimatedValue.js.map +0 -1
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
-
import type { Layout, NavigationState, PagerProps, Route, SceneRendererProps } from './types';
|
|
4
|
-
export type Props<T extends Route> = PagerProps & {
|
|
2
|
+
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
import type { Layout, LocaleDirection, NavigationState, PagerProps, Route, SceneRendererProps, TabDescriptor } from './types';
|
|
4
|
+
export type Props<T extends Route> = Omit<PagerProps, 'layoutDirection'> & {
|
|
5
5
|
onIndexChange: (index: number) => void;
|
|
6
|
+
onTabSelect?: (props: {
|
|
7
|
+
index: number;
|
|
8
|
+
}) => void;
|
|
6
9
|
navigationState: NavigationState<T>;
|
|
7
|
-
renderScene: (props: SceneRendererProps & {
|
|
8
|
-
route: T;
|
|
9
|
-
}) => React.ReactNode;
|
|
10
10
|
renderLazyPlaceholder?: (props: {
|
|
11
11
|
route: T;
|
|
12
12
|
}) => React.ReactNode;
|
|
13
13
|
renderTabBar?: (props: SceneRendererProps & {
|
|
14
14
|
navigationState: NavigationState<T>;
|
|
15
|
+
options: Record<string, TabDescriptor<T>> | undefined;
|
|
15
16
|
}) => React.ReactNode;
|
|
16
17
|
tabBarPosition?: 'top' | 'bottom';
|
|
17
18
|
initialLayout?: Partial<Layout>;
|
|
@@ -19,9 +20,14 @@ export type Props<T extends Route> = PagerProps & {
|
|
|
19
20
|
route: T;
|
|
20
21
|
}) => boolean) | boolean;
|
|
21
22
|
lazyPreloadDistance?: number;
|
|
22
|
-
|
|
23
|
+
direction?: LocaleDirection;
|
|
23
24
|
pagerStyle?: StyleProp<ViewStyle>;
|
|
24
25
|
style?: StyleProp<ViewStyle>;
|
|
26
|
+
renderScene: (props: SceneRendererProps & {
|
|
27
|
+
route: T;
|
|
28
|
+
}) => React.ReactNode;
|
|
29
|
+
options?: Record<string, TabDescriptor<T>>;
|
|
30
|
+
commonOptions?: TabDescriptor<T>;
|
|
25
31
|
};
|
|
26
|
-
export
|
|
32
|
+
export declare function TabView<T extends Route>({ onIndexChange, onTabSelect, navigationState, renderScene, initialLayout, keyboardDismissMode, lazy, lazyPreloadDistance, onSwipeStart, onSwipeEnd, renderLazyPlaceholder, renderTabBar, pagerStyle, style, direction, swipeEnabled, tabBarPosition, animationEnabled, overScrollMode, options: sceneOptions, commonOptions, }: Props<T>): import("react/jsx-runtime").JSX.Element;
|
|
27
33
|
//# 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,
|
|
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,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,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 {
|
|
1
|
+
export { SceneMap } from './SceneMap';
|
|
2
2
|
export type { Props as TabBarProps } from './TabBar';
|
|
3
|
-
export {
|
|
3
|
+
export { TabBar } from './TabBar';
|
|
4
4
|
export type { Props as TabBarIndicatorProps } from './TabBarIndicator';
|
|
5
|
-
export {
|
|
5
|
+
export { TabBarIndicator } from './TabBarIndicator';
|
|
6
6
|
export type { Props as TabBarItemProps } from './TabBarItem';
|
|
7
|
-
export {
|
|
7
|
+
export { TabBarItem } from './TabBarItem';
|
|
8
8
|
export type { Props as TabViewProps } from './TabView';
|
|
9
|
-
export {
|
|
10
|
-
export type { NavigationState, Route, SceneRendererProps } from './types';
|
|
9
|
+
export { TabView } from './TabView';
|
|
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,
|
|
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,33 @@
|
|
|
1
|
-
import type { Animated } from 'react-native';
|
|
1
|
+
import type { Animated, StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
2
2
|
import type { PagerViewProps } from 'react-native-pager-view';
|
|
3
|
+
export type TabDescriptor<T extends Route> = {
|
|
4
|
+
accessibilityLabel?: string;
|
|
5
|
+
accessible?: boolean;
|
|
6
|
+
testID?: string;
|
|
7
|
+
labelText?: string;
|
|
8
|
+
labelAllowFontScaling?: boolean;
|
|
9
|
+
href?: string;
|
|
10
|
+
label?: (props: {
|
|
11
|
+
route: T;
|
|
12
|
+
labelText?: string;
|
|
13
|
+
focused: boolean;
|
|
14
|
+
color: string;
|
|
15
|
+
allowFontScaling?: boolean;
|
|
16
|
+
style?: StyleProp<TextStyle>;
|
|
17
|
+
}) => React.ReactNode;
|
|
18
|
+
labelStyle?: StyleProp<TextStyle>;
|
|
19
|
+
icon?: (props: {
|
|
20
|
+
route: T;
|
|
21
|
+
focused: boolean;
|
|
22
|
+
color: string;
|
|
23
|
+
size: number;
|
|
24
|
+
}) => React.ReactNode;
|
|
25
|
+
badge?: (props: {
|
|
26
|
+
route: T;
|
|
27
|
+
}) => React.ReactElement;
|
|
28
|
+
sceneStyle?: StyleProp<ViewStyle>;
|
|
29
|
+
};
|
|
30
|
+
export type LocaleDirection = 'ltr' | 'rtl';
|
|
3
31
|
export type Route = {
|
|
4
32
|
key: string;
|
|
5
33
|
icon?: 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":"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"}
|
|
@@ -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,
|
|
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,GAOzB,QAAQ,CAAC,KAAK,CACzC"}
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name": "@amazon-devices/react-navigation__react-native-tab-view", "description": "Tab view component for React Native", "version": "
|
|
1
|
+
{"name": "@amazon-devices/react-navigation__react-native-tab-view", "description": "Tab view component for React Native", "version": "8.0.9000000000+4.2.0", "keywords": ["react-native-component", "react-component", "react-native", "ios", "android", "tab", "swipe", "scrollable", "coverflow"], "license": "See license in LICENSE", "repository": {"type": "git", "url": "https://github.com/react-navigation/react-navigation.git", "directory": "packages/react-native-tab-view"}, "bugs": {"url": "https://github.com/react-navigation/react-navigation/issues"}, "homepage": "https://reactnavigation.org/docs/tab-view/", "main": "./lib/module/index.js", "types": "./lib/typescript/src/index.d.ts", "exports": {".": {"source": "./src/index.tsx", "types": "./lib/typescript/src/index.d.ts", "default": "./lib/module/index.js"}, "./package.json": "./package.json"}, "files": ["src", "lib", "!**/__tests__", "kepler-compatibility.json", "SystemModules", "SystemBundles", "kepler-transformed-package-info.json"], "sideEffects": false, "kepler": {"temporary-alias-for-package": {"name": "@react-navigation/react-native-tab-view", "version": "4.0.5"}}, "scripts": {"clean": "del lib"}, "dependencies": {"use-latest-callback": "^0.2.4"}, "devDependencies": {"@jest/globals": "^30.0.0", "@testing-library/react-native": "^13.2.0", "del-cli": "^6.0.0", "react": "19.0.0", "react-native": "0.79.3", "react-native-builder-bob": "^0.40.12", "react-native-pager-view": "6.8.1", "react-test-renderer": "19.0.0", "typescript": "^5.8.3"}, "peerDependencies": {"react": ">= 18.2.0", "react-native": "*", "react-native-pager-view": ">= 6.0.0"}, "react-native-builder-bob": {"source": "src", "output": "lib", "targets": [["module", {"esm": true}], ["typescript", {"project": "tsconfig.build.json"}]]}}
|
package/src/Pager.android.tsx
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { PagerViewAdapter as Pager } from './PagerViewAdapter';
|
package/src/Pager.ios.tsx
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { PagerViewAdapter as Pager } from './PagerViewAdapter';
|
package/src/Pager.tsx
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { PanResponderAdapter as Pager } from './PanResponderAdapter';
|
package/src/PagerViewAdapter.tsx
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { Animated, Keyboard, StyleSheet } from 'react-native';
|
|
2
|
+
import { Animated, Keyboard, Platform, StyleSheet } from 'react-native';
|
|
3
3
|
import ViewPager, {
|
|
4
|
-
PageScrollStateChangedNativeEvent,
|
|
4
|
+
type PageScrollStateChangedNativeEvent,
|
|
5
5
|
} from 'react-native-pager-view';
|
|
6
|
+
import useLatestCallback from 'use-latest-callback';
|
|
6
7
|
|
|
7
8
|
import type {
|
|
8
9
|
EventEmitterProps,
|
|
@@ -11,12 +12,13 @@ import type {
|
|
|
11
12
|
PagerProps,
|
|
12
13
|
Route,
|
|
13
14
|
} from './types';
|
|
14
|
-
import useAnimatedValue from './useAnimatedValue';
|
|
15
|
+
import { useAnimatedValue } from './useAnimatedValue';
|
|
15
16
|
|
|
16
17
|
const AnimatedViewPager = Animated.createAnimatedComponent(ViewPager);
|
|
17
18
|
|
|
18
19
|
type Props<T extends Route> = PagerProps & {
|
|
19
20
|
onIndexChange: (index: number) => void;
|
|
21
|
+
onTabSelect?: (props: { index: number }) => void;
|
|
20
22
|
navigationState: NavigationState<T>;
|
|
21
23
|
children: (
|
|
22
24
|
props: EventEmitterProps & {
|
|
@@ -33,11 +35,14 @@ type Props<T extends Route> = PagerProps & {
|
|
|
33
35
|
) => React.ReactElement;
|
|
34
36
|
};
|
|
35
37
|
|
|
36
|
-
|
|
38
|
+
const useNativeDriver = Platform.OS !== 'web';
|
|
39
|
+
|
|
40
|
+
export function PagerViewAdapter<T extends Route>({
|
|
37
41
|
keyboardDismissMode = 'auto',
|
|
38
42
|
swipeEnabled = true,
|
|
39
43
|
navigationState,
|
|
40
44
|
onIndexChange,
|
|
45
|
+
onTabSelect,
|
|
41
46
|
onSwipeStart,
|
|
42
47
|
onSwipeEnd,
|
|
43
48
|
children,
|
|
@@ -60,21 +65,20 @@ export default function PagerViewAdapter<T extends Route>({
|
|
|
60
65
|
navigationStateRef.current = navigationState;
|
|
61
66
|
});
|
|
62
67
|
|
|
63
|
-
const jumpTo =
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
);
|
|
68
|
+
const jumpTo = useLatestCallback((key: string) => {
|
|
69
|
+
const index = navigationStateRef.current.routes.findIndex(
|
|
70
|
+
(route: { key: string }) => route.key === key
|
|
71
|
+
);
|
|
68
72
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
);
|
|
73
|
+
if (animationEnabled) {
|
|
74
|
+
pagerRef.current?.setPage(index);
|
|
75
|
+
} else {
|
|
76
|
+
pagerRef.current?.setPageWithoutAnimation(index);
|
|
77
|
+
position.setValue(index);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
onIndexChange(index);
|
|
81
|
+
});
|
|
78
82
|
|
|
79
83
|
React.useEffect(() => {
|
|
80
84
|
if (keyboardDismissMode === 'auto') {
|
|
@@ -118,7 +122,7 @@ export default function PagerViewAdapter<T extends Route>({
|
|
|
118
122
|
}
|
|
119
123
|
};
|
|
120
124
|
|
|
121
|
-
const addEnterListener =
|
|
125
|
+
const addEnterListener = useLatestCallback((listener: Listener) => {
|
|
122
126
|
listenersRef.current.push(listener);
|
|
123
127
|
|
|
124
128
|
return () => {
|
|
@@ -128,7 +132,7 @@ export default function PagerViewAdapter<T extends Route>({
|
|
|
128
132
|
listenersRef.current.splice(index, 1);
|
|
129
133
|
}
|
|
130
134
|
};
|
|
131
|
-
}
|
|
135
|
+
});
|
|
132
136
|
|
|
133
137
|
const memoizedPosition = React.useMemo(
|
|
134
138
|
() => Animated.add(position, offset),
|
|
@@ -157,12 +161,13 @@ export default function PagerViewAdapter<T extends Route>({
|
|
|
157
161
|
},
|
|
158
162
|
},
|
|
159
163
|
],
|
|
160
|
-
{ useNativeDriver
|
|
164
|
+
{ useNativeDriver }
|
|
161
165
|
)}
|
|
162
166
|
onPageSelected={(e) => {
|
|
163
167
|
const index = e.nativeEvent.position;
|
|
164
168
|
indexRef.current = index;
|
|
165
169
|
onIndexChange(index);
|
|
170
|
+
onTabSelect?.({ index });
|
|
166
171
|
}}
|
|
167
172
|
onPageScrollStateChanged={onPageScrollStateChanged}
|
|
168
173
|
scrollEnabled={swipeEnabled}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Animated,
|
|
4
|
-
GestureResponderEvent,
|
|
5
|
-
I18nManager,
|
|
4
|
+
type GestureResponderEvent,
|
|
6
5
|
Keyboard,
|
|
7
6
|
PanResponder,
|
|
8
|
-
PanResponderGestureState,
|
|
7
|
+
type PanResponderGestureState,
|
|
9
8
|
StyleSheet,
|
|
10
9
|
View,
|
|
11
10
|
} from 'react-native';
|
|
11
|
+
import useLatestCallback from 'use-latest-callback';
|
|
12
12
|
|
|
13
13
|
import type {
|
|
14
14
|
EventEmitterProps,
|
|
@@ -18,11 +18,12 @@ import type {
|
|
|
18
18
|
PagerProps,
|
|
19
19
|
Route,
|
|
20
20
|
} from './types';
|
|
21
|
-
import useAnimatedValue from './useAnimatedValue';
|
|
21
|
+
import { useAnimatedValue } from './useAnimatedValue';
|
|
22
22
|
|
|
23
23
|
type Props<T extends Route> = PagerProps & {
|
|
24
24
|
layout: Layout;
|
|
25
25
|
onIndexChange: (index: number) => void;
|
|
26
|
+
onTabSelect?: (props: { index: number }) => void;
|
|
26
27
|
navigationState: NavigationState<T>;
|
|
27
28
|
children: (
|
|
28
29
|
props: EventEmitterProps & {
|
|
@@ -49,17 +50,19 @@ const DefaultTransitionSpec = {
|
|
|
49
50
|
overshootClamping: true,
|
|
50
51
|
};
|
|
51
52
|
|
|
52
|
-
export
|
|
53
|
+
export function PanResponderAdapter<T extends Route>({
|
|
53
54
|
layout,
|
|
54
55
|
keyboardDismissMode = 'auto',
|
|
55
56
|
swipeEnabled = true,
|
|
56
57
|
navigationState,
|
|
57
58
|
onIndexChange,
|
|
59
|
+
onTabSelect,
|
|
58
60
|
onSwipeStart,
|
|
59
61
|
onSwipeEnd,
|
|
60
62
|
children,
|
|
61
63
|
style,
|
|
62
64
|
animationEnabled = false,
|
|
65
|
+
layoutDirection = 'ltr',
|
|
63
66
|
}: Props<T>) {
|
|
64
67
|
const { routes, index } = navigationState;
|
|
65
68
|
|
|
@@ -70,14 +73,14 @@ export default function PanResponderAdapter<T extends Route>({
|
|
|
70
73
|
const navigationStateRef = React.useRef(navigationState);
|
|
71
74
|
const layoutRef = React.useRef(layout);
|
|
72
75
|
const onIndexChangeRef = React.useRef(onIndexChange);
|
|
73
|
-
|
|
76
|
+
const onTabSelectRef = React.useRef(onTabSelect);
|
|
74
77
|
const currentIndexRef = React.useRef(index);
|
|
75
|
-
const pendingIndexRef = React.useRef<number>();
|
|
78
|
+
const pendingIndexRef = React.useRef<number>(undefined);
|
|
76
79
|
|
|
77
80
|
const swipeVelocityThreshold = 0.15;
|
|
78
81
|
const swipeDistanceThreshold = layout.width / 1.75;
|
|
79
82
|
|
|
80
|
-
const jumpToIndex =
|
|
83
|
+
const jumpToIndex = useLatestCallback(
|
|
81
84
|
(index: number, animate = animationEnabled) => {
|
|
82
85
|
const offset = -index * layoutRef.current.width;
|
|
83
86
|
|
|
@@ -93,6 +96,7 @@ export default function PanResponderAdapter<T extends Route>({
|
|
|
93
96
|
]).start(({ finished }) => {
|
|
94
97
|
if (finished) {
|
|
95
98
|
onIndexChangeRef.current(index);
|
|
99
|
+
onTabSelectRef.current?.({ index });
|
|
96
100
|
pendingIndexRef.current = undefined;
|
|
97
101
|
}
|
|
98
102
|
});
|
|
@@ -100,16 +104,17 @@ export default function PanResponderAdapter<T extends Route>({
|
|
|
100
104
|
} else {
|
|
101
105
|
panX.setValue(offset);
|
|
102
106
|
onIndexChangeRef.current(index);
|
|
107
|
+
onTabSelectRef.current?.({ index });
|
|
103
108
|
pendingIndexRef.current = undefined;
|
|
104
109
|
}
|
|
105
|
-
}
|
|
106
|
-
[animationEnabled, panX]
|
|
110
|
+
}
|
|
107
111
|
);
|
|
108
112
|
|
|
109
113
|
React.useEffect(() => {
|
|
110
114
|
navigationStateRef.current = navigationState;
|
|
111
115
|
layoutRef.current = layout;
|
|
112
116
|
onIndexChangeRef.current = onIndexChange;
|
|
117
|
+
onTabSelectRef.current = onTabSelect;
|
|
113
118
|
});
|
|
114
119
|
|
|
115
120
|
React.useEffect(() => {
|
|
@@ -147,7 +152,8 @@ export default function PanResponderAdapter<T extends Route>({
|
|
|
147
152
|
return false;
|
|
148
153
|
}
|
|
149
154
|
|
|
150
|
-
const diffX =
|
|
155
|
+
const diffX =
|
|
156
|
+
layoutDirection === 'rtl' ? -gestureState.dx : gestureState.dx;
|
|
151
157
|
|
|
152
158
|
return (
|
|
153
159
|
isMovingHorizontally(event, gestureState) &&
|
|
@@ -172,7 +178,8 @@ export default function PanResponderAdapter<T extends Route>({
|
|
|
172
178
|
_: GestureResponderEvent,
|
|
173
179
|
gestureState: PanResponderGestureState
|
|
174
180
|
) => {
|
|
175
|
-
const diffX =
|
|
181
|
+
const diffX =
|
|
182
|
+
layoutDirection === 'rtl' ? -gestureState.dx : gestureState.dx;
|
|
176
183
|
|
|
177
184
|
if (
|
|
178
185
|
// swiping left
|
|
@@ -222,7 +229,7 @@ export default function PanResponderAdapter<T extends Route>({
|
|
|
222
229
|
Math.min(
|
|
223
230
|
Math.max(
|
|
224
231
|
0,
|
|
225
|
-
|
|
232
|
+
layoutDirection === 'rtl'
|
|
226
233
|
? currentIndex + gestureState.dx / Math.abs(gestureState.dx)
|
|
227
234
|
: currentIndex - gestureState.dx / Math.abs(gestureState.dx)
|
|
228
235
|
),
|
|
@@ -240,8 +247,7 @@ export default function PanResponderAdapter<T extends Route>({
|
|
|
240
247
|
jumpToIndex(nextIndex, true);
|
|
241
248
|
};
|
|
242
249
|
|
|
243
|
-
|
|
244
|
-
const addEnterListener = React.useCallback((listener: Listener) => {
|
|
250
|
+
const addEnterListener = useLatestCallback((listener: Listener) => {
|
|
245
251
|
listenersRef.current.push(listener);
|
|
246
252
|
|
|
247
253
|
return () => {
|
|
@@ -251,18 +257,16 @@ export default function PanResponderAdapter<T extends Route>({
|
|
|
251
257
|
listenersRef.current.splice(index, 1);
|
|
252
258
|
}
|
|
253
259
|
};
|
|
254
|
-
}
|
|
260
|
+
});
|
|
255
261
|
|
|
256
|
-
const jumpTo =
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
);
|
|
262
|
+
const jumpTo = useLatestCallback((key: string) => {
|
|
263
|
+
const index = navigationStateRef.current.routes.findIndex(
|
|
264
|
+
(route: { key: string }) => route.key === key
|
|
265
|
+
);
|
|
261
266
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
);
|
|
267
|
+
jumpToIndex(index);
|
|
268
|
+
onIndexChange(index);
|
|
269
|
+
});
|
|
266
270
|
|
|
267
271
|
const panResponder = PanResponder.create({
|
|
268
272
|
onMoveShouldSetPanResponder: canMoveScreen,
|
|
@@ -281,7 +285,7 @@ export default function PanResponderAdapter<T extends Route>({
|
|
|
281
285
|
outputRange: [-maxTranslate, 0],
|
|
282
286
|
extrapolate: 'clamp',
|
|
283
287
|
}),
|
|
284
|
-
|
|
288
|
+
layoutDirection === 'rtl' ? -1 : 1
|
|
285
289
|
);
|
|
286
290
|
|
|
287
291
|
const position = React.useMemo(
|
|
@@ -318,8 +322,8 @@ export default function PanResponderAdapter<T extends Route>({
|
|
|
318
322
|
layout.width
|
|
319
323
|
? { width: layout.width }
|
|
320
324
|
: focused
|
|
321
|
-
|
|
322
|
-
|
|
325
|
+
? StyleSheet.absoluteFill
|
|
326
|
+
: null
|
|
323
327
|
}
|
|
324
328
|
>
|
|
325
329
|
{focused || layout.width ? child : null}
|
|
@@ -1,9 +1,18 @@
|
|
|
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
|
-
export type Props = PressableProps & {
|
|
9
|
+
export type Props = Omit<PressableProps, 'onPress'> & {
|
|
10
|
+
href?: string;
|
|
5
11
|
pressColor?: string;
|
|
6
12
|
pressOpacity?: number;
|
|
13
|
+
onPress?: (
|
|
14
|
+
e: React.MouseEvent<HTMLAnchorElement, MouseEvent> | GestureResponderEvent
|
|
15
|
+
) => void;
|
|
7
16
|
children: React.ReactNode;
|
|
8
17
|
};
|
|
9
18
|
|
|
@@ -12,30 +21,70 @@ const ANDROID_SUPPORTS_RIPPLE =
|
|
|
12
21
|
Platform.OS === 'android' && Platform.Version >= ANDROID_VERSION_LOLLIPOP;
|
|
13
22
|
|
|
14
23
|
/**
|
|
15
|
-
* PlatformPressable provides an abstraction on top of
|
|
16
|
-
* TouchableOpacity to handle platform differences.
|
|
17
|
-
*
|
|
18
|
-
* On Android, you can pass the props of TouchableNativeFeedback.
|
|
19
|
-
* On other platforms, you can pass the props of TouchableOpacity.
|
|
24
|
+
* PlatformPressable provides an abstraction on top of Pressable to handle platform differences.
|
|
20
25
|
*/
|
|
21
|
-
export
|
|
26
|
+
export function PlatformPressable({
|
|
27
|
+
disabled,
|
|
22
28
|
android_ripple,
|
|
23
29
|
pressColor = 'rgba(0, 0, 0, .32)',
|
|
24
30
|
pressOpacity,
|
|
25
31
|
style,
|
|
32
|
+
onPress,
|
|
26
33
|
...rest
|
|
27
34
|
}: Props) {
|
|
35
|
+
const handlePress = (
|
|
36
|
+
e: React.MouseEvent<HTMLAnchorElement, MouseEvent> | GestureResponderEvent
|
|
37
|
+
) => {
|
|
38
|
+
if (Platform.OS === 'web' && rest.href !== null) {
|
|
39
|
+
// ignore clicks with modifier keys
|
|
40
|
+
const hasModifierKey =
|
|
41
|
+
('metaKey' in e && e.metaKey) ||
|
|
42
|
+
('altKey' in e && e.altKey) ||
|
|
43
|
+
('ctrlKey' in e && e.ctrlKey) ||
|
|
44
|
+
('shiftKey' in e && e.shiftKey);
|
|
45
|
+
|
|
46
|
+
// only handle left clicks
|
|
47
|
+
const isLeftClick =
|
|
48
|
+
'button' in e ? e.button == null || e.button === 0 : true;
|
|
49
|
+
|
|
50
|
+
// let browser handle "target=_blank" etc.
|
|
51
|
+
const isSelfTarget =
|
|
52
|
+
e.currentTarget && 'target' in e.currentTarget
|
|
53
|
+
? [undefined, null, '', 'self'].includes(e.currentTarget.target)
|
|
54
|
+
: true;
|
|
55
|
+
|
|
56
|
+
if (!hasModifierKey && isLeftClick && isSelfTarget) {
|
|
57
|
+
e.preventDefault();
|
|
58
|
+
// call `onPress` only when browser default is prevented
|
|
59
|
+
// this prevents app from handling the click when a link is being opened
|
|
60
|
+
onPress?.(e);
|
|
61
|
+
}
|
|
62
|
+
} else {
|
|
63
|
+
onPress?.(e);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
28
67
|
return (
|
|
29
68
|
<Pressable
|
|
30
69
|
android_ripple={
|
|
31
|
-
ANDROID_SUPPORTS_RIPPLE
|
|
70
|
+
ANDROID_SUPPORTS_RIPPLE && !disabled
|
|
32
71
|
? { color: pressColor, ...android_ripple }
|
|
33
72
|
: undefined
|
|
34
73
|
}
|
|
35
74
|
style={({ pressed }) => [
|
|
36
|
-
{
|
|
75
|
+
{
|
|
76
|
+
cursor:
|
|
77
|
+
(Platform.OS === 'web' || Platform.OS === 'ios') && !disabled
|
|
78
|
+
? // Pointer cursor on web
|
|
79
|
+
// Hover effect on iPad and visionOS
|
|
80
|
+
'pointer'
|
|
81
|
+
: 'auto',
|
|
82
|
+
opacity:
|
|
83
|
+
!ANDROID_SUPPORTS_RIPPLE && pressed && !disabled ? pressOpacity : 1,
|
|
84
|
+
} as const,
|
|
37
85
|
typeof style === 'function' ? style({ pressed }) : style,
|
|
38
86
|
]}
|
|
87
|
+
onPress={disabled ? undefined : handlePress}
|
|
39
88
|
{...rest}
|
|
40
89
|
/>
|
|
41
90
|
);
|
package/src/SceneMap.tsx
CHANGED
|
@@ -15,9 +15,9 @@ const SceneComponent = React.memo(
|
|
|
15
15
|
}
|
|
16
16
|
);
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}) {
|
|
18
|
+
SceneComponent.displayName = 'SceneComponent';
|
|
19
|
+
|
|
20
|
+
export function SceneMap<T>(scenes: { [key: string]: React.ComponentType<T> }) {
|
|
21
21
|
return ({ route, jumpTo, position }: SceneProps) => (
|
|
22
22
|
<SceneComponent
|
|
23
23
|
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,
|
|
@@ -18,7 +18,7 @@ type Props<T extends Route> = SceneRendererProps &
|
|
|
18
18
|
style?: StyleProp<ViewStyle>;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
export
|
|
21
|
+
export function SceneView<T extends Route>({
|
|
22
22
|
children,
|
|
23
23
|
navigationState,
|
|
24
24
|
lazy,
|
|
@@ -54,7 +54,7 @@ export default function SceneView<T extends Route>({
|
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
let unsubscribe: (() => void) | undefined;
|
|
57
|
-
let timer:
|
|
57
|
+
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
58
58
|
|
|
59
59
|
if (lazy && isLoading) {
|
|
60
60
|
// If lazy mode is enabled, listen to when we enter screens
|
|
@@ -75,8 +75,7 @@ export default function SceneView<T extends Route>({
|
|
|
75
75
|
|
|
76
76
|
return (
|
|
77
77
|
<View
|
|
78
|
-
|
|
79
|
-
importantForAccessibility={focused ? 'auto' : 'no-hide-descendants'}
|
|
78
|
+
aria-hidden={!focused}
|
|
80
79
|
style={[
|
|
81
80
|
styles.route,
|
|
82
81
|
// If we don't have the layout yet, make the focused screen fill the container
|
|
@@ -84,8 +83,8 @@ export default function SceneView<T extends Route>({
|
|
|
84
83
|
layout.width
|
|
85
84
|
? { width: layout.width }
|
|
86
85
|
: focused
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
? StyleSheet.absoluteFill
|
|
87
|
+
: null,
|
|
89
88
|
style,
|
|
90
89
|
]}
|
|
91
90
|
>
|