@codeleap/mobile 5.2.4 → 5.2.5
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/dist/components/Tabs/Context.d.ts +3 -1
- package/dist/components/Tabs/Context.js +14 -2
- package/dist/components/Tabs/Context.js.map +1 -1
- package/dist/components/Tabs/Tab.js +1 -1
- package/dist/components/Tabs/Tab.js.map +1 -1
- package/dist/components/Tabs/TabList.d.ts +2 -2
- package/dist/components/Tabs/TabList.js +5 -3
- package/dist/components/Tabs/TabList.js.map +1 -1
- package/dist/components/Tabs/index.d.ts +203 -1
- package/package.json +17 -17
- package/package.json.bak +1 -1
- package/src/components/Tabs/Context.tsx +18 -2
- package/src/components/Tabs/Tab.tsx +1 -1
- package/src/components/Tabs/TabList.tsx +13 -5
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { TabsContextProps, TabsStyles } from './types';
|
|
3
|
+
import { FlatList } from 'react-native';
|
|
3
4
|
export declare function TabsProvider({ children, ...handleProps }: TabsContextProps & {
|
|
4
5
|
styles: TabsStyles;
|
|
5
6
|
}): JSX.Element;
|
|
6
7
|
export declare function useTabContext(): {
|
|
7
8
|
value: string;
|
|
8
|
-
setValue:
|
|
9
|
+
setValue: (newValue: string, index?: number) => void;
|
|
9
10
|
styles: TabsStyles;
|
|
10
11
|
keepMounted: boolean;
|
|
12
|
+
flatListRef: import("react").MutableRefObject<FlatList<any>>;
|
|
11
13
|
};
|
|
@@ -1,14 +1,26 @@
|
|
|
1
|
-
import { createContext, useContext, useState } from 'react';
|
|
1
|
+
import { createContext, useContext, useRef, useState } from 'react';
|
|
2
|
+
import { TypeGuards } from '@codeleap/types';
|
|
2
3
|
function useTabHandle(props) {
|
|
3
4
|
const { defaultValue, value, onValueChange, keepMounted, styles } = props;
|
|
4
|
-
const [tabValue,
|
|
5
|
+
const [tabValue, setInternalTabValue] = !onValueChange && !value
|
|
5
6
|
? useState(defaultValue)
|
|
6
7
|
: [value ?? defaultValue, onValueChange];
|
|
8
|
+
const flatListRef = useRef(null);
|
|
9
|
+
const setTabValue = (newValue, index) => {
|
|
10
|
+
if (TypeGuards.isNumber(index) && flatListRef.current) {
|
|
11
|
+
flatListRef.current.scrollToIndex({
|
|
12
|
+
index,
|
|
13
|
+
animated: true,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
setInternalTabValue(newValue);
|
|
17
|
+
};
|
|
7
18
|
return {
|
|
8
19
|
value: tabValue,
|
|
9
20
|
setValue: setTabValue,
|
|
10
21
|
styles,
|
|
11
22
|
keepMounted,
|
|
23
|
+
flatListRef,
|
|
12
24
|
};
|
|
13
25
|
}
|
|
14
26
|
const Context = createContext({});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Context.js","sourceRoot":"","sources":["../../../src/components/Tabs/Context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Context.js","sourceRoot":"","sources":["../../../src/components/Tabs/Context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAGnE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,SAAS,YAAY,CAAC,KAAgD;IACpE,MAAM,EACJ,YAAY,EACZ,KAAK,EACL,aAAa,EACb,WAAW,EACX,MAAM,EACP,GAAG,KAAK,CAAA;IAET,MAAM,CAAC,QAAQ,EAAE,mBAAmB,CAAC,GAAG,CAAC,aAAa,IAAI,CAAC,KAAK;QAC9D,CAAC,CAAC,QAAQ,CAAS,YAAY,CAAC;QAChC,CAAC,CAAC,CAAC,KAAK,IAAI,YAAY,EAAE,aAAa,CAAC,CAAA;IAE1C,MAAM,WAAW,GAAG,MAAM,CAAW,IAAI,CAAC,CAAA;IAE1C,MAAM,WAAW,GAAG,CAAC,QAAgB,EAAE,KAAc,EAAE,EAAE;QACvD,IAAI,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,WAAW,CAAC,OAAO,EAAE;YACrD,WAAW,CAAC,OAAO,CAAC,aAAa,CAAC;gBAChC,KAAK;gBACL,QAAQ,EAAE,IAAI;aACf,CAAC,CAAA;SACH;QAED,mBAAmB,CAAC,QAAQ,CAAC,CAAA;IAC/B,CAAC,CAAA;IAED,OAAO;QACL,KAAK,EAAE,QAAQ;QACf,QAAQ,EAAE,WAAW;QACrB,MAAM;QACN,WAAW;QACX,WAAW;KACZ,CAAA;AACH,CAAC;AAED,MAAM,OAAO,GAAG,aAAa,CAAC,EAAqC,CAAC,CAAA;AAEpE,MAAM,UAAU,YAAY,CAAC,EAAE,QAAQ,EAAE,GAAG,WAAW,EAA6C;IAClG,MAAM,MAAM,GAAG,YAAY,CAAC,WAAW,CAAC,CAAA;IACxC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAA;AACvE,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,MAAM,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC,CAAA;IAE/B,IAAI,GAAG,KAAK,IAAI,EAAE;QAChB,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;KAC5D;IAED,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
|
@@ -26,6 +26,6 @@ const TabMemoized = memoBy((props) => {
|
|
|
26
26
|
export const Tab = (props) => {
|
|
27
27
|
const { value, setValue, styles } = useTabContext();
|
|
28
28
|
const active = value === props.value;
|
|
29
|
-
return <TabMemoized {...props} active={active} setValue={setValue} styles={styles}/>;
|
|
29
|
+
return <TabMemoized {...props} active={active} setValue={(value) => setValue(value, null)} styles={styles}/>;
|
|
30
30
|
};
|
|
31
31
|
//# source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=
|
|
2
|
+
import { FlatListProps } from 'react-native';
|
|
3
|
+
type TabListProps = Omit<FlatListProps<any>, 'data' | 'renderItem'>;
|
|
4
4
|
export declare const TabList: (props: TabListProps) => JSX.Element;
|
|
5
5
|
export {};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FlatList } from 'react-native';
|
|
2
2
|
import { useTabContext } from './Context';
|
|
3
3
|
export const TabList = (props) => {
|
|
4
|
-
const {
|
|
5
|
-
|
|
4
|
+
const { children, ...flatListProps } = props;
|
|
5
|
+
const { styles, flatListRef } = useTabContext();
|
|
6
|
+
const childrenArray = React.Children.toArray(children);
|
|
7
|
+
return (<FlatList horizontal showsHorizontalScrollIndicator={false} showsVerticalScrollIndicator={false} {...flatListProps} ref={flatListRef} data={childrenArray} renderItem={({ item }) => item} keyExtractor={(_, index) => `tab-${index}`} style={styles?.tabList} contentContainerStyle={styles?.tabListContainer}/>);
|
|
6
8
|
};
|
|
7
9
|
//# sourceMappingURL=TabList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabList.js","sourceRoot":"","sources":["../../../src/components/Tabs/TabList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"TabList.js","sourceRoot":"","sources":["../../../src/components/Tabs/TabList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAiB,MAAM,cAAc,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAIzC,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,KAAmB,EAAE,EAAE;IAC7C,MAAM,EAAE,QAAQ,EAAE,GAAG,aAAa,EAAE,GAAG,KAAK,CAAA;IAE5C,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,aAAa,EAAE,CAAA;IAE/C,MAAM,aAAa,GAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;IAEtD,OAAO,CACL,CAAC,QAAQ,CACP,UAAU,CACV,8BAA8B,CAAC,CAAC,KAAK,CAAC,CACtC,4BAA4B,CAAC,CAAC,KAAK,CAAC,CACpC,IAAI,aAAa,CAAC,CAClB,GAAG,CAAC,CAAC,WAAW,CAAC,CACjB,IAAI,CAAC,CAAC,aAAa,CAAC,CACpB,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,CAC/B,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,EAAE,CAAC,CAC3C,KAAK,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CACvB,qBAAqB,CAAC,CAAC,MAAM,EAAE,gBAAgB,CAAC,EAChD,CACH,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -16,7 +16,209 @@ export declare const Tabs: {
|
|
|
16
16
|
icon?: never;
|
|
17
17
|
disabled?: boolean;
|
|
18
18
|
}) => JSX.Element;
|
|
19
|
-
TabList: (props:
|
|
19
|
+
TabList: (props: {
|
|
20
|
+
style?: import("react-native/types").StyleProp<import("react-native/types").ViewStyle>;
|
|
21
|
+
debug?: boolean;
|
|
22
|
+
children?: import("react").ReactNode;
|
|
23
|
+
hitSlop?: number | import("react-native/types").Insets;
|
|
24
|
+
id?: string;
|
|
25
|
+
needsOffscreenAlphaCompositing?: boolean;
|
|
26
|
+
onLayout?: (event: import("react-native/types").LayoutChangeEvent) => void;
|
|
27
|
+
pointerEvents?: "none" | "auto" | "box-none" | "box-only";
|
|
28
|
+
removeClippedSubviews?: boolean;
|
|
29
|
+
testID?: string;
|
|
30
|
+
nativeID?: string;
|
|
31
|
+
experimental_layoutConformance?: "strict" | "classic";
|
|
32
|
+
collapsable?: boolean;
|
|
33
|
+
collapsableChildren?: boolean;
|
|
34
|
+
renderToHardwareTextureAndroid?: boolean;
|
|
35
|
+
focusable?: boolean;
|
|
36
|
+
tabIndex?: 0 | -1;
|
|
37
|
+
shouldRasterizeIOS?: boolean;
|
|
38
|
+
isTVSelectable?: boolean;
|
|
39
|
+
hasTVPreferredFocus?: boolean;
|
|
40
|
+
tvParallaxShiftDistanceX?: number;
|
|
41
|
+
tvParallaxShiftDistanceY?: number;
|
|
42
|
+
tvParallaxTiltAngle?: number;
|
|
43
|
+
tvParallaxMagnification?: number;
|
|
44
|
+
onStartShouldSetResponder?: (event: import("react-native/types").GestureResponderEvent) => boolean;
|
|
45
|
+
onMoveShouldSetResponder?: (event: import("react-native/types").GestureResponderEvent) => boolean;
|
|
46
|
+
onResponderEnd?: (event: import("react-native/types").GestureResponderEvent) => void;
|
|
47
|
+
onResponderGrant?: (event: import("react-native/types").GestureResponderEvent) => void;
|
|
48
|
+
onResponderReject?: (event: import("react-native/types").GestureResponderEvent) => void;
|
|
49
|
+
onResponderMove?: (event: import("react-native/types").GestureResponderEvent) => void;
|
|
50
|
+
onResponderRelease?: (event: import("react-native/types").GestureResponderEvent) => void;
|
|
51
|
+
onResponderStart?: (event: import("react-native/types").GestureResponderEvent) => void;
|
|
52
|
+
onResponderTerminationRequest?: (event: import("react-native/types").GestureResponderEvent) => boolean;
|
|
53
|
+
onResponderTerminate?: (event: import("react-native/types").GestureResponderEvent) => void;
|
|
54
|
+
onStartShouldSetResponderCapture?: (event: import("react-native/types").GestureResponderEvent) => boolean;
|
|
55
|
+
onMoveShouldSetResponderCapture?: (event: import("react-native/types").GestureResponderEvent) => boolean;
|
|
56
|
+
onTouchStart?: (event: import("react-native/types").GestureResponderEvent) => void;
|
|
57
|
+
onTouchMove?: (event: import("react-native/types").GestureResponderEvent) => void;
|
|
58
|
+
onTouchEnd?: (event: import("react-native/types").GestureResponderEvent) => void;
|
|
59
|
+
onTouchCancel?: (event: import("react-native/types").GestureResponderEvent) => void;
|
|
60
|
+
onTouchEndCapture?: (event: import("react-native/types").GestureResponderEvent) => void;
|
|
61
|
+
onPointerEnter?: (event: import("react-native/types").PointerEvent) => void;
|
|
62
|
+
onPointerEnterCapture?: (event: import("react-native/types").PointerEvent) => void;
|
|
63
|
+
onPointerLeave?: (event: import("react-native/types").PointerEvent) => void;
|
|
64
|
+
onPointerLeaveCapture?: (event: import("react-native/types").PointerEvent) => void;
|
|
65
|
+
onPointerMove?: (event: import("react-native/types").PointerEvent) => void;
|
|
66
|
+
onPointerMoveCapture?: (event: import("react-native/types").PointerEvent) => void;
|
|
67
|
+
onPointerCancel?: (event: import("react-native/types").PointerEvent) => void;
|
|
68
|
+
onPointerCancelCapture?: (event: import("react-native/types").PointerEvent) => void;
|
|
69
|
+
onPointerDown?: (event: import("react-native/types").PointerEvent) => void;
|
|
70
|
+
onPointerDownCapture?: (event: import("react-native/types").PointerEvent) => void;
|
|
71
|
+
onPointerUp?: (event: import("react-native/types").PointerEvent) => void;
|
|
72
|
+
onPointerUpCapture?: (event: import("react-native/types").PointerEvent) => void;
|
|
73
|
+
accessible?: boolean;
|
|
74
|
+
accessibilityActions?: readonly Readonly<{
|
|
75
|
+
name: string;
|
|
76
|
+
label?: string;
|
|
77
|
+
}>[];
|
|
78
|
+
accessibilityLabel?: string;
|
|
79
|
+
'aria-label'?: string;
|
|
80
|
+
accessibilityRole?: import("react-native/types").AccessibilityRole;
|
|
81
|
+
accessibilityState?: import("react-native/types").AccessibilityState;
|
|
82
|
+
'aria-busy'?: boolean;
|
|
83
|
+
'aria-checked'?: boolean | "mixed";
|
|
84
|
+
'aria-disabled'?: boolean;
|
|
85
|
+
'aria-expanded'?: boolean;
|
|
86
|
+
'aria-selected'?: boolean;
|
|
87
|
+
accessibilityHint?: string;
|
|
88
|
+
accessibilityValue?: import("react-native/types").AccessibilityValue;
|
|
89
|
+
'aria-valuemax'?: number;
|
|
90
|
+
'aria-valuemin'?: number;
|
|
91
|
+
'aria-valuenow'?: number;
|
|
92
|
+
'aria-valuetext'?: string;
|
|
93
|
+
onAccessibilityAction?: (event: import("react-native/types").AccessibilityActionEvent) => void;
|
|
94
|
+
importantForAccessibility?: "auto" | "yes" | "no" | "no-hide-descendants";
|
|
95
|
+
'aria-hidden'?: boolean;
|
|
96
|
+
'aria-modal'?: boolean;
|
|
97
|
+
role?: import("react-native/types").Role;
|
|
98
|
+
accessibilityLabelledBy?: string | string[];
|
|
99
|
+
'aria-labelledby'?: string;
|
|
100
|
+
accessibilityLiveRegion?: "none" | "polite" | "assertive";
|
|
101
|
+
'aria-live'?: "polite" | "assertive" | "off";
|
|
102
|
+
accessibilityElementsHidden?: boolean;
|
|
103
|
+
accessibilityViewIsModal?: boolean;
|
|
104
|
+
onAccessibilityEscape?: () => void;
|
|
105
|
+
onAccessibilityTap?: () => void;
|
|
106
|
+
onMagicTap?: () => void;
|
|
107
|
+
accessibilityIgnoresInvertColors?: boolean;
|
|
108
|
+
accessibilityLanguage?: string;
|
|
109
|
+
accessibilityShowsLargeContentViewer?: boolean;
|
|
110
|
+
accessibilityLargeContentTitle?: string;
|
|
111
|
+
onContentSizeChange?: (w: number, h: number) => void;
|
|
112
|
+
onScroll?: (event: import("react-native/types").NativeSyntheticEvent<import("react-native/types").NativeScrollEvent>) => void;
|
|
113
|
+
scrollEnabled?: boolean;
|
|
114
|
+
keyExtractor?: (item: any, index: number) => string;
|
|
115
|
+
contentContainerStyle?: import("react-native/types").StyleProp<import("react-native/types").ViewStyle>;
|
|
116
|
+
onMomentumScrollEnd?: (event: import("react-native/types").NativeSyntheticEvent<import("react-native/types").NativeScrollEvent>) => void;
|
|
117
|
+
decelerationRate?: number | "normal" | "fast";
|
|
118
|
+
horizontal?: boolean;
|
|
119
|
+
invertStickyHeaders?: boolean;
|
|
120
|
+
keyboardDismissMode?: "none" | "interactive" | "on-drag";
|
|
121
|
+
keyboardShouldPersistTaps?: boolean | "always" | "never" | "handled";
|
|
122
|
+
onScrollBeginDrag?: (event: import("react-native/types").NativeSyntheticEvent<import("react-native/types").NativeScrollEvent>) => void;
|
|
123
|
+
onScrollEndDrag?: (event: import("react-native/types").NativeSyntheticEvent<import("react-native/types").NativeScrollEvent>) => void;
|
|
124
|
+
onMomentumScrollBegin?: (event: import("react-native/types").NativeSyntheticEvent<import("react-native/types").NativeScrollEvent>) => void;
|
|
125
|
+
pagingEnabled?: boolean;
|
|
126
|
+
showsHorizontalScrollIndicator?: boolean;
|
|
127
|
+
showsVerticalScrollIndicator?: boolean;
|
|
128
|
+
stickyHeaderHiddenOnScroll?: boolean;
|
|
129
|
+
refreshControl?: import("react").ReactElement<import("react-native/types").RefreshControlProps, string | import("react").JSXElementConstructor<any>>;
|
|
130
|
+
snapToInterval?: number;
|
|
131
|
+
snapToOffsets?: number[];
|
|
132
|
+
snapToStart?: boolean;
|
|
133
|
+
snapToEnd?: boolean;
|
|
134
|
+
stickyHeaderIndices?: number[];
|
|
135
|
+
disableIntervalMomentum?: boolean;
|
|
136
|
+
disableScrollViewPanResponder?: boolean;
|
|
137
|
+
StickyHeaderComponent?: import("react").ComponentType<any>;
|
|
138
|
+
alwaysBounceHorizontal?: boolean;
|
|
139
|
+
alwaysBounceVertical?: boolean;
|
|
140
|
+
automaticallyAdjustContentInsets?: boolean;
|
|
141
|
+
automaticallyAdjustKeyboardInsets?: boolean;
|
|
142
|
+
automaticallyAdjustsScrollIndicatorInsets?: boolean;
|
|
143
|
+
bounces?: boolean;
|
|
144
|
+
bouncesZoom?: boolean;
|
|
145
|
+
canCancelContentTouches?: boolean;
|
|
146
|
+
centerContent?: boolean;
|
|
147
|
+
contentInset?: import("react-native/types").Insets;
|
|
148
|
+
contentOffset?: import("react-native/types").PointProp;
|
|
149
|
+
contentInsetAdjustmentBehavior?: "always" | "never" | "automatic" | "scrollableAxes";
|
|
150
|
+
directionalLockEnabled?: boolean;
|
|
151
|
+
indicatorStyle?: "default" | "black" | "white";
|
|
152
|
+
maintainVisibleContentPosition?: {
|
|
153
|
+
autoscrollToTopThreshold?: number;
|
|
154
|
+
minIndexForVisible: number;
|
|
155
|
+
};
|
|
156
|
+
maximumZoomScale?: number;
|
|
157
|
+
minimumZoomScale?: number;
|
|
158
|
+
onScrollAnimationEnd?: () => void;
|
|
159
|
+
pinchGestureEnabled?: boolean;
|
|
160
|
+
scrollEventThrottle?: number;
|
|
161
|
+
scrollIndicatorInsets?: import("react-native/types").Insets;
|
|
162
|
+
scrollToOverflowEnabled?: boolean;
|
|
163
|
+
scrollsToTop?: boolean;
|
|
164
|
+
snapToAlignment?: "center" | "end" | "start";
|
|
165
|
+
onScrollToTop?: (event: import("react-native/types").NativeSyntheticEvent<import("react-native/types").NativeScrollEvent>) => void;
|
|
166
|
+
zoomScale?: number;
|
|
167
|
+
endFillColor?: import("react-native/types").ColorValue;
|
|
168
|
+
scrollPerfTag?: string;
|
|
169
|
+
overScrollMode?: "auto" | "always" | "never";
|
|
170
|
+
nestedScrollEnabled?: boolean;
|
|
171
|
+
fadingEdgeLength?: number;
|
|
172
|
+
persistentScrollbar?: boolean;
|
|
173
|
+
onRefresh?: () => void;
|
|
174
|
+
refreshing?: boolean;
|
|
175
|
+
progressViewOffset?: number;
|
|
176
|
+
ItemSeparatorComponent?: import("react").ComponentType<any>;
|
|
177
|
+
ListEmptyComponent?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ComponentType<any>;
|
|
178
|
+
ListFooterComponent?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ComponentType<any>;
|
|
179
|
+
ListFooterComponentStyle?: import("react-native/types").StyleProp<import("react-native/types").ViewStyle>;
|
|
180
|
+
ListHeaderComponent?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ComponentType<any>;
|
|
181
|
+
ListHeaderComponentStyle?: import("react-native/types").StyleProp<import("react-native/types").ViewStyle>;
|
|
182
|
+
disableVirtualization?: boolean;
|
|
183
|
+
extraData?: any;
|
|
184
|
+
getItem?: (data: any, index: number) => any;
|
|
185
|
+
getItemCount?: (data: any) => number;
|
|
186
|
+
getItemLayout?: (data: ArrayLike<any>, index: number) => {
|
|
187
|
+
length: number;
|
|
188
|
+
offset: number;
|
|
189
|
+
index: number;
|
|
190
|
+
};
|
|
191
|
+
initialNumToRender?: number;
|
|
192
|
+
initialScrollIndex?: number;
|
|
193
|
+
inverted?: boolean;
|
|
194
|
+
maxToRenderPerBatch?: number;
|
|
195
|
+
onEndReached?: (info: {
|
|
196
|
+
distanceFromEnd: number;
|
|
197
|
+
}) => void;
|
|
198
|
+
onEndReachedThreshold?: number;
|
|
199
|
+
onScrollToIndexFailed?: (info: {
|
|
200
|
+
index: number;
|
|
201
|
+
highestMeasuredFrameIndex: number;
|
|
202
|
+
averageItemLength: number;
|
|
203
|
+
}) => void;
|
|
204
|
+
onStartReached?: (info: {
|
|
205
|
+
distanceFromStart: number;
|
|
206
|
+
}) => void;
|
|
207
|
+
onStartReachedThreshold?: number;
|
|
208
|
+
onViewableItemsChanged?: (info: {
|
|
209
|
+
viewableItems: import("@react-native/virtualized-lists").ViewToken<any>[];
|
|
210
|
+
changed: import("@react-native/virtualized-lists").ViewToken<any>[];
|
|
211
|
+
}) => void;
|
|
212
|
+
renderScrollComponent?: (props: import("react-native/types").ScrollViewProps) => import("react").ReactElement<import("react-native/types").ScrollViewProps, string | import("react").JSXElementConstructor<any>>;
|
|
213
|
+
updateCellsBatchingPeriod?: number;
|
|
214
|
+
viewabilityConfig?: import("@react-native/virtualized-lists").ViewabilityConfig;
|
|
215
|
+
viewabilityConfigCallbackPairs?: import("@react-native/virtualized-lists").ViewabilityConfigCallbackPairs;
|
|
216
|
+
windowSize?: number;
|
|
217
|
+
CellRendererComponent?: import("react").ComponentType<import("@react-native/virtualized-lists").CellRendererProps<any>>;
|
|
218
|
+
legacyImplementation?: boolean;
|
|
219
|
+
columnWrapperStyle?: import("react-native/types").StyleProp<import("react-native/types").ViewStyle>;
|
|
220
|
+
numColumns?: number;
|
|
221
|
+
}) => JSX.Element;
|
|
20
222
|
Panel: ({ keepMounted: panelKeepMounted, ...props }: Omit<import("../View").ViewProps, "style"> & {
|
|
21
223
|
value: string;
|
|
22
224
|
children: import("react").ReactNode;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codeleap/mobile",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.5",
|
|
4
4
|
"main": "src/index.ts",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -9,28 +9,28 @@
|
|
|
9
9
|
"directory": "packages/mobile"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"@codeleap/types": "5.2.
|
|
13
|
-
"@codeleap/utils": "5.2.
|
|
14
|
-
"@codeleap/hooks": "5.2.
|
|
15
|
-
"@codeleap/form": "5.2.
|
|
16
|
-
"@codeleap/query": "5.2.
|
|
17
|
-
"@codeleap/logger": "5.2.
|
|
18
|
-
"@codeleap/config": "5.2.
|
|
19
|
-
"@codeleap/modals": "5.2.
|
|
12
|
+
"@codeleap/types": "5.2.5",
|
|
13
|
+
"@codeleap/utils": "5.2.5",
|
|
14
|
+
"@codeleap/hooks": "5.2.5",
|
|
15
|
+
"@codeleap/form": "5.2.5",
|
|
16
|
+
"@codeleap/query": "5.2.5",
|
|
17
|
+
"@codeleap/logger": "5.2.5",
|
|
18
|
+
"@codeleap/config": "5.2.5",
|
|
19
|
+
"@codeleap/modals": "5.2.5"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
22
|
"build": "tsc --build",
|
|
23
23
|
"lint": "eslint -c .eslintrc.js --fix \"./src/**/*.{ts,tsx,js,jsx}\""
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@codeleap/types": "5.2.
|
|
27
|
-
"@codeleap/utils": "5.2.
|
|
28
|
-
"@codeleap/hooks": "5.2.
|
|
29
|
-
"@codeleap/form": "5.2.
|
|
30
|
-
"@codeleap/query": "5.2.
|
|
31
|
-
"@codeleap/logger": "5.2.
|
|
32
|
-
"@codeleap/styles": "5.2.
|
|
33
|
-
"@codeleap/modals": "5.2.
|
|
26
|
+
"@codeleap/types": "5.2.5",
|
|
27
|
+
"@codeleap/utils": "5.2.5",
|
|
28
|
+
"@codeleap/hooks": "5.2.5",
|
|
29
|
+
"@codeleap/form": "5.2.5",
|
|
30
|
+
"@codeleap/query": "5.2.5",
|
|
31
|
+
"@codeleap/logger": "5.2.5",
|
|
32
|
+
"@codeleap/styles": "5.2.5",
|
|
33
|
+
"@codeleap/modals": "5.2.5",
|
|
34
34
|
"@d11/react-native-fast-image": "8.9.2",
|
|
35
35
|
"@react-native-firebase/messaging": "21.12.0",
|
|
36
36
|
"@react-navigation/bottom-tabs": "7.3.10",
|
package/package.json.bak
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { createContext, useContext, useState } from 'react'
|
|
1
|
+
import { createContext, useContext, useRef, useState } from 'react'
|
|
2
2
|
import { TabsContextProps, TabsStyles } from './types'
|
|
3
|
+
import { FlatList } from 'react-native'
|
|
4
|
+
import { TypeGuards } from '@codeleap/types'
|
|
3
5
|
|
|
4
6
|
function useTabHandle(props: TabsContextProps & { styles: TabsStyles }) {
|
|
5
7
|
const {
|
|
@@ -10,15 +12,29 @@ function useTabHandle(props: TabsContextProps & { styles: TabsStyles }) {
|
|
|
10
12
|
styles
|
|
11
13
|
} = props
|
|
12
14
|
|
|
13
|
-
const [tabValue,
|
|
15
|
+
const [tabValue, setInternalTabValue] = !onValueChange && !value
|
|
14
16
|
? useState<string>(defaultValue)
|
|
15
17
|
: [value ?? defaultValue, onValueChange]
|
|
16
18
|
|
|
19
|
+
const flatListRef = useRef<FlatList>(null)
|
|
20
|
+
|
|
21
|
+
const setTabValue = (newValue: string, index?: number) => {
|
|
22
|
+
if (TypeGuards.isNumber(index) && flatListRef.current) {
|
|
23
|
+
flatListRef.current.scrollToIndex({
|
|
24
|
+
index,
|
|
25
|
+
animated: true,
|
|
26
|
+
})
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
setInternalTabValue(newValue)
|
|
30
|
+
}
|
|
31
|
+
|
|
17
32
|
return {
|
|
18
33
|
value: tabValue,
|
|
19
34
|
setValue: setTabValue,
|
|
20
35
|
styles,
|
|
21
36
|
keepMounted,
|
|
37
|
+
flatListRef,
|
|
22
38
|
}
|
|
23
39
|
}
|
|
24
40
|
|
|
@@ -1,17 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FlatList, FlatListProps } from 'react-native'
|
|
2
2
|
import { useTabContext } from './Context'
|
|
3
3
|
|
|
4
|
-
type TabListProps =
|
|
4
|
+
type TabListProps = Omit<FlatListProps<any>, 'data' | 'renderItem'>
|
|
5
5
|
|
|
6
6
|
export const TabList = (props: TabListProps) => {
|
|
7
|
-
const {
|
|
7
|
+
const { children, ...flatListProps } = props
|
|
8
|
+
|
|
9
|
+
const { styles, flatListRef } = useTabContext()
|
|
10
|
+
|
|
11
|
+
const childrenArray = React.Children.toArray(children)
|
|
8
12
|
|
|
9
13
|
return (
|
|
10
|
-
<
|
|
14
|
+
<FlatList
|
|
11
15
|
horizontal
|
|
12
16
|
showsHorizontalScrollIndicator={false}
|
|
13
17
|
showsVerticalScrollIndicator={false}
|
|
14
|
-
{...
|
|
18
|
+
{...flatListProps}
|
|
19
|
+
ref={flatListRef}
|
|
20
|
+
data={childrenArray}
|
|
21
|
+
renderItem={({ item }) => item}
|
|
22
|
+
keyExtractor={(_, index) => `tab-${index}`}
|
|
15
23
|
style={styles?.tabList}
|
|
16
24
|
contentContainerStyle={styles?.tabListContainer}
|
|
17
25
|
/>
|