@sigmela/router 0.0.14 → 0.0.15
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/module/Navigation.js +10 -16
- package/lib/module/Router.js +299 -52
- package/lib/module/ScreenStack/ScreenStack.native.js +3 -0
- package/lib/module/ScreenStack/ScreenStack.web.js +139 -0
- package/lib/module/ScreenStack/index.js +3 -0
- package/lib/module/{ScreenStackItem.js → ScreenStackItem/ScreenStackItem.js} +2 -2
- package/lib/module/ScreenStackItem/ScreenStackItem.types.js +3 -0
- package/lib/module/ScreenStackItem/ScreenStackItem.web.js +38 -0
- package/lib/module/ScreenStackItem/index.js +3 -0
- package/lib/module/StackRenderer.js +5 -5
- package/lib/module/TabBar/RenderTabBar.native.js +224 -0
- package/lib/module/TabBar/RenderTabBar.web.js +130 -0
- package/lib/module/TabBar/TabIcon.web.js +42 -0
- package/lib/module/TabBar/index.js +3 -0
- package/lib/module/styles.css +139 -0
- package/lib/module/web/TransitionStack.js +227 -0
- package/lib/typescript/src/Navigation.d.ts +2 -1
- package/lib/typescript/src/Router.d.ts +15 -1
- package/lib/typescript/src/ScreenStack/ScreenStack.native.d.ts +2 -0
- package/lib/typescript/src/ScreenStack/ScreenStack.web.d.ts +11 -0
- package/lib/typescript/src/ScreenStack/index.d.ts +2 -0
- package/lib/typescript/src/ScreenStackItem/ScreenStackItem.d.ts +3 -0
- package/lib/typescript/src/ScreenStackItem/ScreenStackItem.types.d.ts +10 -0
- package/lib/typescript/src/ScreenStackItem/ScreenStackItem.web.d.ts +3 -0
- package/lib/typescript/src/ScreenStackItem/index.d.ts +3 -0
- package/lib/typescript/src/TabBar/RenderTabBar.native.d.ts +8 -0
- package/lib/typescript/src/TabBar/{RenderTabBar.d.ts → RenderTabBar.web.d.ts} +1 -1
- package/lib/typescript/src/TabBar/TabBar.d.ts +11 -3
- package/lib/typescript/src/TabBar/TabIcon.web.d.ts +7 -0
- package/lib/typescript/src/TabBar/index.d.ts +2 -0
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/types.d.ts +24 -165
- package/lib/typescript/src/web/TransitionStack.d.ts +21 -0
- package/package.json +3 -2
- package/lib/module/TabBar/RenderTabBar.js +0 -123
- package/lib/typescript/src/ScreenStackItem.d.ts +0 -10
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function whichChild(elem, countNonElements) {
|
|
4
|
+
if (!elem?.parentNode) {
|
|
5
|
+
return -1;
|
|
6
|
+
}
|
|
7
|
+
if (countNonElements) {
|
|
8
|
+
return Array.from(elem.parentNode.childNodes).indexOf(elem);
|
|
9
|
+
}
|
|
10
|
+
let i = 0;
|
|
11
|
+
let current = elem;
|
|
12
|
+
while ((current = current.previousElementSibling) !== null) ++i;
|
|
13
|
+
return i;
|
|
14
|
+
}
|
|
15
|
+
function makeTranslate(x, y) {
|
|
16
|
+
return `translate3d(${x}px, ${y}px, 0)`;
|
|
17
|
+
}
|
|
18
|
+
function makeTransitionFunction(options) {
|
|
19
|
+
return options;
|
|
20
|
+
}
|
|
21
|
+
const slideModal = makeTransitionFunction({
|
|
22
|
+
callback: (tabContent, prevTabContent, toRight) => {
|
|
23
|
+
const height = prevTabContent.getBoundingClientRect().height;
|
|
24
|
+
const elements = [tabContent, prevTabContent];
|
|
25
|
+
if (toRight) elements.reverse();
|
|
26
|
+
elements[0].style.filter = `brightness(80%)`;
|
|
27
|
+
elements[1].style.transform = makeTranslate(0, height);
|
|
28
|
+
tabContent.classList.add('active');
|
|
29
|
+
// eslint-disable-next-line no-void
|
|
30
|
+
void tabContent.offsetHeight; // reflow
|
|
31
|
+
|
|
32
|
+
tabContent.style.transform = '';
|
|
33
|
+
tabContent.style.filter = '';
|
|
34
|
+
return () => {
|
|
35
|
+
prevTabContent.style.transform = prevTabContent.style.filter = '';
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
animateFirst: false
|
|
39
|
+
});
|
|
40
|
+
const slideNavigation = makeTransitionFunction({
|
|
41
|
+
callback: (tabContent, prevTabContent, toRight) => {
|
|
42
|
+
const width = prevTabContent.getBoundingClientRect().width;
|
|
43
|
+
const elements = [tabContent, prevTabContent];
|
|
44
|
+
if (toRight) elements.reverse();
|
|
45
|
+
elements[0].style.filter = `brightness(80%)`;
|
|
46
|
+
elements[0].style.transform = makeTranslate(-width * 0.25, 0);
|
|
47
|
+
elements[1].style.transform = makeTranslate(width, 0);
|
|
48
|
+
tabContent.classList.add('active');
|
|
49
|
+
// eslint-disable-next-line no-void
|
|
50
|
+
void tabContent.offsetWidth; // reflow
|
|
51
|
+
|
|
52
|
+
tabContent.style.transform = '';
|
|
53
|
+
tabContent.style.filter = '';
|
|
54
|
+
return () => {
|
|
55
|
+
prevTabContent.style.transform = prevTabContent.style.filter = '';
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
animateFirst: false
|
|
59
|
+
});
|
|
60
|
+
const transitions = {
|
|
61
|
+
navigation: slideNavigation,
|
|
62
|
+
modal: slideModal
|
|
63
|
+
};
|
|
64
|
+
const TransitionStack = options => {
|
|
65
|
+
let {
|
|
66
|
+
animateFirst = false
|
|
67
|
+
} = options;
|
|
68
|
+
const {
|
|
69
|
+
type: t,
|
|
70
|
+
content,
|
|
71
|
+
withAnimationListener = true,
|
|
72
|
+
transitionTime,
|
|
73
|
+
onTransitionEnd,
|
|
74
|
+
onTransitionStart,
|
|
75
|
+
onTransitionStartAfter,
|
|
76
|
+
once = false
|
|
77
|
+
} = options;
|
|
78
|
+
const type = t;
|
|
79
|
+
|
|
80
|
+
// Set initial animation type on container; will be overridden per transition based on target's data-presentation
|
|
81
|
+
content.dataset.animation = type;
|
|
82
|
+
const onTransitionEndCallbacks = new Map();
|
|
83
|
+
let from = null;
|
|
84
|
+
if (withAnimationListener) {
|
|
85
|
+
const listenerName = 'transitionend';
|
|
86
|
+
const onEndEvent = e => {
|
|
87
|
+
// @ts-expect-error - e is TransitionEvent | AnimationEvent
|
|
88
|
+
e = e.originalEvent || e;
|
|
89
|
+
try {
|
|
90
|
+
if (e.stopPropagation) e.stopPropagation();
|
|
91
|
+
if (e.preventDefault) e.preventDefault();
|
|
92
|
+
e.returnValue = false;
|
|
93
|
+
e.cancelBubble = true;
|
|
94
|
+
} catch {
|
|
95
|
+
/* empty */
|
|
96
|
+
}
|
|
97
|
+
if (e.target.parentElement !== content) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const callback = onTransitionEndCallbacks.get(e.target);
|
|
101
|
+
callback?.();
|
|
102
|
+
if (e.target !== from) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
onTransitionEnd?.(transition.prevId());
|
|
106
|
+
content.classList.remove('animating', 'backwards', 'disable-hover');
|
|
107
|
+
if (once) {
|
|
108
|
+
content.removeEventListener(listenerName, onEndEvent);
|
|
109
|
+
from = undefined;
|
|
110
|
+
onTransitionEndCallbacks.clear();
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
content.addEventListener(listenerName, onEndEvent);
|
|
114
|
+
}
|
|
115
|
+
function transition(id, animate = true, overrideFrom) {
|
|
116
|
+
if (overrideFrom) {
|
|
117
|
+
from = overrideFrom;
|
|
118
|
+
}
|
|
119
|
+
const targetIndex = id instanceof HTMLElement ? whichChild(id) : id;
|
|
120
|
+
const prevId = transition.prevId();
|
|
121
|
+
if (targetIndex === prevId) return;
|
|
122
|
+
onTransitionStart?.(targetIndex);
|
|
123
|
+
const to = content.children[targetIndex];
|
|
124
|
+
|
|
125
|
+
// Determine direction and pick animation source
|
|
126
|
+
const goingBack = prevId > targetIndex;
|
|
127
|
+
const sourcePresentation = from?.dataset.presentation || '';
|
|
128
|
+
const targetPresentation = to?.dataset.presentation || '';
|
|
129
|
+
const chosenPresentation = goingBack ? sourcePresentation : targetPresentation;
|
|
130
|
+
const effectiveType = chosenPresentation === 'modal' ? 'modal' : 'navigation';
|
|
131
|
+
|
|
132
|
+
// Update container dataset to drive CSS timing variants
|
|
133
|
+
content.dataset.animation = effectiveType;
|
|
134
|
+
const transitionSpec = transitions[effectiveType];
|
|
135
|
+
const animationFunction = transitionSpec?.callback;
|
|
136
|
+
const animateFirstLocal = (transitionSpec?.animateFirst !== undefined ? transitionSpec?.animateFirst : animateFirst) ?? false;
|
|
137
|
+
if (prevId === -1 && !animateFirstLocal) {
|
|
138
|
+
animate = false;
|
|
139
|
+
}
|
|
140
|
+
if (!withAnimationListener) {
|
|
141
|
+
const timeout = content.dataset.timeout;
|
|
142
|
+
if (timeout !== undefined) {
|
|
143
|
+
clearTimeout(+timeout);
|
|
144
|
+
}
|
|
145
|
+
delete content.dataset.timeout;
|
|
146
|
+
}
|
|
147
|
+
if (!animate) {
|
|
148
|
+
if (from) from.classList.remove('active', 'to', 'from');else if (to) {
|
|
149
|
+
const callback = onTransitionEndCallbacks.get(to);
|
|
150
|
+
callback?.();
|
|
151
|
+
}
|
|
152
|
+
if (to) {
|
|
153
|
+
to.classList.remove('to', 'from');
|
|
154
|
+
to.classList.add('active');
|
|
155
|
+
}
|
|
156
|
+
content.classList.remove('animating', 'backwards', 'disable-hover');
|
|
157
|
+
from = to;
|
|
158
|
+
onTransitionEnd?.(targetIndex);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
if (!withAnimationListener) {
|
|
162
|
+
content.dataset.timeout = '' + window.setTimeout(() => {
|
|
163
|
+
to?.classList.remove('to');
|
|
164
|
+
from?.classList.remove('from');
|
|
165
|
+
content.classList.remove('animating', 'backwards', 'disable-hover');
|
|
166
|
+
delete content.dataset.timeout;
|
|
167
|
+
}, transitionTime);
|
|
168
|
+
}
|
|
169
|
+
if (from) {
|
|
170
|
+
from.classList.remove('to');
|
|
171
|
+
from.classList.add('from');
|
|
172
|
+
}
|
|
173
|
+
content.classList.add('animating');
|
|
174
|
+
const toRight = prevId < targetIndex;
|
|
175
|
+
content.classList.toggle('backwards', !toRight);
|
|
176
|
+
let onTransitionEndCallback;
|
|
177
|
+
if (!to) {
|
|
178
|
+
// prevTabContent.classList.remove('active');
|
|
179
|
+
} else {
|
|
180
|
+
if (animationFunction) {
|
|
181
|
+
onTransitionEndCallback = animationFunction(to, from, toRight);
|
|
182
|
+
} else {
|
|
183
|
+
to.classList.add('active');
|
|
184
|
+
}
|
|
185
|
+
onTransitionStartAfter?.(targetIndex);
|
|
186
|
+
to.classList.remove('from');
|
|
187
|
+
to.classList.add('to');
|
|
188
|
+
}
|
|
189
|
+
if (to) {
|
|
190
|
+
const transitionTimeout = to.dataset.transitionTimeout;
|
|
191
|
+
if (transitionTimeout) {
|
|
192
|
+
clearTimeout(+transitionTimeout);
|
|
193
|
+
}
|
|
194
|
+
onTransitionEndCallbacks.set(to, () => {
|
|
195
|
+
to.classList.remove('to');
|
|
196
|
+
onTransitionEndCallbacks.delete(to);
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
if (from) {
|
|
200
|
+
let timeout;
|
|
201
|
+
const _from = from;
|
|
202
|
+
const callback = () => {
|
|
203
|
+
clearTimeout(timeout);
|
|
204
|
+
_from.classList.remove('active', 'from');
|
|
205
|
+
onTransitionEndCallback?.();
|
|
206
|
+
onTransitionEndCallbacks.delete(_from);
|
|
207
|
+
};
|
|
208
|
+
if (to) {
|
|
209
|
+
timeout = window.setTimeout(callback, transitionTime + 100);
|
|
210
|
+
onTransitionEndCallbacks.set(_from, callback);
|
|
211
|
+
} else {
|
|
212
|
+
timeout = window.setTimeout(callback, transitionTime + 100);
|
|
213
|
+
onTransitionEndCallbacks.set(_from, () => {
|
|
214
|
+
clearTimeout(timeout);
|
|
215
|
+
onTransitionEndCallbacks.delete(_from);
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
_from.dataset.transitionTimeout = '' + timeout;
|
|
219
|
+
}
|
|
220
|
+
from = to;
|
|
221
|
+
}
|
|
222
|
+
transition.prevId = () => from ? whichChild(from) : -1;
|
|
223
|
+
transition.getFrom = () => from;
|
|
224
|
+
transition.setFrom = _from => from = _from;
|
|
225
|
+
return transition;
|
|
226
|
+
};
|
|
227
|
+
export default TransitionStack;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { NavigationAppearance } from './types';
|
|
2
2
|
import { Router } from './Router';
|
|
3
|
-
|
|
3
|
+
interface NavigationProps {
|
|
4
4
|
router: Router;
|
|
5
5
|
appearance?: NavigationAppearance;
|
|
6
6
|
}
|
|
7
7
|
export declare const Navigation: import("react").NamedExoticComponent<NavigationProps>;
|
|
8
|
+
export {};
|
|
8
9
|
//# sourceMappingURL=Navigation.d.ts.map
|
|
@@ -30,7 +30,7 @@ export declare class Router {
|
|
|
30
30
|
private rootTransition?;
|
|
31
31
|
constructor(config: RouterConfig);
|
|
32
32
|
navigate: (path: string) => void;
|
|
33
|
-
replace: (path: string) => void;
|
|
33
|
+
replace: (path: string, dedupe?: boolean) => void;
|
|
34
34
|
goBack: () => void;
|
|
35
35
|
onTabIndexChange: (index: number) => void;
|
|
36
36
|
setActiveTabIndex: (index: number) => void;
|
|
@@ -65,6 +65,20 @@ export declare class Router {
|
|
|
65
65
|
private getTopForTarget;
|
|
66
66
|
private mergeOptions;
|
|
67
67
|
private findStackById;
|
|
68
|
+
private isWebEnv;
|
|
69
|
+
private getCurrentUrl;
|
|
70
|
+
private readIndex;
|
|
71
|
+
private getHistoryIndex;
|
|
72
|
+
private ensureHistoryIndex;
|
|
73
|
+
private pushUrl;
|
|
74
|
+
private replaceUrl;
|
|
75
|
+
private patchHistoryOnce;
|
|
76
|
+
private lastBrowserIndex;
|
|
77
|
+
private pendingReplaceDedupe;
|
|
78
|
+
private setupBrowserHistory;
|
|
79
|
+
private popOnce;
|
|
80
|
+
private tryPopActiveStack;
|
|
81
|
+
private parse;
|
|
68
82
|
}
|
|
69
83
|
export {};
|
|
70
84
|
//# sourceMappingURL=Router.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { type TransitionStackType } from '../web/TransitionStack';
|
|
3
|
+
type ScreenStackProps = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
transitionTime?: number;
|
|
6
|
+
type?: TransitionStackType;
|
|
7
|
+
animated?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const ScreenStack: import("react").NamedExoticComponent<ScreenStackProps>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=ScreenStack.web.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { HistoryItem, NavigationAppearance, ScreenOptions } from '../types';
|
|
2
|
+
export type ScreenStackItemPhase = 'active' | 'exiting';
|
|
3
|
+
export interface ScreenStackItemProps {
|
|
4
|
+
item: HistoryItem;
|
|
5
|
+
stackId?: string;
|
|
6
|
+
stackAnimation?: ScreenOptions['stackAnimation'];
|
|
7
|
+
appearance?: NavigationAppearance;
|
|
8
|
+
phase?: ScreenStackItemPhase;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=ScreenStackItem.types.d.ts.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ScreenStackItemProps } from './ScreenStackItem.types';
|
|
2
|
+
export declare const ScreenStackItem: import("react").MemoExoticComponent<({ phase, item, appearance }: ScreenStackItemProps) => import("react/jsx-runtime").JSX.Element>;
|
|
3
|
+
//# sourceMappingURL=ScreenStackItem.web.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TabBar } from './TabBar';
|
|
2
|
+
import type { NavigationAppearance } from '../types';
|
|
3
|
+
export interface RenderTabBarProps {
|
|
4
|
+
tabBar: TabBar;
|
|
5
|
+
appearance?: NavigationAppearance;
|
|
6
|
+
}
|
|
7
|
+
export declare const RenderTabBar: import("react").NamedExoticComponent<RenderTabBarProps>;
|
|
8
|
+
//# sourceMappingURL=RenderTabBar.native.d.ts.map
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { ImageSourcePropType } from 'react-native';
|
|
2
2
|
import { NavigationStack } from '../NavigationStack';
|
|
3
|
+
import type { ComponentType } from 'react';
|
|
3
4
|
import type { TabItem } from '../types';
|
|
4
|
-
import
|
|
5
|
+
import React from 'react';
|
|
5
6
|
type IOSIconShape = {
|
|
6
7
|
sfSymbolName: string;
|
|
7
8
|
} | {
|
|
@@ -10,13 +11,20 @@ type IOSIconShape = {
|
|
|
10
11
|
templateSource: ImageSourcePropType;
|
|
11
12
|
};
|
|
12
13
|
type ExtendedIcon = ImageSourcePropType | IOSIconShape;
|
|
13
|
-
type InternalTabItem = Omit<TabItem, 'icon' | 'selectedIcon'> & {
|
|
14
|
+
export type InternalTabItem = Omit<TabItem, 'icon' | 'selectedIcon'> & {
|
|
14
15
|
icon?: ExtendedIcon;
|
|
15
16
|
selectedIcon?: ExtendedIcon;
|
|
17
|
+
badgeValue?: string;
|
|
18
|
+
};
|
|
19
|
+
export type TabBarProps = {
|
|
20
|
+
onTabPress: (index: number) => void;
|
|
21
|
+
tabs: InternalTabItem[];
|
|
22
|
+
activeIndex: number;
|
|
16
23
|
};
|
|
17
24
|
type TabBarConfig = Omit<InternalTabItem, 'tabKey' | 'key'> & {
|
|
18
25
|
stack?: NavigationStack;
|
|
19
26
|
screen?: React.ComponentType<any>;
|
|
27
|
+
component?: ComponentType<TabBarProps>;
|
|
20
28
|
};
|
|
21
29
|
export declare class TabBar {
|
|
22
30
|
screens: Record<string, React.ComponentType<any>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ImageSourcePropType } from 'react-native';
|
|
2
|
+
export interface TabIconProps {
|
|
3
|
+
source: ImageSourcePropType;
|
|
4
|
+
tintColor?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const TabIcon: import("react").MemoExoticComponent<({ source, tintColor }: TabIconProps) => import("react/jsx-runtime").JSX.Element>;
|
|
7
|
+
//# sourceMappingURL=TabIcon.web.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { useTabBar } from './TabBar/useTabBar';
|
|
2
2
|
export { TabBar } from './TabBar/TabBar';
|
|
3
|
-
export type {
|
|
3
|
+
export type { TabBarProps } from './TabBar/TabBar';
|
|
4
4
|
export type { NavigationAppearance } from './types';
|
|
5
5
|
/**
|
|
6
6
|
* Navigation System
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import type { ColorValue, StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
2
|
-
import type {
|
|
2
|
+
import type { BottomTabsScreenProps, ScreenProps as RNSScreenProps, ScreenStackHeaderConfigProps, TabBarItemLabelVisibilityMode, TabBarMinimizeBehavior } from 'react-native-screens';
|
|
3
3
|
export type TabItem = Omit<BottomTabsScreenProps, 'isFocused' | 'children'>;
|
|
4
4
|
export type NavigationState<Route extends TabItem> = {
|
|
5
5
|
index: number;
|
|
6
6
|
routes: Route[];
|
|
7
7
|
};
|
|
8
8
|
export type Scope = 'global' | 'tab' | 'root';
|
|
9
|
+
export type TabBarIcon = {
|
|
10
|
+
sfSymbolName?: string;
|
|
11
|
+
} | string;
|
|
9
12
|
export type ScreenOptions = Partial<RNSScreenProps> & {
|
|
10
13
|
header?: ScreenStackHeaderConfigProps;
|
|
14
|
+
/**
|
|
15
|
+
* Tab bar icon source for this route (used on web renderer, optional on native).
|
|
16
|
+
*/
|
|
17
|
+
tabBarIcon?: TabBarIcon;
|
|
11
18
|
};
|
|
12
19
|
export type HistoryItem = {
|
|
13
20
|
key: string;
|
|
@@ -72,173 +79,25 @@ export type TabBarConfig = {
|
|
|
72
79
|
};
|
|
73
80
|
export interface NavigationAppearance {
|
|
74
81
|
tabBar?: {
|
|
75
|
-
/**
|
|
76
|
-
* @summary Specifies the standard tab bar appearance.
|
|
77
|
-
*
|
|
78
|
-
* Allows to customize the appearance depending on the tab bar item layout (stacked,
|
|
79
|
-
* inline, compact inline) and state (normal, selected, focused, disabled).
|
|
80
|
-
*
|
|
81
|
-
* @platform ios
|
|
82
|
-
*/
|
|
83
|
-
standardAppearance?: BottomTabsScreenAppearance;
|
|
84
|
-
/**
|
|
85
|
-
* @summary Specifies the tab bar appearace when edge of scrollable content aligns
|
|
86
|
-
* with the edge of the tab bar.
|
|
87
|
-
*
|
|
88
|
-
* Allows to customize the appearance depending on the tab bar item layout (stacked,
|
|
89
|
-
* inline, compact inline) and state (normal, selected, focused, disabled).
|
|
90
|
-
*
|
|
91
|
-
* If this property is `undefined`, UIKit uses `standardAppearance`, modified to
|
|
92
|
-
* have a transparent background.
|
|
93
|
-
*
|
|
94
|
-
* @platform ios
|
|
95
|
-
*/
|
|
96
|
-
scrollEdgeAppearance?: BottomTabsScreenAppearance;
|
|
97
|
-
/**
|
|
98
|
-
* @summary Specifies the background color for the entire tab bar.
|
|
99
|
-
*
|
|
100
|
-
* @platform android
|
|
101
|
-
*/
|
|
102
82
|
backgroundColor?: ColorValue;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* @summary Specifies the font size used for the title of each tab bar item in active state.
|
|
120
|
-
*
|
|
121
|
-
* The size is represented in scale-independent pixels (sp).
|
|
122
|
-
*
|
|
123
|
-
* @platform android
|
|
124
|
-
*/
|
|
125
|
-
titleFontSizeActive?: TextStyle['fontSize'];
|
|
126
|
-
/**
|
|
127
|
-
* @summary Specifies the font weight used for the title of each tab bar item.
|
|
128
|
-
*
|
|
129
|
-
* @platform android
|
|
130
|
-
*/
|
|
131
|
-
titleFontWeight?: TextStyle['fontWeight'];
|
|
132
|
-
/**
|
|
133
|
-
* @summary Specifies the font style used for the title of each tab bar item.
|
|
134
|
-
*
|
|
135
|
-
* @platform android
|
|
136
|
-
*/
|
|
137
|
-
titleFontStyle?: TextStyle['fontStyle'];
|
|
138
|
-
/**
|
|
139
|
-
* @summary Specifies the font color used for the title of each tab bar item.
|
|
140
|
-
*
|
|
141
|
-
* @platform android
|
|
142
|
-
*/
|
|
143
|
-
titleFontColor?: TextStyle['color'];
|
|
144
|
-
/**
|
|
145
|
-
* @summary Specifies the font color used for the title of each tab bar item in active state.
|
|
146
|
-
*
|
|
147
|
-
* If not provided, `tabBarItemTitleFontColor` is used.
|
|
148
|
-
*
|
|
149
|
-
* @platform android
|
|
150
|
-
*/
|
|
151
|
-
titleFontColorActive?: TextStyle['color'];
|
|
152
|
-
/**
|
|
153
|
-
* @summary Specifies the icon color for each tab bar item.
|
|
154
|
-
*
|
|
155
|
-
* @platform android
|
|
156
|
-
*/
|
|
157
|
-
iconColor?: ColorValue;
|
|
158
|
-
/**
|
|
159
|
-
* @summary Specifies the icon color for each tab bar item in active state.
|
|
160
|
-
*
|
|
161
|
-
* If not provided, `tabBarItemIconColor` is used.
|
|
162
|
-
*
|
|
163
|
-
* @platform android
|
|
164
|
-
*/
|
|
165
|
-
iconColorActive?: ColorValue;
|
|
166
|
-
/**
|
|
167
|
-
* @summary Specifies the background color of the active indicator.
|
|
168
|
-
*
|
|
169
|
-
* @platform android
|
|
170
|
-
*/
|
|
171
|
-
activeIndicatorColor?: ColorValue;
|
|
172
|
-
/**
|
|
173
|
-
* @summary Specifies if the active indicator should be used.
|
|
174
|
-
*
|
|
175
|
-
* @default true
|
|
176
|
-
*
|
|
177
|
-
* @platform android
|
|
178
|
-
*/
|
|
179
|
-
activeIndicatorEnabled?: boolean;
|
|
180
|
-
/**
|
|
181
|
-
* @summary Specifies the color of each tab bar item's ripple effect.
|
|
182
|
-
*
|
|
183
|
-
* @platform android
|
|
184
|
-
*/
|
|
185
|
-
rippleColor?: ColorValue;
|
|
186
|
-
/**
|
|
187
|
-
* @summary Specifies the label visibility mode.
|
|
188
|
-
*
|
|
189
|
-
* The label visibility mode defines when the labels of each item bar should be displayed.
|
|
190
|
-
*
|
|
191
|
-
* The following values are available:
|
|
192
|
-
* - `auto` - the label behaves as in “labeled” mode when there are 3 items or less, or as in “selected” mode when there are 4 items or more
|
|
193
|
-
* - `selected` - the label is only shown on the selected navigation item
|
|
194
|
-
* - `labeled` - the label is shown on all navigation items
|
|
195
|
-
* - `unlabeled` - the label is hidden for all navigation items
|
|
196
|
-
*
|
|
197
|
-
* The supported values correspond to the official Material Components documentation:
|
|
198
|
-
* @see {@link https://github.com/material-components/material-components-android/blob/master/docs/components/BottomNavigation.md#making-navigation-bar-accessible|Material Components documentation}
|
|
199
|
-
*
|
|
200
|
-
* @default auto
|
|
201
|
-
* @platform android
|
|
202
|
-
*/
|
|
203
|
-
labelVisibilityMode?: TabBarItemLabelVisibilityMode;
|
|
83
|
+
badgeBackgroundColor?: ColorValue;
|
|
84
|
+
iconColor?: ColorValue;
|
|
85
|
+
iconColorActive?: ColorValue;
|
|
86
|
+
androidActiveIndicatorEnabled?: boolean;
|
|
87
|
+
androidActiveIndicatorColor?: ColorValue;
|
|
88
|
+
androidRippleColor?: ColorValue;
|
|
89
|
+
labelVisibilityMode?: TabBarItemLabelVisibilityMode;
|
|
90
|
+
iOSShadowColor?: ColorValue;
|
|
91
|
+
title: {
|
|
92
|
+
fontFamily?: TextStyle['fontFamily'];
|
|
93
|
+
fontSize?: TextStyle['fontSize'];
|
|
94
|
+
fontWeight?: TextStyle['fontWeight'];
|
|
95
|
+
fontStyle?: TextStyle['fontStyle'];
|
|
96
|
+
color?: TextStyle['color'];
|
|
97
|
+
activeColor?: TextStyle['color'];
|
|
204
98
|
};
|
|
205
|
-
/**
|
|
206
|
-
* @summary Specifies the color used for selected tab's text and icon color.
|
|
207
|
-
*
|
|
208
|
-
* Starting from iOS 26, it also impacts glow of Liquid Glass tab
|
|
209
|
-
* selection view.
|
|
210
|
-
*
|
|
211
|
-
* `tabBarItemTitleFontColor` and `tabBarItemIconColor` defined on
|
|
212
|
-
* BottomTabsScreen component override this color.
|
|
213
|
-
*
|
|
214
|
-
* @platform ios
|
|
215
|
-
*/
|
|
216
|
-
tintColor?: ColorValue;
|
|
217
|
-
/**
|
|
218
|
-
* @summary Experimental prop for changing container control.
|
|
219
|
-
*
|
|
220
|
-
* If set to true, tab screen changes need to be handled by JS using
|
|
221
|
-
* onNativeFocusChange callback (controlled/programatically-driven).
|
|
222
|
-
*
|
|
223
|
-
* If set to false, tab screen change will not be prevented by the
|
|
224
|
-
* native side (managed/natively-driven).
|
|
225
|
-
*
|
|
226
|
-
* On iOS, some features are not fully implemented for managed tabs
|
|
227
|
-
* (e.g. overrideScrollViewContentInsetAdjustmentBehavior).
|
|
228
|
-
*
|
|
229
|
-
* On Android, only controlled tabs are currently supported.
|
|
230
|
-
*
|
|
231
|
-
* @default Defaults to `false`.
|
|
232
|
-
*
|
|
233
|
-
* @platform android, ios
|
|
234
|
-
*/
|
|
235
|
-
experimentalControlNavigationStateInJS?: boolean;
|
|
236
99
|
};
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
* Global header appearance applied to all screens with visible headers.
|
|
240
|
-
* Per-screen header options override these.
|
|
241
|
-
*/
|
|
100
|
+
screen?: StyleProp<ViewStyle>;
|
|
242
101
|
header?: ScreenStackHeaderConfigProps;
|
|
243
102
|
}
|
|
244
103
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type TransitionStackType = 'modal' | 'navigation';
|
|
2
|
+
export type TransitionStackOptions = {
|
|
3
|
+
content: HTMLElement;
|
|
4
|
+
type: TransitionStackType;
|
|
5
|
+
transitionTime: number;
|
|
6
|
+
onTransitionStart?: (id: number) => void;
|
|
7
|
+
onTransitionStartAfter?: (id: number) => void;
|
|
8
|
+
onTransitionEnd?: (id: number) => void;
|
|
9
|
+
isHeavy?: boolean;
|
|
10
|
+
once?: boolean;
|
|
11
|
+
withAnimationListener?: boolean;
|
|
12
|
+
animateFirst?: boolean;
|
|
13
|
+
};
|
|
14
|
+
declare const TransitionStack: (options: TransitionStackOptions) => {
|
|
15
|
+
(id: number | HTMLElement, animate?: boolean, overrideFrom?: HTMLElement | null | undefined): void;
|
|
16
|
+
prevId(): number;
|
|
17
|
+
getFrom(): HTMLElement | null | undefined;
|
|
18
|
+
setFrom(_from: HTMLElement): HTMLElement;
|
|
19
|
+
};
|
|
20
|
+
export default TransitionStack;
|
|
21
|
+
//# sourceMappingURL=TransitionStack.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sigmela/router",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"description": "React Native Router",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"types": "./lib/typescript/src/index.d.ts",
|
|
11
11
|
"default": "./lib/module/index.js"
|
|
12
12
|
},
|
|
13
|
-
"./package.json": "./package.json"
|
|
13
|
+
"./package.json": "./package.json",
|
|
14
|
+
"./styles.css": "./src/styles.css"
|
|
14
15
|
},
|
|
15
16
|
"files": [
|
|
16
17
|
"lib",
|