@amazon-devices/react-navigation__react-native-tab-view 8.0.9000000000 → 8.0.9000000002
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/SystemModules/amzn__react-navigation__react-native-tab-view-8.private.modules.txt +35 -29
- package/kepler-compatibility.json +4 -2
- package/lib/module/index.js +0 -7
- package/oss-attribution/attribution.txt +0 -0
- package/oss-attribution/licenseInfos.json +1 -0
- package/package.json +1 -1
- package/src/index.tsx +1 -15
- package/SystemBundles/6f915df16edbc21a601928d99e844a99397b9428146027dcf0d86b2a798f21f4.bundle +0 -8563
- package/SystemBundles/6f915df16edbc21a601928d99e844a99397b9428146027dcf0d86b2a798f21f4.map +0 -3217
- package/lib/module/Pager.android.js +0 -4
- package/lib/module/Pager.ios.js +0 -4
- package/lib/module/Pager.js +0 -4
- package/lib/module/PagerViewAdapter.js +0 -130
- package/lib/module/PanResponderAdapter.js +0 -209
- package/lib/module/PlatformPressable.js +0 -61
- package/lib/module/SceneMap.js +0 -24
- package/lib/module/SceneView.js +0 -72
- package/lib/module/TabBar.js +0 -472
- package/lib/module/TabBarIndicator.js +0 -122
- package/lib/module/TabBarItem.js +0 -217
- package/lib/module/TabBarItemLabel.js +0 -33
- package/lib/module/TabView.js +0 -141
- package/lib/module/types.js +0 -4
- package/lib/module/useAnimatedValue.js +0 -12
- package/src/Pager.android.tsx +0 -1
- package/src/Pager.ios.tsx +0 -1
- package/src/Pager.tsx +0 -1
- package/src/PagerViewAdapter.tsx +0 -185
- package/src/PanResponderAdapter.tsx +0 -344
- package/src/PlatformPressable.tsx +0 -91
- package/src/SceneMap.tsx +0 -30
- package/src/SceneView.tsx +0 -106
- package/src/TabBar.tsx +0 -728
- package/src/TabBarIndicator.tsx +0 -190
- package/src/TabBarItem.tsx +0 -308
- package/src/TabBarItemLabel.tsx +0 -42
- package/src/TabView.tsx +0 -198
- package/src/types.tsx +0 -87
- package/src/useAnimatedValue.tsx +0 -12
package/lib/module/Pager.ios.js
DELETED
package/lib/module/Pager.js
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { Animated, Keyboard, Platform, StyleSheet } from 'react-native';
|
|
5
|
-
import ViewPager from 'react-native-pager-view';
|
|
6
|
-
import useLatestCallback from 'use-latest-callback';
|
|
7
|
-
import { useAnimatedValue } from "./useAnimatedValue.js";
|
|
8
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
const AnimatedViewPager = Animated.createAnimatedComponent(ViewPager);
|
|
10
|
-
const useNativeDriver = Platform.OS !== 'web';
|
|
11
|
-
export function PagerViewAdapter({
|
|
12
|
-
keyboardDismissMode = 'auto',
|
|
13
|
-
swipeEnabled = true,
|
|
14
|
-
navigationState,
|
|
15
|
-
onIndexChange,
|
|
16
|
-
onTabSelect,
|
|
17
|
-
onSwipeStart,
|
|
18
|
-
onSwipeEnd,
|
|
19
|
-
children,
|
|
20
|
-
style,
|
|
21
|
-
animationEnabled,
|
|
22
|
-
...rest
|
|
23
|
-
}) {
|
|
24
|
-
const {
|
|
25
|
-
index
|
|
26
|
-
} = navigationState;
|
|
27
|
-
const listenersRef = React.useRef([]);
|
|
28
|
-
const pagerRef = React.useRef(null);
|
|
29
|
-
const indexRef = React.useRef(index);
|
|
30
|
-
const navigationStateRef = React.useRef(navigationState);
|
|
31
|
-
const position = useAnimatedValue(index);
|
|
32
|
-
const offset = useAnimatedValue(0);
|
|
33
|
-
React.useEffect(() => {
|
|
34
|
-
navigationStateRef.current = navigationState;
|
|
35
|
-
});
|
|
36
|
-
const jumpTo = useLatestCallback(key => {
|
|
37
|
-
const index = navigationStateRef.current.routes.findIndex(route => route.key === key);
|
|
38
|
-
if (animationEnabled) {
|
|
39
|
-
pagerRef.current?.setPage(index);
|
|
40
|
-
} else {
|
|
41
|
-
pagerRef.current?.setPageWithoutAnimation(index);
|
|
42
|
-
position.setValue(index);
|
|
43
|
-
}
|
|
44
|
-
onIndexChange(index);
|
|
45
|
-
});
|
|
46
|
-
React.useEffect(() => {
|
|
47
|
-
if (keyboardDismissMode === 'auto') {
|
|
48
|
-
Keyboard.dismiss();
|
|
49
|
-
}
|
|
50
|
-
if (indexRef.current !== index) {
|
|
51
|
-
if (animationEnabled) {
|
|
52
|
-
pagerRef.current?.setPage(index);
|
|
53
|
-
} else {
|
|
54
|
-
pagerRef.current?.setPageWithoutAnimation(index);
|
|
55
|
-
position.setValue(index);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}, [keyboardDismissMode, index, animationEnabled, position]);
|
|
59
|
-
const onPageScrollStateChanged = state => {
|
|
60
|
-
const {
|
|
61
|
-
pageScrollState
|
|
62
|
-
} = state.nativeEvent;
|
|
63
|
-
switch (pageScrollState) {
|
|
64
|
-
case 'idle':
|
|
65
|
-
onSwipeEnd?.();
|
|
66
|
-
return;
|
|
67
|
-
case 'dragging':
|
|
68
|
-
{
|
|
69
|
-
const subscription = offset.addListener(({
|
|
70
|
-
value
|
|
71
|
-
}) => {
|
|
72
|
-
const next = index + (value > 0 ? Math.ceil(value) : Math.floor(value));
|
|
73
|
-
if (next !== index) {
|
|
74
|
-
listenersRef.current.forEach(listener => listener(next));
|
|
75
|
-
}
|
|
76
|
-
offset.removeListener(subscription);
|
|
77
|
-
});
|
|
78
|
-
onSwipeStart?.();
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
const addEnterListener = useLatestCallback(listener => {
|
|
84
|
-
listenersRef.current.push(listener);
|
|
85
|
-
return () => {
|
|
86
|
-
const index = listenersRef.current.indexOf(listener);
|
|
87
|
-
if (index > -1) {
|
|
88
|
-
listenersRef.current.splice(index, 1);
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
});
|
|
92
|
-
const memoizedPosition = React.useMemo(() => Animated.add(position, offset), [offset, position]);
|
|
93
|
-
return children({
|
|
94
|
-
position: memoizedPosition,
|
|
95
|
-
addEnterListener,
|
|
96
|
-
jumpTo,
|
|
97
|
-
render: children => /*#__PURE__*/_jsx(AnimatedViewPager, {
|
|
98
|
-
...rest,
|
|
99
|
-
ref: pagerRef,
|
|
100
|
-
style: [styles.container, style],
|
|
101
|
-
initialPage: index,
|
|
102
|
-
keyboardDismissMode: keyboardDismissMode === 'auto' ? 'on-drag' : keyboardDismissMode,
|
|
103
|
-
onPageScroll: Animated.event([{
|
|
104
|
-
nativeEvent: {
|
|
105
|
-
position: position,
|
|
106
|
-
offset: offset
|
|
107
|
-
}
|
|
108
|
-
}], {
|
|
109
|
-
useNativeDriver
|
|
110
|
-
}),
|
|
111
|
-
onPageSelected: e => {
|
|
112
|
-
const index = e.nativeEvent.position;
|
|
113
|
-
indexRef.current = index;
|
|
114
|
-
onIndexChange(index);
|
|
115
|
-
onTabSelect?.({
|
|
116
|
-
index
|
|
117
|
-
});
|
|
118
|
-
},
|
|
119
|
-
onPageScrollStateChanged: onPageScrollStateChanged,
|
|
120
|
-
scrollEnabled: swipeEnabled,
|
|
121
|
-
children: children
|
|
122
|
-
})
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
const styles = StyleSheet.create({
|
|
126
|
-
container: {
|
|
127
|
-
flex: 1
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
//# sourceMappingURL=PagerViewAdapter.js.map
|
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { Animated, Keyboard, PanResponder, StyleSheet, View } from 'react-native';
|
|
5
|
-
import useLatestCallback from 'use-latest-callback';
|
|
6
|
-
import { useAnimatedValue } from "./useAnimatedValue.js";
|
|
7
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
const DEAD_ZONE = 12;
|
|
9
|
-
const DefaultTransitionSpec = {
|
|
10
|
-
timing: Animated.spring,
|
|
11
|
-
stiffness: 1000,
|
|
12
|
-
damping: 500,
|
|
13
|
-
mass: 3,
|
|
14
|
-
overshootClamping: true
|
|
15
|
-
};
|
|
16
|
-
export function PanResponderAdapter({
|
|
17
|
-
layout,
|
|
18
|
-
keyboardDismissMode = 'auto',
|
|
19
|
-
swipeEnabled = true,
|
|
20
|
-
navigationState,
|
|
21
|
-
onIndexChange,
|
|
22
|
-
onTabSelect,
|
|
23
|
-
onSwipeStart,
|
|
24
|
-
onSwipeEnd,
|
|
25
|
-
children,
|
|
26
|
-
style,
|
|
27
|
-
animationEnabled = false,
|
|
28
|
-
layoutDirection = 'ltr'
|
|
29
|
-
}) {
|
|
30
|
-
const {
|
|
31
|
-
routes,
|
|
32
|
-
index
|
|
33
|
-
} = navigationState;
|
|
34
|
-
const panX = useAnimatedValue(0);
|
|
35
|
-
const listenersRef = React.useRef([]);
|
|
36
|
-
const navigationStateRef = React.useRef(navigationState);
|
|
37
|
-
const layoutRef = React.useRef(layout);
|
|
38
|
-
const onIndexChangeRef = React.useRef(onIndexChange);
|
|
39
|
-
const onTabSelectRef = React.useRef(onTabSelect);
|
|
40
|
-
const currentIndexRef = React.useRef(index);
|
|
41
|
-
const pendingIndexRef = React.useRef(undefined);
|
|
42
|
-
const swipeVelocityThreshold = 0.15;
|
|
43
|
-
const swipeDistanceThreshold = layout.width / 1.75;
|
|
44
|
-
const jumpToIndex = useLatestCallback((index, animate = animationEnabled) => {
|
|
45
|
-
const offset = -index * layoutRef.current.width;
|
|
46
|
-
const {
|
|
47
|
-
timing,
|
|
48
|
-
...transitionConfig
|
|
49
|
-
} = DefaultTransitionSpec;
|
|
50
|
-
if (animate) {
|
|
51
|
-
Animated.parallel([timing(panX, {
|
|
52
|
-
...transitionConfig,
|
|
53
|
-
toValue: offset,
|
|
54
|
-
useNativeDriver: false
|
|
55
|
-
})]).start(({
|
|
56
|
-
finished
|
|
57
|
-
}) => {
|
|
58
|
-
if (finished) {
|
|
59
|
-
onIndexChangeRef.current(index);
|
|
60
|
-
onTabSelectRef.current?.({
|
|
61
|
-
index
|
|
62
|
-
});
|
|
63
|
-
pendingIndexRef.current = undefined;
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
pendingIndexRef.current = index;
|
|
67
|
-
} else {
|
|
68
|
-
panX.setValue(offset);
|
|
69
|
-
onIndexChangeRef.current(index);
|
|
70
|
-
onTabSelectRef.current?.({
|
|
71
|
-
index
|
|
72
|
-
});
|
|
73
|
-
pendingIndexRef.current = undefined;
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
React.useEffect(() => {
|
|
77
|
-
navigationStateRef.current = navigationState;
|
|
78
|
-
layoutRef.current = layout;
|
|
79
|
-
onIndexChangeRef.current = onIndexChange;
|
|
80
|
-
onTabSelectRef.current = onTabSelect;
|
|
81
|
-
});
|
|
82
|
-
React.useEffect(() => {
|
|
83
|
-
const offset = -navigationStateRef.current.index * layout.width;
|
|
84
|
-
panX.setValue(offset);
|
|
85
|
-
}, [layout.width, panX]);
|
|
86
|
-
React.useEffect(() => {
|
|
87
|
-
if (keyboardDismissMode === 'auto') {
|
|
88
|
-
Keyboard.dismiss();
|
|
89
|
-
}
|
|
90
|
-
if (layout.width && currentIndexRef.current !== index) {
|
|
91
|
-
currentIndexRef.current = index;
|
|
92
|
-
jumpToIndex(index);
|
|
93
|
-
}
|
|
94
|
-
}, [jumpToIndex, keyboardDismissMode, layout.width, index]);
|
|
95
|
-
const isMovingHorizontally = (_, gestureState) => {
|
|
96
|
-
return Math.abs(gestureState.dx) > Math.abs(gestureState.dy * 2) && Math.abs(gestureState.vx) > Math.abs(gestureState.vy * 2);
|
|
97
|
-
};
|
|
98
|
-
const canMoveScreen = (event, gestureState) => {
|
|
99
|
-
if (swipeEnabled === false) {
|
|
100
|
-
return false;
|
|
101
|
-
}
|
|
102
|
-
const diffX = layoutDirection === 'rtl' ? -gestureState.dx : gestureState.dx;
|
|
103
|
-
return isMovingHorizontally(event, gestureState) && (diffX >= DEAD_ZONE && currentIndexRef.current > 0 || diffX <= -DEAD_ZONE && currentIndexRef.current < routes.length - 1);
|
|
104
|
-
};
|
|
105
|
-
const startGesture = () => {
|
|
106
|
-
onSwipeStart?.();
|
|
107
|
-
if (keyboardDismissMode === 'on-drag') {
|
|
108
|
-
Keyboard.dismiss();
|
|
109
|
-
}
|
|
110
|
-
panX.stopAnimation();
|
|
111
|
-
// @ts-expect-error: _value is private, but docs use it as well
|
|
112
|
-
panX.setOffset(panX._value);
|
|
113
|
-
};
|
|
114
|
-
const respondToGesture = (_, gestureState) => {
|
|
115
|
-
const diffX = layoutDirection === 'rtl' ? -gestureState.dx : gestureState.dx;
|
|
116
|
-
if (
|
|
117
|
-
// swiping left
|
|
118
|
-
diffX > 0 && index <= 0 ||
|
|
119
|
-
// swiping right
|
|
120
|
-
diffX < 0 && index >= routes.length - 1) {
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
if (layout.width) {
|
|
124
|
-
// @ts-expect-error: _offset is private, but docs use it as well
|
|
125
|
-
const position = (panX._offset + diffX) / -layout.width;
|
|
126
|
-
const next = position > index ? Math.ceil(position) : Math.floor(position);
|
|
127
|
-
if (next !== index) {
|
|
128
|
-
listenersRef.current.forEach(listener => listener(next));
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
panX.setValue(diffX);
|
|
132
|
-
};
|
|
133
|
-
const finishGesture = (_, gestureState) => {
|
|
134
|
-
panX.flattenOffset();
|
|
135
|
-
onSwipeEnd?.();
|
|
136
|
-
const currentIndex = typeof pendingIndexRef.current === 'number' ? pendingIndexRef.current : currentIndexRef.current;
|
|
137
|
-
let nextIndex = currentIndex;
|
|
138
|
-
if (Math.abs(gestureState.dx) > Math.abs(gestureState.dy) && Math.abs(gestureState.vx) > Math.abs(gestureState.vy) && (Math.abs(gestureState.dx) > swipeDistanceThreshold || Math.abs(gestureState.vx) > swipeVelocityThreshold)) {
|
|
139
|
-
nextIndex = Math.round(Math.min(Math.max(0, layoutDirection === 'rtl' ? currentIndex + gestureState.dx / Math.abs(gestureState.dx) : currentIndex - gestureState.dx / Math.abs(gestureState.dx)), routes.length - 1));
|
|
140
|
-
currentIndexRef.current = nextIndex;
|
|
141
|
-
}
|
|
142
|
-
if (!isFinite(nextIndex)) {
|
|
143
|
-
nextIndex = currentIndex;
|
|
144
|
-
}
|
|
145
|
-
jumpToIndex(nextIndex, true);
|
|
146
|
-
};
|
|
147
|
-
const addEnterListener = useLatestCallback(listener => {
|
|
148
|
-
listenersRef.current.push(listener);
|
|
149
|
-
return () => {
|
|
150
|
-
const index = listenersRef.current.indexOf(listener);
|
|
151
|
-
if (index > -1) {
|
|
152
|
-
listenersRef.current.splice(index, 1);
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
});
|
|
156
|
-
const jumpTo = useLatestCallback(key => {
|
|
157
|
-
const index = navigationStateRef.current.routes.findIndex(route => route.key === key);
|
|
158
|
-
jumpToIndex(index);
|
|
159
|
-
onIndexChange(index);
|
|
160
|
-
});
|
|
161
|
-
const panResponder = PanResponder.create({
|
|
162
|
-
onMoveShouldSetPanResponder: canMoveScreen,
|
|
163
|
-
onMoveShouldSetPanResponderCapture: canMoveScreen,
|
|
164
|
-
onPanResponderGrant: startGesture,
|
|
165
|
-
onPanResponderMove: respondToGesture,
|
|
166
|
-
onPanResponderTerminate: finishGesture,
|
|
167
|
-
onPanResponderRelease: finishGesture,
|
|
168
|
-
onPanResponderTerminationRequest: () => true
|
|
169
|
-
});
|
|
170
|
-
const maxTranslate = layout.width * (routes.length - 1);
|
|
171
|
-
const translateX = Animated.multiply(panX.interpolate({
|
|
172
|
-
inputRange: [-maxTranslate, 0],
|
|
173
|
-
outputRange: [-maxTranslate, 0],
|
|
174
|
-
extrapolate: 'clamp'
|
|
175
|
-
}), layoutDirection === 'rtl' ? -1 : 1);
|
|
176
|
-
const position = React.useMemo(() => layout.width ? Animated.divide(panX, -layout.width) : null, [layout.width, panX]);
|
|
177
|
-
return children({
|
|
178
|
-
position: position ?? new Animated.Value(index),
|
|
179
|
-
addEnterListener,
|
|
180
|
-
jumpTo,
|
|
181
|
-
render: children => /*#__PURE__*/_jsx(Animated.View, {
|
|
182
|
-
style: [styles.sheet, layout.width ? {
|
|
183
|
-
width: routes.length * layout.width,
|
|
184
|
-
transform: [{
|
|
185
|
-
translateX
|
|
186
|
-
}]
|
|
187
|
-
} : null, style],
|
|
188
|
-
...panResponder.panHandlers,
|
|
189
|
-
children: React.Children.map(children, (child, i) => {
|
|
190
|
-
const route = routes[i];
|
|
191
|
-
const focused = i === index;
|
|
192
|
-
return /*#__PURE__*/_jsx(View, {
|
|
193
|
-
style: layout.width ? {
|
|
194
|
-
width: layout.width
|
|
195
|
-
} : focused ? StyleSheet.absoluteFill : null,
|
|
196
|
-
children: focused || layout.width ? child : null
|
|
197
|
-
}, route.key);
|
|
198
|
-
})
|
|
199
|
-
})
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
const styles = StyleSheet.create({
|
|
203
|
-
sheet: {
|
|
204
|
-
flex: 1,
|
|
205
|
-
flexDirection: 'row',
|
|
206
|
-
alignItems: 'stretch'
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
//# sourceMappingURL=PanResponderAdapter.js.map
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { Platform, Pressable } from 'react-native';
|
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
const ANDROID_VERSION_LOLLIPOP = 21;
|
|
7
|
-
const ANDROID_SUPPORTS_RIPPLE = Platform.OS === 'android' && Platform.Version >= ANDROID_VERSION_LOLLIPOP;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* PlatformPressable provides an abstraction on top of Pressable to handle platform differences.
|
|
11
|
-
*/
|
|
12
|
-
export function PlatformPressable({
|
|
13
|
-
disabled,
|
|
14
|
-
android_ripple,
|
|
15
|
-
pressColor = 'rgba(0, 0, 0, .32)',
|
|
16
|
-
pressOpacity,
|
|
17
|
-
style,
|
|
18
|
-
onPress,
|
|
19
|
-
...rest
|
|
20
|
-
}) {
|
|
21
|
-
const handlePress = e => {
|
|
22
|
-
if (Platform.OS === 'web' && rest.href !== null) {
|
|
23
|
-
// ignore clicks with modifier keys
|
|
24
|
-
const hasModifierKey = 'metaKey' in e && e.metaKey || 'altKey' in e && e.altKey || 'ctrlKey' in e && e.ctrlKey || 'shiftKey' in e && e.shiftKey;
|
|
25
|
-
|
|
26
|
-
// only handle left clicks
|
|
27
|
-
const isLeftClick = 'button' in e ? e.button == null || e.button === 0 : true;
|
|
28
|
-
|
|
29
|
-
// let browser handle "target=_blank" etc.
|
|
30
|
-
const isSelfTarget = e.currentTarget && 'target' in e.currentTarget ? [undefined, null, '', 'self'].includes(e.currentTarget.target) : true;
|
|
31
|
-
if (!hasModifierKey && isLeftClick && isSelfTarget) {
|
|
32
|
-
e.preventDefault();
|
|
33
|
-
// call `onPress` only when browser default is prevented
|
|
34
|
-
// this prevents app from handling the click when a link is being opened
|
|
35
|
-
onPress?.(e);
|
|
36
|
-
}
|
|
37
|
-
} else {
|
|
38
|
-
onPress?.(e);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
return /*#__PURE__*/_jsx(Pressable, {
|
|
42
|
-
android_ripple: ANDROID_SUPPORTS_RIPPLE && !disabled ? {
|
|
43
|
-
color: pressColor,
|
|
44
|
-
...android_ripple
|
|
45
|
-
} : undefined,
|
|
46
|
-
style: ({
|
|
47
|
-
pressed
|
|
48
|
-
}) => [{
|
|
49
|
-
cursor: (Platform.OS === 'web' || Platform.OS === 'ios') && !disabled ?
|
|
50
|
-
// Pointer cursor on web
|
|
51
|
-
// Hover effect on iPad and visionOS
|
|
52
|
-
'pointer' : 'auto',
|
|
53
|
-
opacity: !ANDROID_SUPPORTS_RIPPLE && pressed && !disabled ? pressOpacity : 1
|
|
54
|
-
}, typeof style === 'function' ? style({
|
|
55
|
-
pressed
|
|
56
|
-
}) : style],
|
|
57
|
-
onPress: disabled ? undefined : handlePress,
|
|
58
|
-
...rest
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
//# sourceMappingURL=PlatformPressable.js.map
|
package/lib/module/SceneMap.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
-
const SceneComponent = /*#__PURE__*/React.memo(({
|
|
6
|
-
component,
|
|
7
|
-
...rest
|
|
8
|
-
}) => {
|
|
9
|
-
return /*#__PURE__*/React.createElement(component, rest);
|
|
10
|
-
});
|
|
11
|
-
SceneComponent.displayName = 'SceneComponent';
|
|
12
|
-
export function SceneMap(scenes) {
|
|
13
|
-
return ({
|
|
14
|
-
route,
|
|
15
|
-
jumpTo,
|
|
16
|
-
position
|
|
17
|
-
}) => /*#__PURE__*/_jsx(SceneComponent, {
|
|
18
|
-
component: scenes[route.key],
|
|
19
|
-
route: route,
|
|
20
|
-
jumpTo: jumpTo,
|
|
21
|
-
position: position
|
|
22
|
-
}, route.key);
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=SceneMap.js.map
|
package/lib/module/SceneView.js
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { StyleSheet, View } from 'react-native';
|
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
export function SceneView({
|
|
7
|
-
children,
|
|
8
|
-
navigationState,
|
|
9
|
-
lazy,
|
|
10
|
-
layout,
|
|
11
|
-
index,
|
|
12
|
-
lazyPreloadDistance,
|
|
13
|
-
addEnterListener,
|
|
14
|
-
style
|
|
15
|
-
}) {
|
|
16
|
-
const [isLoading, setIsLoading] = React.useState(Math.abs(navigationState.index - index) > lazyPreloadDistance);
|
|
17
|
-
if (isLoading && Math.abs(navigationState.index - index) <= lazyPreloadDistance) {
|
|
18
|
-
// Always render the route when it becomes focused
|
|
19
|
-
setIsLoading(false);
|
|
20
|
-
}
|
|
21
|
-
React.useEffect(() => {
|
|
22
|
-
const handleEnter = value => {
|
|
23
|
-
// If we're entering the current route, we need to load it
|
|
24
|
-
if (value === index) {
|
|
25
|
-
setIsLoading(prevState => {
|
|
26
|
-
if (prevState) {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
return prevState;
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
let unsubscribe;
|
|
34
|
-
let timer;
|
|
35
|
-
if (lazy && isLoading) {
|
|
36
|
-
// If lazy mode is enabled, listen to when we enter screens
|
|
37
|
-
unsubscribe = addEnterListener(handleEnter);
|
|
38
|
-
} else if (isLoading) {
|
|
39
|
-
// If lazy mode is not enabled, render the scene with a delay if not loaded already
|
|
40
|
-
// This improves the initial startup time as the scene is no longer blocking
|
|
41
|
-
timer = setTimeout(() => setIsLoading(false), 0);
|
|
42
|
-
}
|
|
43
|
-
return () => {
|
|
44
|
-
unsubscribe?.();
|
|
45
|
-
clearTimeout(timer);
|
|
46
|
-
};
|
|
47
|
-
}, [addEnterListener, index, isLoading, lazy]);
|
|
48
|
-
const focused = navigationState.index === index;
|
|
49
|
-
return /*#__PURE__*/_jsx(View, {
|
|
50
|
-
"aria-hidden": !focused,
|
|
51
|
-
style: [styles.route,
|
|
52
|
-
// If we don't have the layout yet, make the focused screen fill the container
|
|
53
|
-
// This avoids delay before we are able to render pages side by side
|
|
54
|
-
layout.width ? {
|
|
55
|
-
width: layout.width
|
|
56
|
-
} : focused ? StyleSheet.absoluteFill : null, style],
|
|
57
|
-
children:
|
|
58
|
-
// Only render the route only if it's either focused or layout is available
|
|
59
|
-
// When layout is not available, we must not render unfocused routes
|
|
60
|
-
// so that the focused route can fill the screen
|
|
61
|
-
focused || layout.width ? children({
|
|
62
|
-
loading: isLoading
|
|
63
|
-
}) : null
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
const styles = StyleSheet.create({
|
|
67
|
-
route: {
|
|
68
|
-
flex: 1,
|
|
69
|
-
overflow: 'hidden'
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
//# sourceMappingURL=SceneView.js.map
|