react-native-tab-view 4.0.0-alpha.6 → 4.0.0-alpha.8
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/PlatformPressable.js +22 -1
- package/lib/commonjs/PlatformPressable.js.map +1 -1
- package/lib/commonjs/TabBar.js +107 -91
- package/lib/commonjs/TabBar.js.map +1 -1
- package/lib/commonjs/TabBarIndicator.js +4 -11
- package/lib/commonjs/TabBarIndicator.js.map +1 -1
- package/lib/commonjs/TabBarItem.js +53 -72
- package/lib/commonjs/TabBarItem.js.map +1 -1
- package/lib/module/PlatformPressable.js +22 -1
- package/lib/module/PlatformPressable.js.map +1 -1
- package/lib/module/TabBar.js +107 -91
- package/lib/module/TabBar.js.map +1 -1
- package/lib/module/TabBarIndicator.js +5 -12
- package/lib/module/TabBarIndicator.js.map +1 -1
- package/lib/module/TabBarItem.js +53 -72
- package/lib/module/TabBarItem.js.map +1 -1
- package/lib/typescript/src/PlatformPressable.d.ts +3 -2
- package/lib/typescript/src/PlatformPressable.d.ts.map +1 -1
- package/lib/typescript/src/TabBar.d.ts +4 -15
- package/lib/typescript/src/TabBar.d.ts.map +1 -1
- package/lib/typescript/src/TabBarIndicator.d.ts.map +1 -1
- package/lib/typescript/src/TabBarItem.d.ts +2 -17
- package/lib/typescript/src/TabBarItem.d.ts.map +1 -1
- package/lib/typescript/src/TabView.d.ts +3 -3
- 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 +26 -1
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/PlatformPressable.tsx +31 -2
- package/src/TabBar.tsx +158 -160
- package/src/TabBarIndicator.tsx +3 -10
- package/src/TabBarItem.tsx +82 -106
- package/src/TabView.tsx +1 -1
- package/src/index.tsx +6 -1
- package/src/types.tsx +26 -1
package/lib/module/TabBarItem.js
CHANGED
|
@@ -6,6 +6,7 @@ import { PlatformPressable } from './PlatformPressable';
|
|
|
6
6
|
import { TabBarItemLabel } from './TabBarItemLabel';
|
|
7
7
|
const DEFAULT_ACTIVE_COLOR = 'rgba(255, 255, 255, 1)';
|
|
8
8
|
const DEFAULT_INACTIVE_COLOR = 'rgba(255, 255, 255, 0.7)';
|
|
9
|
+
const ICON_SIZE = 24;
|
|
9
10
|
const getActiveOpacity = (position, routesLength, tabIndex) => {
|
|
10
11
|
if (routesLength > 1) {
|
|
11
12
|
const inputRange = Array.from({
|
|
@@ -36,13 +37,12 @@ const TabBarItemInternal = _ref => {
|
|
|
36
37
|
let {
|
|
37
38
|
accessibilityLabel,
|
|
38
39
|
accessible,
|
|
39
|
-
label:
|
|
40
|
+
label: customlabel,
|
|
40
41
|
testID,
|
|
41
42
|
onLongPress,
|
|
42
43
|
onPress,
|
|
43
44
|
isFocused,
|
|
44
45
|
position,
|
|
45
|
-
route,
|
|
46
46
|
style,
|
|
47
47
|
inactiveColor: inactiveColorCustom,
|
|
48
48
|
activeColor: activeColorCustom,
|
|
@@ -51,83 +51,70 @@ const TabBarItemInternal = _ref => {
|
|
|
51
51
|
index: tabIndex,
|
|
52
52
|
pressColor,
|
|
53
53
|
pressOpacity,
|
|
54
|
-
renderBadge,
|
|
55
|
-
renderIcon,
|
|
56
54
|
defaultTabWidth,
|
|
55
|
+
icon: customIcon,
|
|
56
|
+
badge: customBadge,
|
|
57
|
+
href,
|
|
58
|
+
labelText,
|
|
57
59
|
routesLength,
|
|
58
|
-
renderLabel: renderLabelCustom,
|
|
59
60
|
android_ripple = {
|
|
60
61
|
borderless: true
|
|
61
|
-
}
|
|
62
|
+
},
|
|
63
|
+
labelAllowFontScaling,
|
|
64
|
+
route
|
|
62
65
|
} = _ref;
|
|
63
66
|
const labelColorFromStyle = StyleSheet.flatten(labelStyle || {}).color;
|
|
64
67
|
const activeColor = activeColorCustom !== undefined ? activeColorCustom : typeof labelColorFromStyle === 'string' ? labelColorFromStyle : DEFAULT_ACTIVE_COLOR;
|
|
65
68
|
const inactiveColor = inactiveColorCustom !== undefined ? inactiveColorCustom : typeof labelColorFromStyle === 'string' ? labelColorFromStyle : DEFAULT_INACTIVE_COLOR;
|
|
66
69
|
const activeOpacity = getActiveOpacity(position, routesLength, tabIndex);
|
|
67
70
|
const inactiveOpacity = getInactiveOpacity(position, routesLength, tabIndex);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
focused: true,
|
|
74
|
-
color: activeColor
|
|
75
|
-
});
|
|
76
|
-
const inactiveIcon = renderIcon({
|
|
77
|
-
route,
|
|
71
|
+
const icon = React.useMemo(() => {
|
|
72
|
+
if (!customIcon) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
const inactiveIcon = customIcon({
|
|
78
76
|
focused: false,
|
|
79
|
-
color: inactiveColor
|
|
77
|
+
color: inactiveColor,
|
|
78
|
+
size: ICON_SIZE,
|
|
79
|
+
route
|
|
80
80
|
});
|
|
81
|
-
|
|
82
|
-
icon = /*#__PURE__*/React.createElement(View, {
|
|
83
|
-
style: styles.icon
|
|
84
|
-
}, /*#__PURE__*/React.createElement(Animated.View, {
|
|
85
|
-
style: {
|
|
86
|
-
opacity: inactiveOpacity
|
|
87
|
-
}
|
|
88
|
-
}, inactiveIcon), /*#__PURE__*/React.createElement(Animated.View, {
|
|
89
|
-
style: [StyleSheet.absoluteFill, {
|
|
90
|
-
opacity: activeOpacity
|
|
91
|
-
}]
|
|
92
|
-
}, activeIcon));
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
const renderLabel = renderLabelCustom ? renderLabelCustom : labelProps => /*#__PURE__*/React.createElement(TabBarItemLabel, _extends({}, labelProps, {
|
|
96
|
-
icon: icon,
|
|
97
|
-
label: labelText,
|
|
98
|
-
labelStyle: labelStyle
|
|
99
|
-
}));
|
|
100
|
-
if (renderLabel) {
|
|
101
|
-
const activeLabel = renderLabel({
|
|
102
|
-
route,
|
|
81
|
+
const activeIcon = customIcon({
|
|
103
82
|
focused: true,
|
|
104
|
-
color: activeColor
|
|
83
|
+
color: activeColor,
|
|
84
|
+
size: ICON_SIZE,
|
|
85
|
+
route
|
|
105
86
|
});
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
color: inactiveColor
|
|
110
|
-
});
|
|
111
|
-
label = /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(Animated.View, {
|
|
87
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
88
|
+
style: styles.icon
|
|
89
|
+
}, /*#__PURE__*/React.createElement(Animated.View, {
|
|
112
90
|
style: {
|
|
113
91
|
opacity: inactiveOpacity
|
|
114
92
|
}
|
|
115
|
-
},
|
|
93
|
+
}, inactiveIcon), /*#__PURE__*/React.createElement(Animated.View, {
|
|
116
94
|
style: [StyleSheet.absoluteFill, {
|
|
117
95
|
opacity: activeOpacity
|
|
118
96
|
}]
|
|
119
|
-
},
|
|
120
|
-
}
|
|
97
|
+
}, activeIcon));
|
|
98
|
+
}, [activeColor, activeOpacity, customIcon, inactiveColor, inactiveOpacity, route]);
|
|
99
|
+
const renderLabel = React.useCallback(focused => customlabel ? customlabel({
|
|
100
|
+
focused,
|
|
101
|
+
color: focused ? activeColor : inactiveColor,
|
|
102
|
+
style: labelStyle,
|
|
103
|
+
label: labelText,
|
|
104
|
+
allowFontScaling: labelAllowFontScaling,
|
|
105
|
+
route
|
|
106
|
+
}) : /*#__PURE__*/React.createElement(TabBarItemLabel, {
|
|
107
|
+
color: focused ? activeColor : inactiveColor,
|
|
108
|
+
icon: icon,
|
|
109
|
+
label: labelText,
|
|
110
|
+
labelStyle: labelStyle
|
|
111
|
+
}), [customlabel, activeColor, labelStyle, labelText, labelAllowFontScaling, route, inactiveColor, icon]);
|
|
121
112
|
const tabStyle = StyleSheet.flatten(style);
|
|
122
113
|
const isWidthSet = tabStyle?.width !== undefined;
|
|
123
114
|
const tabContainerStyle = isWidthSet ? null : {
|
|
124
115
|
width: defaultTabWidth
|
|
125
116
|
};
|
|
126
|
-
const scene = {
|
|
127
|
-
route
|
|
128
|
-
};
|
|
129
117
|
accessibilityLabel = typeof accessibilityLabel !== 'undefined' ? accessibilityLabel : labelText;
|
|
130
|
-
const badge = renderBadge ? renderBadge(scene) : null;
|
|
131
118
|
return /*#__PURE__*/React.createElement(PlatformPressable, {
|
|
132
119
|
android_ripple: android_ripple,
|
|
133
120
|
testID: testID,
|
|
@@ -143,13 +130,22 @@ const TabBarItemInternal = _ref => {
|
|
|
143
130
|
onLayout: onLayout,
|
|
144
131
|
onPress: onPress,
|
|
145
132
|
onLongPress: onLongPress,
|
|
133
|
+
href: href,
|
|
146
134
|
style: [styles.pressable, tabContainerStyle]
|
|
147
135
|
}, /*#__PURE__*/React.createElement(View, {
|
|
148
136
|
pointerEvents: "none",
|
|
149
137
|
style: [styles.item, tabStyle]
|
|
150
|
-
}, icon,
|
|
138
|
+
}, icon, /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(Animated.View, {
|
|
139
|
+
style: {
|
|
140
|
+
opacity: inactiveOpacity
|
|
141
|
+
}
|
|
142
|
+
}, renderLabel(false)), /*#__PURE__*/React.createElement(Animated.View, {
|
|
143
|
+
style: [StyleSheet.absoluteFill, {
|
|
144
|
+
opacity: activeOpacity
|
|
145
|
+
}]
|
|
146
|
+
}, renderLabel(true))), customBadge != null ? /*#__PURE__*/React.createElement(View, {
|
|
151
147
|
style: styles.badge
|
|
152
|
-
},
|
|
148
|
+
}, customBadge()) : null));
|
|
153
149
|
};
|
|
154
150
|
const MemoizedTabBarItemInternal = /*#__PURE__*/React.memo(TabBarItemInternal);
|
|
155
151
|
export function TabBarItem(props) {
|
|
@@ -159,23 +155,12 @@ export function TabBarItem(props) {
|
|
|
159
155
|
onLayout,
|
|
160
156
|
navigationState,
|
|
161
157
|
route,
|
|
162
|
-
getAccessibilityLabel,
|
|
163
|
-
getLabelText,
|
|
164
|
-
getTestID,
|
|
165
|
-
getAccessible,
|
|
166
158
|
...rest
|
|
167
159
|
} = props;
|
|
168
160
|
const onPressLatest = useLatestCallback(onPress);
|
|
169
161
|
const onLongPressLatest = useLatestCallback(onLongPress);
|
|
170
162
|
const onLayoutLatest = useLatestCallback(onLayout ? onLayout : () => {});
|
|
171
163
|
const tabIndex = navigationState.routes.indexOf(route);
|
|
172
|
-
const scene = {
|
|
173
|
-
route
|
|
174
|
-
};
|
|
175
|
-
const accessibilityLabel = getAccessibilityLabel(scene);
|
|
176
|
-
const label = getLabelText(scene);
|
|
177
|
-
const testID = getTestID(scene);
|
|
178
|
-
const accessible = getAccessible(scene);
|
|
179
164
|
return /*#__PURE__*/React.createElement(MemoizedTabBarItemInternal, _extends({}, rest, {
|
|
180
165
|
onPress: onPressLatest,
|
|
181
166
|
onLayout: onLayoutLatest,
|
|
@@ -183,11 +168,7 @@ export function TabBarItem(props) {
|
|
|
183
168
|
isFocused: navigationState.index === tabIndex,
|
|
184
169
|
route: route,
|
|
185
170
|
index: tabIndex,
|
|
186
|
-
routesLength: navigationState.routes.length
|
|
187
|
-
accessibilityLabel: accessibilityLabel,
|
|
188
|
-
label: label,
|
|
189
|
-
testID: testID,
|
|
190
|
-
accessible: accessible
|
|
171
|
+
routesLength: navigationState.routes.length
|
|
191
172
|
}));
|
|
192
173
|
}
|
|
193
174
|
const styles = StyleSheet.create({
|
|
@@ -204,7 +185,7 @@ const styles = StyleSheet.create({
|
|
|
204
185
|
badge: {
|
|
205
186
|
position: 'absolute',
|
|
206
187
|
top: 0,
|
|
207
|
-
|
|
188
|
+
end: 0
|
|
208
189
|
},
|
|
209
190
|
pressable: {
|
|
210
191
|
// The label is not pressable on Windows
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Animated","StyleSheet","View","useLatestCallback","PlatformPressable","TabBarItemLabel","DEFAULT_ACTIVE_COLOR","DEFAULT_INACTIVE_COLOR","getActiveOpacity","position","routesLength","tabIndex","inputRange","Array","from","length","_","i","interpolate","outputRange","map","getInactiveOpacity","TabBarItemInternal","_ref","accessibilityLabel","accessible","label","
|
|
1
|
+
{"version":3,"names":["React","Animated","StyleSheet","View","useLatestCallback","PlatformPressable","TabBarItemLabel","DEFAULT_ACTIVE_COLOR","DEFAULT_INACTIVE_COLOR","ICON_SIZE","getActiveOpacity","position","routesLength","tabIndex","inputRange","Array","from","length","_","i","interpolate","outputRange","map","getInactiveOpacity","TabBarItemInternal","_ref","accessibilityLabel","accessible","label","customlabel","testID","onLongPress","onPress","isFocused","style","inactiveColor","inactiveColorCustom","activeColor","activeColorCustom","labelStyle","onLayout","index","pressColor","pressOpacity","defaultTabWidth","icon","customIcon","badge","customBadge","href","labelText","android_ripple","borderless","labelAllowFontScaling","route","labelColorFromStyle","flatten","color","undefined","activeOpacity","inactiveOpacity","useMemo","inactiveIcon","focused","size","activeIcon","createElement","styles","opacity","absoluteFill","renderLabel","useCallback","allowFontScaling","tabStyle","isWidthSet","width","tabContainerStyle","accessibilityRole","accessibilityState","selected","unstable_pressDelay","pressable","pointerEvents","item","MemoizedTabBarItemInternal","memo","TabBarItem","props","navigationState","rest","onPressLatest","onLongPressLatest","onLayoutLatest","routes","indexOf","_extends","create","margin","flex","alignItems","justifyContent","padding","minHeight","top","end","backgroundColor"],"sourceRoot":"../../src","sources":["TabBarItem.tsx"],"mappings":";AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SACEC,QAAQ,EAIRC,UAAU,EAEVC,IAAI,QAEC,cAAc;AACrB,OAAOC,iBAAiB,MAAM,qBAAqB;AAEnD,SAASC,iBAAiB,QAAQ,qBAAqB;AACvD,SAASC,eAAe,QAAQ,mBAAmB;AAoBnD,MAAMC,oBAAoB,GAAG,wBAAwB;AACrD,MAAMC,sBAAsB,GAAG,0BAA0B;AACzD,MAAMC,SAAS,GAAG,EAAE;AAEpB,MAAMC,gBAAgB,GAAGA,CACvBC,QAAgD,EAChDC,YAAoB,EACpBC,QAAgB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AAE,CAAC;IACNC,GAAG,EAAE;EACP,CAAC;EACDvB,SAAS,EAAE;IACT;IACA;IACAwB,eAAe,EAAE;EACnB;AACF,CAAC,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type PressableProps } from 'react-native';
|
|
3
3
|
export type Props = PressableProps & {
|
|
4
|
+
children: React.ReactNode;
|
|
4
5
|
pressColor?: string;
|
|
5
6
|
pressOpacity?: number;
|
|
6
|
-
|
|
7
|
+
href?: string;
|
|
7
8
|
};
|
|
8
9
|
/**
|
|
9
10
|
* PlatformPressable provides an abstraction on top of TouchableNativeFeedback and
|
|
@@ -12,5 +13,5 @@ export type Props = PressableProps & {
|
|
|
12
13
|
* On Android, you can pass the props of TouchableNativeFeedback.
|
|
13
14
|
* On other platforms, you can pass the props of TouchableOpacity.
|
|
14
15
|
*/
|
|
15
|
-
export declare function PlatformPressable({ android_ripple, pressColor, pressOpacity, style, ...rest }: Props): React.JSX.Element;
|
|
16
|
+
export declare function PlatformPressable({ disabled, android_ripple, pressColor, pressOpacity, style, onPress, ...rest }: Props): React.JSX.Element;
|
|
16
17
|
//# sourceMappingURL=PlatformPressable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlatformPressable.d.ts","sourceRoot":"","sources":["../../../src/PlatformPressable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,
|
|
1
|
+
{"version":3,"file":"PlatformPressable.d.ts","sourceRoot":"","sources":["../../../src/PlatformPressable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,cAAc,CAAC;AAEtB,MAAM,MAAM,KAAK,GAAG,cAAc,GAAG;IACnC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAMF;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,cAAc,EACd,UAAiC,EACjC,YAAY,EACZ,KAAK,EACL,OAAO,EACP,GAAG,IAAI,EACR,EAAE,KAAK,qBAoCP"}
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { type PressableAndroidRippleConfig, type StyleProp, type TextStyle, type ViewStyle } from 'react-native';
|
|
3
3
|
import { type Props as IndicatorProps } from './TabBarIndicator';
|
|
4
4
|
import { type Props as TabBarItemProps } from './TabBarItem';
|
|
5
|
-
import type { Event, LocaleDirection, NavigationState, Route, Scene, SceneRendererProps } from './types';
|
|
5
|
+
import type { Event, LocaleDirection, NavigationState, Route, Scene, SceneRendererProps, TabDescriptor } from './types';
|
|
6
6
|
export type Props<T extends Route> = SceneRendererProps & {
|
|
7
7
|
navigationState: NavigationState<T>;
|
|
8
8
|
scrollEnabled?: boolean;
|
|
@@ -11,19 +11,8 @@ export type Props<T extends Route> = SceneRendererProps & {
|
|
|
11
11
|
inactiveColor?: string;
|
|
12
12
|
pressColor?: string;
|
|
13
13
|
pressOpacity?: number;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
getAccessibilityLabel?: (scene: Scene<T>) => string | undefined;
|
|
17
|
-
getTestID?: (scene: Scene<T>) => string | undefined;
|
|
18
|
-
renderLabel?: (scene: Scene<T> & {
|
|
19
|
-
focused: boolean;
|
|
20
|
-
color: string;
|
|
21
|
-
}) => React.ReactNode;
|
|
22
|
-
renderIcon?: (scene: Scene<T> & {
|
|
23
|
-
focused: boolean;
|
|
24
|
-
color: string;
|
|
25
|
-
}) => React.ReactNode;
|
|
26
|
-
renderBadge?: (scene: Scene<T>) => React.ReactNode;
|
|
14
|
+
options?: Record<string, TabDescriptor<T>>;
|
|
15
|
+
commonOptions?: TabDescriptor<T>;
|
|
27
16
|
renderIndicator?: (props: IndicatorProps<T>) => React.ReactNode;
|
|
28
17
|
renderTabBarItem?: (props: TabBarItemProps<T> & {
|
|
29
18
|
key: string;
|
|
@@ -41,5 +30,5 @@ export type Props<T extends Route> = SceneRendererProps & {
|
|
|
41
30
|
testID?: string;
|
|
42
31
|
android_ripple?: PressableAndroidRippleConfig;
|
|
43
32
|
};
|
|
44
|
-
export declare function TabBar<T extends Route>({
|
|
33
|
+
export declare function TabBar<T extends Route>({ renderIndicator, gap, scrollEnabled, jumpTo, navigationState, position, activeColor, bounces, contentContainerStyle, inactiveColor, indicatorContainerStyle, indicatorStyle, labelStyle, onTabLongPress, onTabPress, pressColor, pressOpacity, direction, renderTabBarItem, style, tabStyle, layout: propLayout, testID, android_ripple, options, commonOptions, }: Props<T>): React.JSX.Element;
|
|
45
34
|
//# sourceMappingURL=TabBar.d.ts.map
|
|
@@ -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,EAEd,KAAK,SAAS,EAEd,KAAK,SAAS,EAEf,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,KAAK,KAAK,IAAI,cAAc,EAE7B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,KAAK,KAAK,IAAI,eAAe,EAAc,MAAM,cAAc,CAAC;AACzE,OAAO,KAAK,EACV,KAAK,EAEL,eAAe,EACf,eAAe,EACf,KAAK,EACL,KAAK,EACL,kBAAkB,
|
|
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,EAEd,KAAK,SAAS,EAE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S,CAAC,CAAC;IAChC,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACtC,uBAAuB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC/C,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAClC,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;CAC/C,CAAC;AAgRF,wBAAgB,MAAM,CAAC,CAAC,SAAS,KAAK,EAAE,EACtC,eAAwC,EACxC,GAAO,EACP,aAAa,EACb,MAAM,EACN,eAAe,EACf,QAAQ,EACR,WAAW,EACX,OAAO,EACP,qBAAqB,EACrB,aAAa,EACb,uBAAuB,EACvB,cAAc,EACd,UAAU,EACV,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,aAAa,GACd,EAAE,KAAK,CAAC,CAAC,CAAC,qBAmVV"}
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"TabBarIndicator.d.ts","sourceRoot":"","sources":["../../../src/TabBarIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAGL,KAAK,SAAS,EAEd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EACf,KAAK,EACL,kBAAkB,EACnB,MAAM,SAAS,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;AA0BF,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,qBAmFV"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Animated, type LayoutChangeEvent, type PressableAndroidRippleConfig, type StyleProp, type TextStyle, type ViewStyle } from 'react-native';
|
|
3
|
-
import type { NavigationState, Route,
|
|
4
|
-
export type Props<T extends Route> = {
|
|
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;
|
|
@@ -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,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,
|
|
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"}
|
|
@@ -4,9 +4,6 @@ import type { Layout, LocaleDirection, NavigationState, PagerProps, Route, Scene
|
|
|
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
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,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,
|
|
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,E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,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,30 @@
|
|
|
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
|
+
labelStyle?: StyleProp<TextStyle>;
|
|
7
|
+
accessible?: boolean;
|
|
8
|
+
testID?: string;
|
|
9
|
+
labelText?: string;
|
|
10
|
+
labelAllowFontScaling?: boolean;
|
|
11
|
+
href?: string;
|
|
12
|
+
label?: (props: {
|
|
13
|
+
focused: boolean;
|
|
14
|
+
color: string;
|
|
15
|
+
style?: StyleProp<TextStyle>;
|
|
16
|
+
allowFontScaling?: boolean;
|
|
17
|
+
label?: string;
|
|
18
|
+
route: T;
|
|
19
|
+
}) => React.ReactElement;
|
|
20
|
+
icon?: (props: {
|
|
21
|
+
focused: boolean;
|
|
22
|
+
color: string;
|
|
23
|
+
size: number;
|
|
24
|
+
route: T;
|
|
25
|
+
}) => React.ReactElement;
|
|
26
|
+
badge?: () => React.ReactElement;
|
|
27
|
+
};
|
|
3
28
|
export type LocaleDirection = 'ltr' | 'rtl';
|
|
4
29
|
export type Route = {
|
|
5
30
|
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,MAAM,cAAc,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9D,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,KAAK,IAAI;IAC3C,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAClC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE;QACd,OAAO,EAAE,OAAO,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAC7B,gBAAgB,CAAC,EAAE,OAAO,CAAC;QAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,CAAC,CAAC;KACV,KAAK,KAAK,CAAC,YAAY,CAAC;IACzB,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE;QACb,OAAO,EAAE,OAAO,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAA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AAK,MAAM,IAAI,CAAC;CACtD,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,IAAI,CAC3B,cAAc,EACZ,aAAa,GACb,eAAe,GACf,cAAc,GACd,gBAAgB,GAChB,0BAA0B,GAC1B,qBAAqB,GACrB,UAAU,CACb,GAAG;IACF,mBAAmB,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;IAClD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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.8",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native-component",
|
|
7
7
|
"react-component",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
]
|
|
69
69
|
]
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "d0b5489cb3eb8092d05b8d058ba5774d0538cec6"
|
|
72
72
|
}
|
|
@@ -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
|
);
|