@soundtrackio/react-native-bottom-tabs 1.4.0
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 +32 -0
- package/android/build.gradle +132 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/rcttabview/ImageSource.kt +86 -0
- package/android/src/main/java/com/rcttabview/LatestRequestTracker.kt +19 -0
- package/android/src/main/java/com/rcttabview/RCTTabView.kt +689 -0
- package/android/src/main/java/com/rcttabview/RCTTabViewManager.kt +222 -0
- package/android/src/main/java/com/rcttabview/RCTTabViewPackage.kt +19 -0
- package/android/src/main/java/com/rcttabview/RCTTabViewPrewarm.kt +40 -0
- package/android/src/main/java/com/rcttabview/RebuildBatch.kt +31 -0
- package/android/src/main/java/com/rcttabview/TabBarVisibility.kt +14 -0
- package/android/src/main/java/com/rcttabview/Utils.kt +31 -0
- package/android/src/main/java/com/rcttabview/events/OnNativeLayoutEvent.kt +25 -0
- package/android/src/main/java/com/rcttabview/events/OnTabBarMeasuredEvent.kt +24 -0
- package/android/src/main/java/com/rcttabview/events/PageSelectedEvent.kt +32 -0
- package/android/src/main/java/com/rcttabview/events/TabLongPressedEvent.kt +24 -0
- package/android/src/test/java/com/rcttabview/LatestRequestTrackerTest.kt +37 -0
- package/android/src/test/java/com/rcttabview/RebuildBatchTest.kt +44 -0
- package/android/src/test/java/com/rcttabview/TabBarVisibilityTest.kt +58 -0
- package/app.plugin.js +1 -0
- package/common/cpp/react/renderer/components/RNCTabView/RNCTabViewComponentDescriptor.h +33 -0
- package/common/cpp/react/renderer/components/RNCTabView/RNCTabViewShadowNode.cpp +19 -0
- package/common/cpp/react/renderer/components/RNCTabView/RNCTabViewShadowNode.h +35 -0
- package/common/cpp/react/renderer/components/RNCTabView/RNCTabViewState.cpp +15 -0
- package/common/cpp/react/renderer/components/RNCTabView/RNCTabViewState.h +25 -0
- package/ios/BottomAccessoryProvider.swift +27 -0
- package/ios/Extensions.swift +101 -0
- package/ios/PlatformAliases.swift +43 -0
- package/ios/RCTBottomAccessoryComponentView.h +17 -0
- package/ios/RCTBottomAccessoryComponentView.mm +76 -0
- package/ios/RCTTabViewComponentView.h +16 -0
- package/ios/RCTTabViewComponentView.mm +285 -0
- package/ios/RepresentableView.swift +55 -0
- package/ios/SVG/CoreSVG.h +19 -0
- package/ios/SVG/CoreSVG.mm +177 -0
- package/ios/SVG/SvgDecoder.h +10 -0
- package/ios/SVG/SvgDecoder.mm +38 -0
- package/ios/TabAppearModifier.swift +38 -0
- package/ios/TabBarFontSize.swift +88 -0
- package/ios/TabItem.swift +35 -0
- package/ios/TabItemEventModifier.swift +163 -0
- package/ios/TabView/AnyTabView.swift +7 -0
- package/ios/TabView/LegacyTabView.swift +70 -0
- package/ios/TabView/NewTabView.swift +138 -0
- package/ios/TabViewImpl.swift +566 -0
- package/ios/TabViewProps.swift +109 -0
- package/ios/TabViewProvider.swift +368 -0
- package/ios/react-native-bottom-tabs-Bridging-Header.h +4 -0
- package/lib/module/BottomAccessoryView.js +47 -0
- package/lib/module/BottomAccessoryView.js.map +1 -0
- package/lib/module/BottomAccessoryViewNativeComponent.ts +27 -0
- package/lib/module/DelayedFreeze.js +31 -0
- package/lib/module/DelayedFreeze.js.map +1 -0
- package/lib/module/NativeSVGDecoder.js +5 -0
- package/lib/module/NativeSVGDecoder.js.map +1 -0
- package/lib/module/SceneMap.js +28 -0
- package/lib/module/SceneMap.js.map +1 -0
- package/lib/module/TabView.js +294 -0
- package/lib/module/TabView.js.map +1 -0
- package/lib/module/TabViewNativeComponent.ts +73 -0
- package/lib/module/expo.js +35 -0
- package/lib/module/expo.js.map +1 -0
- package/lib/module/index.js +20 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/types.js +4 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/utils/BottomTabBarHeightContext.js +5 -0
- package/lib/module/utils/BottomTabBarHeightContext.js.map +1 -0
- package/lib/module/utils/useBottomTabBarHeight.js +12 -0
- package/lib/module/utils/useBottomTabBarHeight.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/BottomAccessoryView.d.ts +7 -0
- package/lib/typescript/src/BottomAccessoryView.d.ts.map +1 -0
- package/lib/typescript/src/BottomAccessoryView.js +24 -0
- package/lib/typescript/src/BottomAccessoryViewNativeComponent.d.ts +15 -0
- package/lib/typescript/src/BottomAccessoryViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/BottomAccessoryViewNativeComponent.js +4 -0
- package/lib/typescript/src/DelayedFreeze.d.ts +7 -0
- package/lib/typescript/src/DelayedFreeze.d.ts.map +1 -0
- package/lib/typescript/src/DelayedFreeze.js +21 -0
- package/lib/typescript/src/NativeSVGDecoder.d.ts +5 -0
- package/lib/typescript/src/NativeSVGDecoder.d.ts.map +1 -0
- package/lib/typescript/src/NativeSVGDecoder.js +2 -0
- package/lib/typescript/src/SceneMap.d.ts +9 -0
- package/lib/typescript/src/SceneMap.d.ts.map +1 -0
- package/lib/typescript/src/SceneMap.js +15 -0
- package/lib/typescript/src/TabView.d.ts +219 -0
- package/lib/typescript/src/TabView.d.ts.map +1 -0
- package/lib/typescript/src/TabView.js +157 -0
- package/lib/typescript/src/TabViewNativeComponent.d.ts +59 -0
- package/lib/typescript/src/TabViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/TabViewNativeComponent.js +4 -0
- package/lib/typescript/src/expo.d.ts +6 -0
- package/lib/typescript/src/expo.d.ts.map +1 -0
- package/lib/typescript/src/expo.js +34 -0
- package/lib/typescript/src/index.d.ts +15 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/index.js +11 -0
- package/lib/typescript/src/types.d.ts +31 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/lib/typescript/src/types.js +1 -0
- package/lib/typescript/src/utils/BottomTabBarHeightContext.d.ts +2 -0
- package/lib/typescript/src/utils/BottomTabBarHeightContext.d.ts.map +1 -0
- package/lib/typescript/src/utils/BottomTabBarHeightContext.js +2 -0
- package/lib/typescript/src/utils/useBottomTabBarHeight.d.ts +1 -0
- package/lib/typescript/src/utils/useBottomTabBarHeight.d.ts.map +1 -0
- package/lib/typescript/src/utils/useBottomTabBarHeight.js +9 -0
- package/lib/typescript/tsconfig.tsbuildinfo +1 -0
- package/package.json +135 -0
- package/react-native-bottom-tabs.podspec +43 -0
- package/src/BottomAccessoryView.tsx +59 -0
- package/src/BottomAccessoryViewNativeComponent.ts +27 -0
- package/src/DelayedFreeze.tsx +31 -0
- package/src/NativeSVGDecoder.ts +5 -0
- package/src/SceneMap.tsx +34 -0
- package/src/TabView.tsx +558 -0
- package/src/TabViewNativeComponent.ts +73 -0
- package/src/expo.ts +58 -0
- package/src/index.tsx +23 -0
- package/src/types.ts +36 -0
- package/src/utils/BottomTabBarHeightContext.ts +5 -0
- package/src/utils/useBottomTabBarHeight.ts +15 -0
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useLayoutEffect, useRef } from 'react';
|
|
4
|
+
import { Image, Platform, StyleSheet, View, processColor } from 'react-native';
|
|
5
|
+
import { BottomTabBarHeightContext } from "./utils/BottomTabBarHeightContext.js";
|
|
6
|
+
|
|
7
|
+
// eslint-disable-next-line @react-native/no-deep-imports
|
|
8
|
+
|
|
9
|
+
import NativeTabView from './TabViewNativeComponent';
|
|
10
|
+
import useLatestCallback from 'use-latest-callback';
|
|
11
|
+
import DelayedFreeze from "./DelayedFreeze.js";
|
|
12
|
+
import { BottomAccessoryView } from "./BottomAccessoryView.js";
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
const isAppleSymbol = icon => icon?.sfSymbol;
|
|
15
|
+
const ANDROID_MAX_TABS = 100;
|
|
16
|
+
const TabView = ({
|
|
17
|
+
navigationState,
|
|
18
|
+
renderScene,
|
|
19
|
+
onIndexChange,
|
|
20
|
+
onTabLongPress,
|
|
21
|
+
rippleColor,
|
|
22
|
+
tabBarActiveTintColor: activeTintColor,
|
|
23
|
+
tabBarInactiveTintColor: inactiveTintColor,
|
|
24
|
+
getBadge = ({
|
|
25
|
+
route
|
|
26
|
+
}) => route.badge,
|
|
27
|
+
getBadgeBackgroundColor = ({
|
|
28
|
+
route
|
|
29
|
+
}) => route.badgeBackgroundColor,
|
|
30
|
+
getBadgeTextColor = ({
|
|
31
|
+
route
|
|
32
|
+
}) => route.badgeTextColor,
|
|
33
|
+
getLazy = ({
|
|
34
|
+
route
|
|
35
|
+
}) => route.lazy,
|
|
36
|
+
getLabelText = ({
|
|
37
|
+
route
|
|
38
|
+
}) => route.title,
|
|
39
|
+
getIcon = ({
|
|
40
|
+
route,
|
|
41
|
+
focused
|
|
42
|
+
}) => route.unfocusedIcon ? focused ? route.focusedIcon : route.unfocusedIcon : route.focusedIcon,
|
|
43
|
+
getHidden = ({
|
|
44
|
+
route
|
|
45
|
+
}) => route.hidden,
|
|
46
|
+
getActiveTintColor = ({
|
|
47
|
+
route
|
|
48
|
+
}) => route.activeTintColor,
|
|
49
|
+
getTestID = ({
|
|
50
|
+
route
|
|
51
|
+
}) => route.testID,
|
|
52
|
+
getRole = ({
|
|
53
|
+
route
|
|
54
|
+
}) => route.role,
|
|
55
|
+
getIconRenderingMode = ({
|
|
56
|
+
route
|
|
57
|
+
}) => route.iconRenderingMode,
|
|
58
|
+
getSceneStyle = ({
|
|
59
|
+
route
|
|
60
|
+
}) => route.style,
|
|
61
|
+
getPreventsDefault = ({
|
|
62
|
+
route
|
|
63
|
+
}) => route.preventsDefault,
|
|
64
|
+
hapticFeedbackEnabled = false,
|
|
65
|
+
// Android's native behavior is to show labels when there are less than 4 tabs. We leave it as undefined to use the platform default behavior.
|
|
66
|
+
labeled = Platform.OS !== 'android' ? true : undefined,
|
|
67
|
+
getFreezeOnBlur = ({
|
|
68
|
+
route
|
|
69
|
+
}) => route.freezeOnBlur,
|
|
70
|
+
tabBar: renderCustomTabBar,
|
|
71
|
+
tabBarHidden,
|
|
72
|
+
tabBarHideOnKeyboard,
|
|
73
|
+
tabBarStyle,
|
|
74
|
+
tabLabelStyle,
|
|
75
|
+
renderBottomAccessoryView,
|
|
76
|
+
layoutDirection = 'locale',
|
|
77
|
+
experimental_bakedTintColors: experimentalBakedTintColors = false,
|
|
78
|
+
...props
|
|
79
|
+
}) => {
|
|
80
|
+
// @ts-ignore
|
|
81
|
+
const focusedKey = navigationState.routes[navigationState.index].key;
|
|
82
|
+
const customTabBarWrapperRef = useRef(null);
|
|
83
|
+
const [tabBarHeight, setTabBarHeight] = React.useState(0);
|
|
84
|
+
const [measuredDimensions, setMeasuredDimensions] = React.useState({
|
|
85
|
+
width: '100%',
|
|
86
|
+
height: '100%'
|
|
87
|
+
});
|
|
88
|
+
const trimmedRoutes = React.useMemo(() => {
|
|
89
|
+
if (Platform.OS === 'android' && navigationState.routes.length > ANDROID_MAX_TABS) {
|
|
90
|
+
console.warn(`TabView only supports up to ${ANDROID_MAX_TABS} tabs on Android`);
|
|
91
|
+
return navigationState.routes.slice(0, ANDROID_MAX_TABS);
|
|
92
|
+
}
|
|
93
|
+
return navigationState.routes;
|
|
94
|
+
}, [navigationState.routes]);
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* List of loaded tabs, tabs will be loaded when navigated to.
|
|
98
|
+
*/
|
|
99
|
+
const [loaded, setLoaded] = React.useState([focusedKey]);
|
|
100
|
+
if (!loaded.includes(focusedKey)) {
|
|
101
|
+
// Set the current tab to be loaded if it was not loaded before
|
|
102
|
+
setLoaded(loaded => [...loaded, focusedKey]);
|
|
103
|
+
}
|
|
104
|
+
const icons = React.useMemo(() => trimmedRoutes.map(route => getIcon({
|
|
105
|
+
route,
|
|
106
|
+
// iOS uses UITabBarItem.selectedImage for selected and Liquid Glass hover states.
|
|
107
|
+
// Keep the base image unfocused so a selected tab can render unfocused while another tab is hovered.
|
|
108
|
+
focused: Platform.OS === 'ios' ? false : route.key === focusedKey
|
|
109
|
+
})), [focusedKey, getIcon, trimmedRoutes]);
|
|
110
|
+
const focusedIcons = React.useMemo(() => trimmedRoutes.map(route => getIcon({
|
|
111
|
+
route,
|
|
112
|
+
focused: true
|
|
113
|
+
})), [getIcon, trimmedRoutes]);
|
|
114
|
+
const items = React.useMemo(() => trimmedRoutes.map((route, index) => {
|
|
115
|
+
const icon = icons[index];
|
|
116
|
+
const isSfSymbol = isAppleSymbol(icon);
|
|
117
|
+
const focusedIcon = focusedIcons[index];
|
|
118
|
+
const isFocusedSfSymbol = isAppleSymbol(focusedIcon);
|
|
119
|
+
if (Platform.OS === 'android' && isSfSymbol) {
|
|
120
|
+
console.warn('SF Symbols are not supported on Android. Use require() or pass uri to load an image instead.');
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
key: route.key,
|
|
124
|
+
title: getLabelText({
|
|
125
|
+
route
|
|
126
|
+
}) ?? route.key,
|
|
127
|
+
sfSymbol: isSfSymbol ? icon.sfSymbol : undefined,
|
|
128
|
+
focusedSfSymbol: isFocusedSfSymbol ? focusedIcon.sfSymbol : undefined,
|
|
129
|
+
badge: getBadge?.({
|
|
130
|
+
route
|
|
131
|
+
}),
|
|
132
|
+
badgeBackgroundColor: processColor(getBadgeBackgroundColor?.({
|
|
133
|
+
route
|
|
134
|
+
})),
|
|
135
|
+
badgeTextColor: processColor(getBadgeTextColor?.({
|
|
136
|
+
route
|
|
137
|
+
})),
|
|
138
|
+
activeTintColor: processColor(getActiveTintColor({
|
|
139
|
+
route
|
|
140
|
+
})),
|
|
141
|
+
iconRenderingMode: getIconRenderingMode({
|
|
142
|
+
route
|
|
143
|
+
}),
|
|
144
|
+
hidden: getHidden?.({
|
|
145
|
+
route
|
|
146
|
+
}),
|
|
147
|
+
testID: getTestID?.({
|
|
148
|
+
route
|
|
149
|
+
}),
|
|
150
|
+
role: getRole?.({
|
|
151
|
+
route
|
|
152
|
+
}),
|
|
153
|
+
preventsDefault: getPreventsDefault?.({
|
|
154
|
+
route
|
|
155
|
+
})
|
|
156
|
+
};
|
|
157
|
+
}), [trimmedRoutes, icons, focusedIcons, getLabelText, getBadge, getBadgeBackgroundColor, getBadgeTextColor, getActiveTintColor, getIconRenderingMode, getHidden, getTestID, getRole, getPreventsDefault]);
|
|
158
|
+
const resolvedIconAssets = React.useMemo(() =>
|
|
159
|
+
// Pass empty object for icons that are not provided to avoid index mismatch on native side.
|
|
160
|
+
icons.map(icon => icon && !isAppleSymbol(icon) ?
|
|
161
|
+
// @ts-expect-error: TODO: Migrate of deep imports
|
|
162
|
+
Image.resolveAssetSource(icon) : {
|
|
163
|
+
uri: ''
|
|
164
|
+
}), [icons]);
|
|
165
|
+
const resolvedFocusedIconAssets = React.useMemo(() =>
|
|
166
|
+
// Pass empty object for icons that are not provided to avoid index mismatch on native side.
|
|
167
|
+
focusedIcons.map(icon => icon && !isAppleSymbol(icon) ?
|
|
168
|
+
// @ts-expect-error: TODO: Migrate of deep imports
|
|
169
|
+
Image.resolveAssetSource(icon) : {
|
|
170
|
+
uri: ''
|
|
171
|
+
}), [focusedIcons]);
|
|
172
|
+
const jumpTo = useLatestCallback(key => {
|
|
173
|
+
const index = trimmedRoutes.findIndex(route => route.key === key);
|
|
174
|
+
onIndexChange(index);
|
|
175
|
+
});
|
|
176
|
+
const handleTabLongPress = React.useCallback(({
|
|
177
|
+
nativeEvent: {
|
|
178
|
+
key
|
|
179
|
+
}
|
|
180
|
+
}) => {
|
|
181
|
+
const index = trimmedRoutes.findIndex(route => route.key === key);
|
|
182
|
+
onTabLongPress?.(index);
|
|
183
|
+
}, [trimmedRoutes, onTabLongPress]);
|
|
184
|
+
const handlePageSelected = React.useCallback(({
|
|
185
|
+
nativeEvent: {
|
|
186
|
+
key
|
|
187
|
+
}
|
|
188
|
+
}) => {
|
|
189
|
+
jumpTo(key);
|
|
190
|
+
}, [jumpTo]);
|
|
191
|
+
const handleTabBarMeasured = React.useCallback(({
|
|
192
|
+
nativeEvent: {
|
|
193
|
+
height
|
|
194
|
+
}
|
|
195
|
+
}) => {
|
|
196
|
+
setTabBarHeight(height);
|
|
197
|
+
}, [setTabBarHeight]);
|
|
198
|
+
const handleNativeLayout = React.useCallback(({
|
|
199
|
+
nativeEvent: {
|
|
200
|
+
width,
|
|
201
|
+
height
|
|
202
|
+
}
|
|
203
|
+
}) => {
|
|
204
|
+
setMeasuredDimensions({
|
|
205
|
+
width,
|
|
206
|
+
height
|
|
207
|
+
});
|
|
208
|
+
}, [setMeasuredDimensions]);
|
|
209
|
+
useLayoutEffect(() => {
|
|
210
|
+
// If we are rendering a custom tab bar, we need to measure it to set the tab bar height.
|
|
211
|
+
if (renderCustomTabBar && customTabBarWrapperRef.current) {
|
|
212
|
+
customTabBarWrapperRef.current.measure((_x, _y, _width, height) => {
|
|
213
|
+
setTabBarHeight(height);
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
}, [renderCustomTabBar]);
|
|
217
|
+
return /*#__PURE__*/_jsxs(BottomTabBarHeightContext.Provider, {
|
|
218
|
+
value: tabBarHeight,
|
|
219
|
+
children: [/*#__PURE__*/_jsxs(NativeTabView, {
|
|
220
|
+
...props,
|
|
221
|
+
...tabLabelStyle,
|
|
222
|
+
style: styles.fullWidth,
|
|
223
|
+
items: items
|
|
224
|
+
// When rendering a custom tab bar, icons can be React elements, which will not be properly resolved.
|
|
225
|
+
,
|
|
226
|
+
icons: renderCustomTabBar ? undefined : resolvedIconAssets,
|
|
227
|
+
focusedIcons: renderCustomTabBar ? undefined : resolvedFocusedIconAssets,
|
|
228
|
+
selectedPage: focusedKey,
|
|
229
|
+
tabBarHidden: tabBarHidden ?? !!renderCustomTabBar,
|
|
230
|
+
tabBarHideOnKeyboard: tabBarHideOnKeyboard,
|
|
231
|
+
onTabLongPress: handleTabLongPress,
|
|
232
|
+
onPageSelected: handlePageSelected,
|
|
233
|
+
onTabBarMeasured: handleTabBarMeasured,
|
|
234
|
+
onNativeLayout: handleNativeLayout,
|
|
235
|
+
hapticFeedbackEnabled: hapticFeedbackEnabled,
|
|
236
|
+
layoutDirection: layoutDirection,
|
|
237
|
+
activeTintColor: activeTintColor,
|
|
238
|
+
inactiveTintColor: inactiveTintColor,
|
|
239
|
+
experimentalBakedTintColors: experimentalBakedTintColors,
|
|
240
|
+
barTintColor: tabBarStyle?.backgroundColor,
|
|
241
|
+
rippleColor: rippleColor,
|
|
242
|
+
labeled: labeled,
|
|
243
|
+
children: [trimmedRoutes.map(route => {
|
|
244
|
+
if (getLazy({
|
|
245
|
+
route
|
|
246
|
+
}) !== false && !loaded.includes(route.key)) {
|
|
247
|
+
// Don't render a screen if we've never navigated to it
|
|
248
|
+
return /*#__PURE__*/_jsx(View, {
|
|
249
|
+
collapsable: false,
|
|
250
|
+
style: styles.fullWidth
|
|
251
|
+
}, route.key);
|
|
252
|
+
}
|
|
253
|
+
const focused = route.key === focusedKey;
|
|
254
|
+
const freeze = !focused ? getFreezeOnBlur({
|
|
255
|
+
route
|
|
256
|
+
}) : false;
|
|
257
|
+
const customStyle = getSceneStyle({
|
|
258
|
+
route
|
|
259
|
+
});
|
|
260
|
+
return /*#__PURE__*/_jsx(View, {
|
|
261
|
+
style: [styles.screen, renderCustomTabBar ? styles.fullWidth : measuredDimensions, customStyle],
|
|
262
|
+
collapsable: false,
|
|
263
|
+
pointerEvents: focused ? 'auto' : 'none',
|
|
264
|
+
accessibilityElementsHidden: !focused,
|
|
265
|
+
importantForAccessibility: focused ? 'auto' : 'no-hide-descendants',
|
|
266
|
+
children: /*#__PURE__*/_jsx(DelayedFreeze, {
|
|
267
|
+
freeze: !!freeze,
|
|
268
|
+
children: renderScene({
|
|
269
|
+
route,
|
|
270
|
+
jumpTo
|
|
271
|
+
})
|
|
272
|
+
})
|
|
273
|
+
}, route.key);
|
|
274
|
+
}), Platform.OS === 'ios' && parseFloat(Platform.Version) >= 26 && renderBottomAccessoryView && !renderCustomTabBar ? /*#__PURE__*/_jsx(BottomAccessoryView, {
|
|
275
|
+
renderBottomAccessoryView: renderBottomAccessoryView
|
|
276
|
+
}) : null]
|
|
277
|
+
}), renderCustomTabBar ? /*#__PURE__*/_jsx(View, {
|
|
278
|
+
ref: customTabBarWrapperRef,
|
|
279
|
+
children: renderCustomTabBar()
|
|
280
|
+
}) : null]
|
|
281
|
+
});
|
|
282
|
+
};
|
|
283
|
+
const styles = StyleSheet.create({
|
|
284
|
+
fullWidth: {
|
|
285
|
+
width: '100%',
|
|
286
|
+
height: '100%',
|
|
287
|
+
flex: 1
|
|
288
|
+
},
|
|
289
|
+
screen: {
|
|
290
|
+
position: 'absolute'
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
export default TabView;
|
|
294
|
+
//# sourceMappingURL=TabView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useLayoutEffect","useRef","Image","Platform","StyleSheet","View","processColor","BottomTabBarHeightContext","NativeTabView","useLatestCallback","DelayedFreeze","BottomAccessoryView","jsx","_jsx","jsxs","_jsxs","isAppleSymbol","icon","sfSymbol","ANDROID_MAX_TABS","TabView","navigationState","renderScene","onIndexChange","onTabLongPress","rippleColor","tabBarActiveTintColor","activeTintColor","tabBarInactiveTintColor","inactiveTintColor","getBadge","route","badge","getBadgeBackgroundColor","badgeBackgroundColor","getBadgeTextColor","badgeTextColor","getLazy","lazy","getLabelText","title","getIcon","focused","unfocusedIcon","focusedIcon","getHidden","hidden","getActiveTintColor","getTestID","testID","getRole","role","getIconRenderingMode","iconRenderingMode","getSceneStyle","style","getPreventsDefault","preventsDefault","hapticFeedbackEnabled","labeled","OS","undefined","getFreezeOnBlur","freezeOnBlur","tabBar","renderCustomTabBar","tabBarHidden","tabBarHideOnKeyboard","tabBarStyle","tabLabelStyle","renderBottomAccessoryView","layoutDirection","experimental_bakedTintColors","experimentalBakedTintColors","props","focusedKey","routes","index","key","customTabBarWrapperRef","tabBarHeight","setTabBarHeight","useState","measuredDimensions","setMeasuredDimensions","width","height","trimmedRoutes","useMemo","length","console","warn","slice","loaded","setLoaded","includes","icons","map","focusedIcons","items","isSfSymbol","isFocusedSfSymbol","focusedSfSymbol","resolvedIconAssets","resolveAssetSource","uri","resolvedFocusedIconAssets","jumpTo","findIndex","handleTabLongPress","useCallback","nativeEvent","handlePageSelected","handleTabBarMeasured","handleNativeLayout","current","measure","_x","_y","_width","Provider","value","children","styles","fullWidth","selectedPage","onPageSelected","onTabBarMeasured","onNativeLayout","barTintColor","backgroundColor","collapsable","freeze","customStyle","screen","pointerEvents","accessibilityElementsHidden","importantForAccessibility","parseFloat","Version","ref","create","flex","position"],"sourceRoot":"../../src","sources":["TabView.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,eAAe,EAAEC,MAAM,QAAQ,OAAO;AAOtD,SAGEC,KAAK,EACLC,QAAQ,EAERC,UAAU,EACVC,IAAI,EAEJC,YAAY,QACP,cAAc;AACrB,SAASC,yBAAyB,QAAQ,sCAAmC;;AAE7E;;AAEA,OAAOC,aAAa,MAAM,0BAA0B;AACpD,OAAOC,iBAAiB,MAAM,qBAAqB;AASnD,OAAOC,aAAa,MAAM,oBAAiB;AAC3C,SACEC,mBAAmB,QAEd,0BAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE/B,MAAMC,aAAa,GAAIC,IAAS,IAC9BA,IAAI,EAAEC,QAAQ;AA8MhB,MAAMC,gBAAgB,GAAG,GAAG;AAE5B,MAAMC,OAAO,GAAGA,CAA0B;EACxCC,eAAe;EACfC,WAAW;EACXC,aAAa;EACbC,cAAc;EACdC,WAAW;EACXC,qBAAqB,EAAEC,eAAe;EACtCC,uBAAuB,EAAEC,iBAAiB;EAC1CC,QAAQ,GAAGA,CAAC;IAAEC;EAAwB,CAAC,KAAKA,KAAK,CAACC,KAAK;EACvDC,uBAAuB,GAAGA,CAAC;IAAEF;EAAwB,CAAC,KACpDA,KAAK,CAACG,oBAAoB;EAC5BC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IAAI;IAAA,CACK,CAAC,EACfL,kBAAkB,gBACjBpD,IAAA,CAACR,IAAI;MAACuI,GAAG,EAAE7D,sBAAuB;MAAA2C,QAAA,EAAEzD,kBAAkB,CAAC;IAAC,CAAO,CAAC,GAC9D,IAAI;EAAA,CAC0B,CAAC;AAEzC,CAAC;AAED,MAAM0D,MAAM,GAAGvH,UAAU,CAACyI,MAAM,CAAC;EAC/BjB,SAAS,EAAE;IACTvC,KAAK,EAAE,MAAM;IACbC,MAAM,EAAE,MAAM;IACdwD,IAAI,EAAE;EACR,CAAC;EACDR,MAAM,EAAE;IACNS,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC;AAEF,eAAe3H,OAAO","ignoreList":[]}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
2
|
+
import type { ColorValue, ProcessedColorValue, ViewProps } from 'react-native';
|
|
3
|
+
import type {
|
|
4
|
+
DirectEventHandler,
|
|
5
|
+
Double,
|
|
6
|
+
Int32,
|
|
7
|
+
WithDefault,
|
|
8
|
+
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
9
|
+
//@ts-ignore
|
|
10
|
+
import type { ImageSource } from 'react-native/Libraries/Image/ImageSource';
|
|
11
|
+
|
|
12
|
+
export type OnPageSelectedEventData = Readonly<{
|
|
13
|
+
key: string;
|
|
14
|
+
}>;
|
|
15
|
+
|
|
16
|
+
export type OnTabBarMeasured = Readonly<{
|
|
17
|
+
height: Int32;
|
|
18
|
+
}>;
|
|
19
|
+
|
|
20
|
+
export type OnNativeLayout = Readonly<{
|
|
21
|
+
width: Double;
|
|
22
|
+
height: Double;
|
|
23
|
+
}>;
|
|
24
|
+
|
|
25
|
+
export type TabViewItems = ReadonlyArray<{
|
|
26
|
+
key: string;
|
|
27
|
+
title: string;
|
|
28
|
+
sfSymbol?: string;
|
|
29
|
+
focusedSfSymbol?: string;
|
|
30
|
+
badge?: string;
|
|
31
|
+
badgeBackgroundColor?: ProcessedColorValue | null;
|
|
32
|
+
badgeTextColor?: ProcessedColorValue | null;
|
|
33
|
+
activeTintColor?: ProcessedColorValue | null;
|
|
34
|
+
iconRenderingMode?: string;
|
|
35
|
+
hidden?: boolean;
|
|
36
|
+
testID?: string;
|
|
37
|
+
role?: string;
|
|
38
|
+
preventsDefault?: boolean;
|
|
39
|
+
}>;
|
|
40
|
+
|
|
41
|
+
export interface TabViewProps extends ViewProps {
|
|
42
|
+
items: TabViewItems;
|
|
43
|
+
selectedPage: string;
|
|
44
|
+
onPageSelected?: DirectEventHandler<OnPageSelectedEventData>;
|
|
45
|
+
onTabLongPress?: DirectEventHandler<OnPageSelectedEventData>;
|
|
46
|
+
onTabBarMeasured?: DirectEventHandler<OnTabBarMeasured>;
|
|
47
|
+
onNativeLayout?: DirectEventHandler<OnNativeLayout>;
|
|
48
|
+
icons?: ReadonlyArray<ImageSource>;
|
|
49
|
+
focusedIcons?: ReadonlyArray<ImageSource>;
|
|
50
|
+
tabBarHidden?: boolean;
|
|
51
|
+
tabBarHideOnKeyboard?: boolean;
|
|
52
|
+
labeled?: boolean;
|
|
53
|
+
sidebarAdaptable?: boolean;
|
|
54
|
+
scrollEdgeAppearance?: string;
|
|
55
|
+
barTintColor?: ColorValue;
|
|
56
|
+
translucent?: WithDefault<boolean, true>;
|
|
57
|
+
rippleColor?: ColorValue;
|
|
58
|
+
activeTintColor?: ColorValue;
|
|
59
|
+
inactiveTintColor?: ColorValue;
|
|
60
|
+
experimentalBakedTintColors?: WithDefault<boolean, false>;
|
|
61
|
+
disablePageAnimations?: boolean;
|
|
62
|
+
activeIndicatorColor?: ColorValue;
|
|
63
|
+
hapticFeedbackEnabled?: boolean;
|
|
64
|
+
layoutDirection?: string;
|
|
65
|
+
minimizeBehavior?: string;
|
|
66
|
+
fontFamily?: string;
|
|
67
|
+
fontWeight?: string;
|
|
68
|
+
fontSize?: Int32;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export default codegenNativeComponent<TabViewProps>('RNCTabView', {
|
|
72
|
+
interfaceOnly: true,
|
|
73
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createRequire } from 'node:module';
|
|
4
|
+
const require = createRequire(import.meta.url);
|
|
5
|
+
const ConfigPlugins = require('@expo/config-plugins');
|
|
6
|
+
const {
|
|
7
|
+
createRunOncePlugin,
|
|
8
|
+
withAndroidStyles
|
|
9
|
+
} = ConfigPlugins;
|
|
10
|
+
const MATERIAL3_THEME_DYANMIC = 'Theme.Material3.DynamicColors.DayNight.NoActionBar';
|
|
11
|
+
const MATERIAL3_THEME = 'Theme.Material3.DayNight.NoActionBar';
|
|
12
|
+
const MATERIAL2_THEME = 'Theme.MaterialComponents.DayNight.NoActionBar';
|
|
13
|
+
const MATERIAL3_EXPRESSIVE_THEME = 'Theme.Material3Expressive.DayNight.NoActionBar';
|
|
14
|
+
const withMaterial3Theme = (config, options) => {
|
|
15
|
+
const theme = options?.theme;
|
|
16
|
+
return withAndroidStyles(config, stylesConfig => {
|
|
17
|
+
stylesConfig.modResults.resources.style = stylesConfig.modResults.resources.style?.map(style => {
|
|
18
|
+
if (style.$.name === 'AppTheme') {
|
|
19
|
+
if (theme === 'material3-dynamic') {
|
|
20
|
+
style.$.parent = MATERIAL3_THEME_DYANMIC;
|
|
21
|
+
} else if (theme === 'material2') {
|
|
22
|
+
style.$.parent = MATERIAL2_THEME;
|
|
23
|
+
} else if (theme === 'material3-expressive') {
|
|
24
|
+
style.$.parent = MATERIAL3_EXPRESSIVE_THEME;
|
|
25
|
+
} else {
|
|
26
|
+
style.$.parent = MATERIAL3_THEME;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return style;
|
|
30
|
+
});
|
|
31
|
+
return stylesConfig;
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
export default createRunOncePlugin(withMaterial3Theme, 'react-native-bottom-tabs');
|
|
35
|
+
//# sourceMappingURL=expo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createRequire","require","import","meta","url","ConfigPlugins","createRunOncePlugin","withAndroidStyles","MATERIAL3_THEME_DYANMIC","MATERIAL3_THEME","MATERIAL2_THEME","MATERIAL3_EXPRESSIVE_THEME","withMaterial3Theme","config","options","theme","stylesConfig","modResults","resources","style","map","$","name","parent"],"sourceRoot":"../../src","sources":["expo.ts"],"mappings":";;AACA,SAASA,aAAa,QAAQ,aAAa;AAE3C,MAAMC,OAAO,GAAGD,aAAa,CAACE,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC;AAE9C,MAAMC,aAAa,GAAGJ,OAAO,CAAC,sBAAsB,CAAC;AAErD,MAAM;EAAEK,mBAAmB;EAAEC;AAAkB,CAAC,GAC9CF,aAAsD;AAExD,MAAMG,uBAAuB,GAC3B,oDAAoD;AACtD,MAAMC,eAAe,GAAG,sCAAsC;AAC9D,MAAMC,eAAe,GAAG,+CAA+C;AACvE,MAAMC,0BAA0B,GAC9B,gDAAgD;AAclD,MAAMC,kBAA6C,GAAGA,CAACC,MAAM,EAAEC,OAAO,KAAK;EACzE,MAAMC,KAAK,GAAGD,OAAO,EAAEC,KAAK;EAE5B,OAAOR,iBAAiB,CAACM,MAAM,EAAGG,YAAY,IAAK;IACjDA,YAAY,CAACC,UAAU,CAACC,SAAS,CAACC,KAAK,GACrCH,YAAY,CAACC,UAAU,CAACC,SAAS,CAACC,KAAK,EAAEC,GAAG,CAAED,KAAK,IAAK;MACtD,IAAIA,KAAK,CAACE,CAAC,CAACC,IAAI,KAAK,UAAU,EAAE;QAC/B,IAAIP,KAAK,KAAK,mBAAmB,EAAE;UACjCI,KAAK,CAACE,CAAC,CAACE,MAAM,GAAGf,uBAAuB;QAC1C,CAAC,MAAM,IAAIO,KAAK,KAAK,WAAW,EAAE;UAChCI,KAAK,CAACE,CAAC,CAACE,MAAM,GAAGb,eAAe;QAClC,CAAC,MAAM,IAAIK,KAAK,KAAK,sBAAsB,EAAE;UAC3CI,KAAK,CAACE,CAAC,CAACE,MAAM,GAAGZ,0BAA0B;QAC7C,CAAC,MAAM;UACLQ,KAAK,CAACE,CAAC,CAACE,MAAM,GAAGd,eAAe;QAClC;MACF;MAEA,OAAOU,KAAK;IACd,CAAC,CAAC;IAEJ,OAAOH,YAAY;EACrB,CAAC,CAAC;AACJ,CAAC;AAED,eAAeV,mBAAmB,CAChCM,kBAAkB,EAClB,0BACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import TabView from "./TabView.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Views
|
|
7
|
+
*/
|
|
8
|
+
export default TabView;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Utilities
|
|
12
|
+
*/
|
|
13
|
+
export { SceneMap } from "./SceneMap.js";
|
|
14
|
+
export { useBottomTabBarHeight } from "./utils/useBottomTabBarHeight.js";
|
|
15
|
+
export { BottomTabBarHeightContext } from "./utils/BottomTabBarHeightContext.js";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Types
|
|
19
|
+
*/
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TabView","SceneMap","useBottomTabBarHeight","BottomTabBarHeightContext"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,OAAO,MAAM,cAAW;;AAE/B;AACA;AACA;AACA,eAAeA,OAAO;;AAEtB;AACA;AACA;AACA,SAASC,QAAQ,QAAQ,eAAY;AACrC,SAASC,qBAAqB,QAAQ,kCAA+B;AACrE,SAASC,yBAAyB,QAAQ,sCAAmC;;AAE7E;AACA;AACA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","BottomTabBarHeightContext","createContext","undefined"],"sourceRoot":"../../../src","sources":["utils/BottomTabBarHeightContext.ts"],"mappings":";;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAE9B,OAAO,MAAMC,yBAAyB,gBAAGD,KAAK,CAACE,aAAa,CAE1DC,SAAS,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { BottomTabBarHeightContext } from "./BottomTabBarHeightContext.js";
|
|
5
|
+
export function useBottomTabBarHeight() {
|
|
6
|
+
const height = React.useContext(BottomTabBarHeightContext);
|
|
7
|
+
if (height === undefined) {
|
|
8
|
+
throw new Error("Couldn't find the bottom tab bar height. Are you inside a screen in Native Bottom Tab Navigator?");
|
|
9
|
+
}
|
|
10
|
+
return height;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=useBottomTabBarHeight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","BottomTabBarHeightContext","useBottomTabBarHeight","height","useContext","undefined","Error"],"sourceRoot":"../../../src","sources":["utils/useBottomTabBarHeight.ts"],"mappings":";;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAE9B,SAASC,yBAAyB,QAAQ,gCAA6B;AAEvE,OAAO,SAASC,qBAAqBA,CAAA,EAAG;EACtC,MAAMC,MAAM,GAAGH,KAAK,CAACI,UAAU,CAACH,yBAAyB,CAAC;EAE1D,IAAIE,MAAM,KAAKE,SAAS,EAAE;IACxB,MAAM,IAAIC,KAAK,CACb,kGACF,CAAC;EACH;EAEA,OAAOH,MAAM;AACf","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface BottomAccessoryViewProps {
|
|
3
|
+
renderBottomAccessoryView: (props: {
|
|
4
|
+
placement: 'inline' | 'expanded' | 'none';
|
|
5
|
+
}) => React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare const BottomAccessoryView: (props: BottomAccessoryViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BottomAccessoryView.d.ts","sourceRoot":"","sources":["../../../src/BottomAccessoryView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,MAAM,WAAW,wBAAwB;IACvC,yBAAyB,EAAE,CAAC,KAAK,EAAE;QACjC,SAAS,EAAE,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAC;KAC3C,KAAK,KAAK,CAAC,SAAS,CAAC;CACvB;AAED,eAAO,MAAM,mBAAmB,GAAI,OAAO,wBAAwB,4CAuClE,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import BottomAccessoryViewNativeComponent, {} from './BottomAccessoryViewNativeComponent';
|
|
4
|
+
const defaultStyle = {
|
|
5
|
+
position: 'absolute',
|
|
6
|
+
top: 0,
|
|
7
|
+
left: 0,
|
|
8
|
+
};
|
|
9
|
+
export const BottomAccessoryView = (props) => {
|
|
10
|
+
const { renderBottomAccessoryView } = props;
|
|
11
|
+
const [bottomAccessoryDimensions, setBottomAccessoryDimensions] = React.useState({ width: '100%', height: '100%' });
|
|
12
|
+
const [placement, setPlacement] = React.useState('none');
|
|
13
|
+
const handleNativeLayout = React.useCallback(({ nativeEvent: { width, height } }) => {
|
|
14
|
+
setBottomAccessoryDimensions({ width, height });
|
|
15
|
+
}, [setBottomAccessoryDimensions]);
|
|
16
|
+
const handlePlacementChanged = React.useCallback(({ nativeEvent }) => {
|
|
17
|
+
if (nativeEvent.placement === 'inline' ||
|
|
18
|
+
nativeEvent.placement === 'expanded' ||
|
|
19
|
+
nativeEvent.placement === 'none') {
|
|
20
|
+
setPlacement(nativeEvent.placement);
|
|
21
|
+
}
|
|
22
|
+
}, [setPlacement]);
|
|
23
|
+
return (_jsx(BottomAccessoryViewNativeComponent, { style: [defaultStyle, bottomAccessoryDimensions], onNativeLayout: handleNativeLayout, onPlacementChanged: handlePlacementChanged, children: renderBottomAccessoryView({ placement }) }));
|
|
24
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ViewProps } from 'react-native';
|
|
2
|
+
import type { DirectEventHandler, Double } from 'react-native/Libraries/Types/CodegenTypes';
|
|
3
|
+
export type OnNativeLayout = Readonly<{
|
|
4
|
+
width: Double;
|
|
5
|
+
height: Double;
|
|
6
|
+
}>;
|
|
7
|
+
export type OnPlacementChanged = Readonly<{
|
|
8
|
+
placement: string;
|
|
9
|
+
}>;
|
|
10
|
+
export interface BottomAccessoryViewNativeProps extends ViewProps {
|
|
11
|
+
onNativeLayout?: DirectEventHandler<OnNativeLayout>;
|
|
12
|
+
onPlacementChanged?: DirectEventHandler<OnPlacementChanged>;
|
|
13
|
+
}
|
|
14
|
+
declare const _default: import("react-native").HostComponent<BottomAccessoryViewNativeProps>;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BottomAccessoryViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/BottomAccessoryViewNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EACV,kBAAkB,EAClB,MAAM,EACP,MAAM,2CAA2C,CAAC;AAEnD,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC;IACxC,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC,CAAC;AAEH,MAAM,WAAW,8BAA+B,SAAQ,SAAS;IAC/D,cAAc,CAAC,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC;IACpD,kBAAkB,CAAC,EAAE,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;CAC7D;;AAED,wBAKE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DelayedFreeze.d.ts","sourceRoot":"","sources":["../../../src/DelayedFreeze.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,UAAU,kBAAkB;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAOD,iBAAS,aAAa,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,kBAAkB,2CAe9D;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Freeze } from 'react-freeze';
|
|
4
|
+
// Animation delay for freeze effect.
|
|
5
|
+
const ANIMATION_DELAY = 200;
|
|
6
|
+
// This component delays the freeze effect by animation delay.
|
|
7
|
+
// So that the screen is not frozen immediately causing background flash.
|
|
8
|
+
function DelayedFreeze({ freeze, children }) {
|
|
9
|
+
// flag used for determining whether freeze should be enabled
|
|
10
|
+
const [freezeState, setFreezeState] = React.useState(false);
|
|
11
|
+
React.useEffect(() => {
|
|
12
|
+
const id = setTimeout(() => {
|
|
13
|
+
setFreezeState(freeze);
|
|
14
|
+
}, ANIMATION_DELAY);
|
|
15
|
+
return () => {
|
|
16
|
+
clearTimeout(id);
|
|
17
|
+
};
|
|
18
|
+
}, [freeze]);
|
|
19
|
+
return _jsx(Freeze, { freeze: freeze ? freezeState : false, children: children });
|
|
20
|
+
}
|
|
21
|
+
export default DelayedFreeze;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeSVGDecoder.d.ts","sourceRoot":"","sources":["../../../src/NativeSVGDecoder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAErE,MAAM,WAAW,IAAK,SAAQ,WAAW;CAAG;;AAE5C,wBAAoE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
type SceneProps = {
|
|
3
|
+
route: any;
|
|
4
|
+
jumpTo: (key: string) => void;
|
|
5
|
+
};
|
|
6
|
+
export declare function SceneMap<T>(scenes: {
|
|
7
|
+
[key: string]: React.ComponentType<T>;
|
|
8
|
+
}): ({ route, jumpTo }: SceneProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SceneMap.d.ts","sourceRoot":"","sources":["../../../src/SceneMap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,KAAK,UAAU,GAAG;IAChB,KAAK,EAAE,GAAG,CAAC;IACX,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/B,CAAC;AAaF,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAA;CAAE,IACnE,mBAAmB,UAAU,oDActC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
const SceneComponent = React.memo(({ component, ...rest }) => {
|
|
4
|
+
return React.createElement(component, rest);
|
|
5
|
+
});
|
|
6
|
+
SceneComponent.displayName = 'SceneComponent';
|
|
7
|
+
export function SceneMap(scenes) {
|
|
8
|
+
return ({ route, jumpTo }) => {
|
|
9
|
+
const component = scenes[route.key];
|
|
10
|
+
if (!component) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
return (_jsx(SceneComponent, { jumpTo: jumpTo, component: component, route: route }, route.key));
|
|
14
|
+
};
|
|
15
|
+
}
|