@sigmela/router 0.0.13 → 0.0.14
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 +5 -7
- package/lib/module/ScreenStackItem.js +6 -12
- package/lib/module/StackRenderer.js +4 -4
- package/lib/module/TabBar/RenderTabBar.js +2 -2
- package/lib/typescript/src/Navigation.d.ts +1 -1
- package/lib/typescript/src/ScreenStackItem.d.ts +1 -3
- package/lib/typescript/src/StackRenderer.d.ts +2 -2
- package/package.json +1 -1
package/lib/module/Navigation.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { ScreenStack, ScreenStackItem as RNNScreenStackItem } from 'react-native-screens';
|
|
4
|
-
import { memo, useCallback, useEffect, useState, useSyncExternalStore } from 'react';
|
|
5
3
|
import { RenderTabBar } from "./TabBar/RenderTabBar.js";
|
|
6
4
|
import { ScreenStackItem } from "./ScreenStackItem.js";
|
|
7
5
|
import { RouterContext } from "./RouterContext.js";
|
|
8
6
|
import { StyleSheet } from 'react-native';
|
|
7
|
+
import { ScreenStackItem as RNNScreenStackItem, ScreenStack } from 'react-native-screens';
|
|
8
|
+
import { useSyncExternalStore, memo, useCallback, useEffect, useState } from 'react';
|
|
9
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
10
|
const EMPTY_HISTORY = [];
|
|
11
11
|
function useStackHistory(router, stackId) {
|
|
@@ -56,13 +56,11 @@ export const Navigation = /*#__PURE__*/memo(({
|
|
|
56
56
|
stackId: rootId,
|
|
57
57
|
item: item,
|
|
58
58
|
stackAnimation: rootTransition,
|
|
59
|
-
|
|
60
|
-
headerAppearance: appearance?.header
|
|
59
|
+
appearance: appearance
|
|
61
60
|
}, item.key)), globalItems.map(item => /*#__PURE__*/_jsx(ScreenStackItem, {
|
|
61
|
+
appearance: appearance,
|
|
62
62
|
stackId: globalId,
|
|
63
|
-
item: item
|
|
64
|
-
screenStyle: appearance?.screenStyle,
|
|
65
|
-
headerAppearance: appearance?.header
|
|
63
|
+
item: item
|
|
66
64
|
}, item.key))]
|
|
67
65
|
})
|
|
68
66
|
});
|
|
@@ -9,7 +9,7 @@ export const ScreenStackItem = /*#__PURE__*/memo(({
|
|
|
9
9
|
item,
|
|
10
10
|
stackId,
|
|
11
11
|
stackAnimation,
|
|
12
|
-
|
|
12
|
+
appearance
|
|
13
13
|
}) => {
|
|
14
14
|
const router = useRouter();
|
|
15
15
|
const onDismissed = () => {
|
|
@@ -32,22 +32,16 @@ export const ScreenStackItem = /*#__PURE__*/memo(({
|
|
|
32
32
|
header,
|
|
33
33
|
...screenProps
|
|
34
34
|
} = item.options || {};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
// } as any;
|
|
40
|
-
// Hide header by default if not specified
|
|
41
|
-
const headerConfig = header ?? {
|
|
42
|
-
hidden: true
|
|
35
|
+
const headerConfig = {
|
|
36
|
+
...header,
|
|
37
|
+
hidden: !header?.title || header?.hidden,
|
|
38
|
+
backgroundColor: appearance?.header?.backgroundColor ?? 'transparent'
|
|
43
39
|
};
|
|
44
|
-
|
|
45
|
-
// console.log('headerConfig', headerAppearance, item.key);
|
|
46
40
|
return /*#__PURE__*/_jsx(RNSScreenStackItem, {
|
|
47
41
|
screenId: item.key,
|
|
48
42
|
onDismissed: onDismissed,
|
|
49
43
|
style: StyleSheet.absoluteFill,
|
|
50
|
-
contentStyle: screenStyle,
|
|
44
|
+
contentStyle: appearance?.screenStyle,
|
|
51
45
|
headerConfig: headerConfig,
|
|
52
46
|
...screenProps,
|
|
53
47
|
stackAnimation: stackAnimation ?? item.options?.stackAnimation,
|
|
@@ -8,7 +8,7 @@ import { StyleSheet } from 'react-native';
|
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
9
|
export const StackRenderer = /*#__PURE__*/memo(({
|
|
10
10
|
stack,
|
|
11
|
-
|
|
11
|
+
appearance
|
|
12
12
|
}) => {
|
|
13
13
|
const router = useRouter();
|
|
14
14
|
const stackId = stack.getId();
|
|
@@ -16,11 +16,11 @@ export const StackRenderer = /*#__PURE__*/memo(({
|
|
|
16
16
|
const get = useCallback(() => router.getStackHistory(stackId), [router, stackId]);
|
|
17
17
|
const historyForThisStack = useSyncExternalStore(subscribe, get, get);
|
|
18
18
|
return /*#__PURE__*/_jsx(ScreenStack, {
|
|
19
|
-
style: styles.flex,
|
|
19
|
+
style: [styles.flex, appearance?.screenStyle],
|
|
20
20
|
children: historyForThisStack.map(item => /*#__PURE__*/_jsx(ScreenStackItem, {
|
|
21
|
-
|
|
21
|
+
appearance: appearance,
|
|
22
22
|
stackId: stackId,
|
|
23
|
-
|
|
23
|
+
item: item
|
|
24
24
|
}, item.key))
|
|
25
25
|
});
|
|
26
26
|
});
|
|
@@ -113,8 +113,8 @@ export const RenderTabBar = /*#__PURE__*/memo(({
|
|
|
113
113
|
isFocused: isFocused,
|
|
114
114
|
...mappedTabProps,
|
|
115
115
|
children: stack ? /*#__PURE__*/_jsx(StackRenderer, {
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
appearance: appearance,
|
|
117
|
+
stack: stack
|
|
118
118
|
}) : Screen ? /*#__PURE__*/_jsx(Screen, {}) : null
|
|
119
119
|
}, tab.tabKey);
|
|
120
120
|
})
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import type { HistoryItem, ScreenOptions, NavigationAppearance } from './types';
|
|
2
|
-
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
3
2
|
interface ScreenStackItemProps {
|
|
4
3
|
item: HistoryItem;
|
|
5
4
|
stackId?: string;
|
|
6
5
|
stackAnimation?: ScreenOptions['stackAnimation'];
|
|
7
|
-
|
|
8
|
-
headerAppearance?: NavigationAppearance['header'];
|
|
6
|
+
appearance?: NavigationAppearance;
|
|
9
7
|
}
|
|
10
8
|
export declare const ScreenStackItem: import("react").NamedExoticComponent<ScreenStackItemProps>;
|
|
11
9
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import type { NavigationAppearance } from './types';
|
|
1
2
|
import { NavigationStack } from './NavigationStack';
|
|
2
|
-
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
3
3
|
export interface StackRendererProps {
|
|
4
4
|
stack: NavigationStack;
|
|
5
|
-
|
|
5
|
+
appearance?: NavigationAppearance;
|
|
6
6
|
}
|
|
7
7
|
export declare const StackRenderer: import("react").NamedExoticComponent<StackRendererProps>;
|
|
8
8
|
//# sourceMappingURL=StackRenderer.d.ts.map
|