@react-navigation/native 7.0.0-alpha.16 → 7.0.0-alpha.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/createStaticNavigation.js +13 -4
- package/lib/commonjs/createStaticNavigation.js.map +1 -1
- package/lib/module/createStaticNavigation.js +13 -4
- package/lib/module/createStaticNavigation.js.map +1 -1
- package/lib/typescript/src/createStaticNavigation.d.ts +9 -1
- package/lib/typescript/src/createStaticNavigation.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +20 -18
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/createStaticNavigation.tsx +42 -7
- package/src/types.tsx +22 -20
|
@@ -19,19 +19,28 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
19
19
|
*/
|
|
20
20
|
function createStaticNavigation(tree) {
|
|
21
21
|
const Component = (0, _core.createComponentForStaticNavigation)(tree, 'RootNavigator');
|
|
22
|
-
const linkingConfig = {
|
|
23
|
-
screens: tree.config.screens ? (0, _core.createPathConfigForStaticNavigation)(tree) : {}
|
|
24
|
-
};
|
|
25
22
|
function Navigation(_ref, ref) {
|
|
26
23
|
let {
|
|
27
24
|
linking,
|
|
28
25
|
...rest
|
|
29
26
|
} = _ref;
|
|
27
|
+
const screens = React.useMemo(() => {
|
|
28
|
+
if (tree.config.screens) {
|
|
29
|
+
return (0, _core.createPathConfigForStaticNavigation)(tree, linking?.config === 'auto');
|
|
30
|
+
}
|
|
31
|
+
return undefined;
|
|
32
|
+
}, [linking?.config]);
|
|
33
|
+
if (linking?.enabled && screens == null) {
|
|
34
|
+
throw new Error('Linking is enabled but no linking configuration was found for the screens.\n\n' + 'To solve this:\n' + "- Specify a 'linking' property for the screens you want to link to.\n" + "- Or set 'linking.config' to 'auto' to generate paths automatically.\n\n" + 'See usage guide: https://reactnavigation.org/docs/7.x/static-configuration#linking');
|
|
35
|
+
}
|
|
30
36
|
return /*#__PURE__*/React.createElement(_NavigationContainer.NavigationContainer, _extends({}, rest, {
|
|
31
37
|
ref: ref,
|
|
32
38
|
linking: linking ? {
|
|
33
39
|
...linking,
|
|
34
|
-
|
|
40
|
+
enabled: typeof linking.enabled === 'boolean' ? linking.enabled : screens != null,
|
|
41
|
+
config: screens ? {
|
|
42
|
+
screens
|
|
43
|
+
} : undefined
|
|
35
44
|
} : undefined
|
|
36
45
|
}), /*#__PURE__*/React.createElement(Component, null));
|
|
37
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_core","require","React","_interopRequireWildcard","_NavigationContainer","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","_extends","assign","bind","target","arguments","length","source","key","apply","createStaticNavigation","tree","Component","createComponentForStaticNavigation","
|
|
1
|
+
{"version":3,"names":["_core","require","React","_interopRequireWildcard","_NavigationContainer","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","_extends","assign","bind","target","arguments","length","source","key","apply","createStaticNavigation","tree","Component","createComponentForStaticNavigation","Navigation","_ref","ref","linking","rest","screens","useMemo","config","createPathConfigForStaticNavigation","undefined","enabled","Error","createElement","NavigationContainer","forwardRef"],"sourceRoot":"../../src","sources":["createStaticNavigation.tsx"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAC,uBAAA,CAAAF,OAAA;AAEA,IAAAG,oBAAA,GAAAH,OAAA;AAA4D,SAAAI,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wB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C;EAE1B;EAEA,oBAAOnC,KAAK,CAACmD,UAAU,CAACd,UAAU,CAAC;AACrC"}
|
|
@@ -11,19 +11,28 @@ import { NavigationContainer } from './NavigationContainer';
|
|
|
11
11
|
*/
|
|
12
12
|
export function createStaticNavigation(tree) {
|
|
13
13
|
const Component = createComponentForStaticNavigation(tree, 'RootNavigator');
|
|
14
|
-
const linkingConfig = {
|
|
15
|
-
screens: tree.config.screens ? createPathConfigForStaticNavigation(tree) : {}
|
|
16
|
-
};
|
|
17
14
|
function Navigation(_ref, ref) {
|
|
18
15
|
let {
|
|
19
16
|
linking,
|
|
20
17
|
...rest
|
|
21
18
|
} = _ref;
|
|
19
|
+
const screens = React.useMemo(() => {
|
|
20
|
+
if (tree.config.screens) {
|
|
21
|
+
return createPathConfigForStaticNavigation(tree, linking?.config === 'auto');
|
|
22
|
+
}
|
|
23
|
+
return undefined;
|
|
24
|
+
}, [linking?.config]);
|
|
25
|
+
if (linking?.enabled && screens == null) {
|
|
26
|
+
throw new Error('Linking is enabled but no linking configuration was found for the screens.\n\n' + 'To solve this:\n' + "- Specify a 'linking' property for the screens you want to link to.\n" + "- Or set 'linking.config' to 'auto' to generate paths automatically.\n\n" + 'See usage guide: https://reactnavigation.org/docs/7.x/static-configuration#linking');
|
|
27
|
+
}
|
|
22
28
|
return /*#__PURE__*/React.createElement(NavigationContainer, _extends({}, rest, {
|
|
23
29
|
ref: ref,
|
|
24
30
|
linking: linking ? {
|
|
25
31
|
...linking,
|
|
26
|
-
|
|
32
|
+
enabled: typeof linking.enabled === 'boolean' ? linking.enabled : screens != null,
|
|
33
|
+
config: screens ? {
|
|
34
|
+
screens
|
|
35
|
+
} : undefined
|
|
27
36
|
} : undefined
|
|
28
37
|
}), /*#__PURE__*/React.createElement(Component, null));
|
|
29
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createComponentForStaticNavigation","createPathConfigForStaticNavigation","React","NavigationContainer","createStaticNavigation","tree","Component","
|
|
1
|
+
{"version":3,"names":["createComponentForStaticNavigation","createPathConfigForStaticNavigation","React","NavigationContainer","createStaticNavigation","tree","Component","Navigation","_ref","ref","linking","rest","screens","useMemo","config","undefined","enabled","Error","createElement","_extends","forwardRef"],"sourceRoot":"../../src","sources":["createStaticNavigation.tsx"],"mappings":";AAAA,SACEA,kCAAkC,EAClCC,mCAAmC,QAI9B,wBAAwB;AAC/B,OAAO,KAAKC,KAAK,MAAM,OAAO;AAE9B,SAASC,mBAAmB,QAAQ,uBAAuB;AAqB3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsBA,CAACC,IAAqC,EAAE;EAC5E,MAAMC,SAAS,GAAGN,kCAAkC,CAACK,IAAI,EAAE,eAAe,CAAC;EAE3E,SAASE,UAAUA,CAAAC,IAAA,EAEjBC,GAAqD,EACrD;IAAA,IAFA;MAAEC,OAAO;MAAE,GAAGC;IAAY,CAAC,GAAAH,IAAA;IAG3B,MAAMI,OAAO,GAAGV,KAAK,CAACW,OAAO,CAAC,MAAM;MAClC,IAAIR,IAAI,CAACS,MAAM,CAACF,OAAO,EAAE;QACvB,OAAOX,mCAAmC,CACxCI,IAAI,EACJK,OAAO,EAAEI,MAAM,KAAK,MACtB,CAAC;MACH;MAEA,OAAOC,SAAS;IAClB,CAAC,EAAE,CAACL,OAAO,EAAEI,MAAM,CAAC,CAAC;IAErB,IAAIJ,OAAO,EAAEM,OAAO,IAAIJ,OAAO,IAAI,IAAI,EAAE;MACvC,MAAM,IAAIK,KAAK,CACb,gFAAgF,GAC9E,kBAAkB,GAClB,uEAAuE,GACvE,0EAA0E,GAC1E,oFACJ,CAAC;IACH;IAEA,oBACEf,KAAA,CAAAgB,aAAA,CAACf,mBAAmB,EAAAgB,QAAA,KACdR,IAAI;MACRF,GAAG,EAAEA,GAAI;MACTC,OAAO,EACLA,OAAO,GACH;QACE,GAAGA,OAAO;QACVM,OAAO,EACL,OAAON,OAAO,CAACM,OAAO,KAAK,SAAS,GAChCN,OAAO,CAACM,OAAO,GACfJ,OAAO,IAAI,IAAI;QACrBE,MAAM,EAAEF,OAAO,GAAG;UAAEA;QAAQ,CAAC,GAAGG;MAClC,CAAC,GACDA;IACL,iBAEDb,KAAA,CAAAgB,aAAA,CAACZ,SAAS,MAAE,CACO,CAAC;EAE1B;EAEA,oBAAOJ,KAAK,CAACkB,UAAU,CAACb,UAAU,CAAC;AACrC"}
|
|
@@ -6,7 +6,15 @@ type Props = Omit<React.ComponentProps<typeof NavigationContainer>, 'linking' |
|
|
|
6
6
|
/**
|
|
7
7
|
* Options for deep linking.
|
|
8
8
|
*/
|
|
9
|
-
linking?: Omit<LinkingOptions<ParamListBase>, 'config'
|
|
9
|
+
linking?: Omit<LinkingOptions<ParamListBase>, 'config'> & {
|
|
10
|
+
/**
|
|
11
|
+
* Configure automatic linking for the screens in the tree.
|
|
12
|
+
* When 'auto' is specified, all leaf screens will automatically have a path.
|
|
13
|
+
* The generated path will be a kebab-case version of the screen name.
|
|
14
|
+
* This can be overridden for specific screens by specifying `linking` for the screen.
|
|
15
|
+
*/
|
|
16
|
+
config?: 'auto';
|
|
17
|
+
};
|
|
10
18
|
};
|
|
11
19
|
/**
|
|
12
20
|
* Create a navigation component from a static navigation config.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createStaticNavigation.d.ts","sourceRoot":"","sources":["../../../src/createStaticNavigation.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,KAAK,KAAK,GAAG,IAAI,CACf,KAAK,CAAC,cAAc,CAAC,OAAO,mBAAmB,CAAC,EAChD,SAAS,GAAG,UAAU,CACvB,GAAG;IACF;;OAEG;IACH,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,EAAE,QAAQ,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"createStaticNavigation.d.ts","sourceRoot":"","sources":["../../../src/createStaticNavigation.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,KAAK,KAAK,GAAG,IAAI,CACf,KAAK,CAAC,cAAc,CAAC,OAAO,mBAAmB,CAAC,EAChD,SAAS,GAAG,UAAU,CACvB,GAAG;IACF;;OAEG;IACH,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,EAAE,QAAQ,CAAC,GAAG;QACxD;;;;;WAKG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;CACH,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,oHAmD3E"}
|
|
@@ -1,31 +1,33 @@
|
|
|
1
1
|
import type { getActionFromState as getActionFromStateDefault, getPathFromState as getPathFromStateDefault, getStateFromPath as getStateFromPathDefault, PathConfigMap, Route } from '@react-navigation/core';
|
|
2
2
|
declare global {
|
|
3
3
|
namespace ReactNavigation {
|
|
4
|
-
interface Theme {
|
|
5
|
-
dark: boolean;
|
|
6
|
-
colors: {
|
|
7
|
-
primary: string;
|
|
8
|
-
background: string;
|
|
9
|
-
card: string;
|
|
10
|
-
text: string;
|
|
11
|
-
border: string;
|
|
12
|
-
notification: string;
|
|
13
|
-
};
|
|
14
|
-
fonts: {
|
|
15
|
-
regular: FontStyle;
|
|
16
|
-
medium: FontStyle;
|
|
17
|
-
bold: FontStyle;
|
|
18
|
-
heavy: FontStyle;
|
|
19
|
-
};
|
|
4
|
+
interface Theme extends NativeTheme {
|
|
20
5
|
}
|
|
21
6
|
}
|
|
22
7
|
}
|
|
23
|
-
export type LocaleDirection = 'ltr' | 'rtl';
|
|
24
8
|
type FontStyle = {
|
|
25
9
|
fontFamily: string;
|
|
26
10
|
fontWeight: 'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
|
|
27
11
|
};
|
|
28
|
-
|
|
12
|
+
interface NativeTheme {
|
|
13
|
+
dark: boolean;
|
|
14
|
+
colors: {
|
|
15
|
+
primary: string;
|
|
16
|
+
background: string;
|
|
17
|
+
card: string;
|
|
18
|
+
text: string;
|
|
19
|
+
border: string;
|
|
20
|
+
notification: string;
|
|
21
|
+
};
|
|
22
|
+
fonts: {
|
|
23
|
+
regular: FontStyle;
|
|
24
|
+
medium: FontStyle;
|
|
25
|
+
bold: FontStyle;
|
|
26
|
+
heavy: FontStyle;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export type Theme = NativeTheme;
|
|
30
|
+
export type LocaleDirection = 'ltr' | 'rtl';
|
|
29
31
|
export type LinkingOptions<ParamList extends {}> = {
|
|
30
32
|
/**
|
|
31
33
|
* Whether deep link handling should be enabled.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,IAAI,yBAAyB,EAC/C,gBAAgB,IAAI,uBAAuB,EAC3C,gBAAgB,IAAI,uBAAuB,EAC3C,aAAa,EACb,KAAK,EACN,MAAM,wBAAwB,CAAC;AAEhC,OAAO,CAAC,MAAM,CAAC;IAEb,UAAU,eAAe,CAAC;QACxB,UAAU,KAAK;
|
|
1
|
+
{"version":3,"file":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
3
3
|
"description": "React Native integration for React Navigation",
|
|
4
|
-
"version": "7.0.0-alpha.
|
|
4
|
+
"version": "7.0.0-alpha.17",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
7
7
|
"react-navigation",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"clean": "del lib"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@react-navigation/core": "^7.0.0-alpha.
|
|
40
|
+
"@react-navigation/core": "^7.0.0-alpha.16",
|
|
41
41
|
"escape-string-regexp": "^4.0.0",
|
|
42
42
|
"fast-deep-equal": "^3.1.3",
|
|
43
43
|
"nanoid": "3.3.7",
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
]
|
|
73
73
|
]
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "d2513d78974a90af443aa05266d31dbfe576e177"
|
|
76
76
|
}
|
|
@@ -17,7 +17,15 @@ type Props = Omit<
|
|
|
17
17
|
/**
|
|
18
18
|
* Options for deep linking.
|
|
19
19
|
*/
|
|
20
|
-
linking?: Omit<LinkingOptions<ParamListBase>, 'config'
|
|
20
|
+
linking?: Omit<LinkingOptions<ParamListBase>, 'config'> & {
|
|
21
|
+
/**
|
|
22
|
+
* Configure automatic linking for the screens in the tree.
|
|
23
|
+
* When 'auto' is specified, all leaf screens will automatically have a path.
|
|
24
|
+
* The generated path will be a kebab-case version of the screen name.
|
|
25
|
+
* This can be overridden for specific screens by specifying `linking` for the screen.
|
|
26
|
+
*/
|
|
27
|
+
config?: 'auto';
|
|
28
|
+
};
|
|
21
29
|
};
|
|
22
30
|
|
|
23
31
|
/**
|
|
@@ -29,21 +37,48 @@ type Props = Omit<
|
|
|
29
37
|
*/
|
|
30
38
|
export function createStaticNavigation(tree: StaticNavigation<any, any, any>) {
|
|
31
39
|
const Component = createComponentForStaticNavigation(tree, 'RootNavigator');
|
|
32
|
-
const linkingConfig = {
|
|
33
|
-
screens: tree.config.screens
|
|
34
|
-
? createPathConfigForStaticNavigation(tree)
|
|
35
|
-
: {},
|
|
36
|
-
};
|
|
37
40
|
|
|
38
41
|
function Navigation(
|
|
39
42
|
{ linking, ...rest }: Props,
|
|
40
43
|
ref: React.Ref<NavigationContainerRef<ParamListBase>>
|
|
41
44
|
) {
|
|
45
|
+
const screens = React.useMemo(() => {
|
|
46
|
+
if (tree.config.screens) {
|
|
47
|
+
return createPathConfigForStaticNavigation(
|
|
48
|
+
tree,
|
|
49
|
+
linking?.config === 'auto'
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return undefined;
|
|
54
|
+
}, [linking?.config]);
|
|
55
|
+
|
|
56
|
+
if (linking?.enabled && screens == null) {
|
|
57
|
+
throw new Error(
|
|
58
|
+
'Linking is enabled but no linking configuration was found for the screens.\n\n' +
|
|
59
|
+
'To solve this:\n' +
|
|
60
|
+
"- Specify a 'linking' property for the screens you want to link to.\n" +
|
|
61
|
+
"- Or set 'linking.config' to 'auto' to generate paths automatically.\n\n" +
|
|
62
|
+
'See usage guide: https://reactnavigation.org/docs/7.x/static-configuration#linking'
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
42
66
|
return (
|
|
43
67
|
<NavigationContainer
|
|
44
68
|
{...rest}
|
|
45
69
|
ref={ref}
|
|
46
|
-
linking={
|
|
70
|
+
linking={
|
|
71
|
+
linking
|
|
72
|
+
? {
|
|
73
|
+
...linking,
|
|
74
|
+
enabled:
|
|
75
|
+
typeof linking.enabled === 'boolean'
|
|
76
|
+
? linking.enabled
|
|
77
|
+
: screens != null,
|
|
78
|
+
config: screens ? { screens } : undefined,
|
|
79
|
+
}
|
|
80
|
+
: undefined
|
|
81
|
+
}
|
|
47
82
|
>
|
|
48
83
|
<Component />
|
|
49
84
|
</NavigationContainer>
|
package/src/types.tsx
CHANGED
|
@@ -9,28 +9,10 @@ import type {
|
|
|
9
9
|
declare global {
|
|
10
10
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
11
11
|
namespace ReactNavigation {
|
|
12
|
-
interface Theme {
|
|
13
|
-
dark: boolean;
|
|
14
|
-
colors: {
|
|
15
|
-
primary: string;
|
|
16
|
-
background: string;
|
|
17
|
-
card: string;
|
|
18
|
-
text: string;
|
|
19
|
-
border: string;
|
|
20
|
-
notification: string;
|
|
21
|
-
};
|
|
22
|
-
fonts: {
|
|
23
|
-
regular: FontStyle;
|
|
24
|
-
medium: FontStyle;
|
|
25
|
-
bold: FontStyle;
|
|
26
|
-
heavy: FontStyle;
|
|
27
|
-
};
|
|
28
|
-
}
|
|
12
|
+
interface Theme extends NativeTheme {}
|
|
29
13
|
}
|
|
30
14
|
}
|
|
31
15
|
|
|
32
|
-
export type LocaleDirection = 'ltr' | 'rtl';
|
|
33
|
-
|
|
34
16
|
type FontStyle = {
|
|
35
17
|
fontFamily: string;
|
|
36
18
|
fontWeight:
|
|
@@ -47,7 +29,27 @@ type FontStyle = {
|
|
|
47
29
|
| '900';
|
|
48
30
|
};
|
|
49
31
|
|
|
50
|
-
|
|
32
|
+
interface NativeTheme {
|
|
33
|
+
dark: boolean;
|
|
34
|
+
colors: {
|
|
35
|
+
primary: string;
|
|
36
|
+
background: string;
|
|
37
|
+
card: string;
|
|
38
|
+
text: string;
|
|
39
|
+
border: string;
|
|
40
|
+
notification: string;
|
|
41
|
+
};
|
|
42
|
+
fonts: {
|
|
43
|
+
regular: FontStyle;
|
|
44
|
+
medium: FontStyle;
|
|
45
|
+
bold: FontStyle;
|
|
46
|
+
heavy: FontStyle;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type Theme = NativeTheme;
|
|
51
|
+
|
|
52
|
+
export type LocaleDirection = 'ltr' | 'rtl';
|
|
51
53
|
|
|
52
54
|
export type LinkingOptions<ParamList extends {}> = {
|
|
53
55
|
/**
|