@granite-js/react-native 1.0.26 → 1.0.28
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/CHANGELOG.md +31 -0
- package/dist/app/Granite.d.ts +1 -1
- package/dist/constant-bridges.d.mts +0 -22
- package/dist/constant-bridges.js +5 -1
- package/dist/constant-bridges.mjs +5 -1
- package/dist/native-modules/natives/getSchemeUri.d.ts +0 -22
- package/dist/router/createRoute.d.ts +4 -1
- package/package.json +11 -11
- package/src/app/Granite.tsx +5 -3
- package/src/native-modules/natives/getSchemeUri.ts +8 -25
- package/src/router/createRoute.ts +8 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @granite-js/react-native
|
|
2
2
|
|
|
3
|
+
## 1.0.28
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 494c13e: feat: schemeUri to `getSchemeUri`
|
|
8
|
+
- Updated dependencies [494c13e]
|
|
9
|
+
- @granite-js/brownfield-module@1.0.28
|
|
10
|
+
- @granite-js/native@1.0.28
|
|
11
|
+
- @granite-js/blur-view@1.0.28
|
|
12
|
+
- @granite-js/jest@1.0.28
|
|
13
|
+
- @granite-js/style-utils@1.0.28
|
|
14
|
+
- @granite-js/cli@1.0.28
|
|
15
|
+
- @granite-js/mpack@1.0.28
|
|
16
|
+
- @granite-js/plugin-core@1.0.28
|
|
17
|
+
- @granite-js/video@1.0.28
|
|
18
|
+
|
|
19
|
+
## 1.0.27
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [101b006]
|
|
24
|
+
- @granite-js/blur-view@1.0.27
|
|
25
|
+
- @granite-js/brownfield-module@1.0.27
|
|
26
|
+
- @granite-js/cli@1.0.27
|
|
27
|
+
- @granite-js/jest@1.0.27
|
|
28
|
+
- @granite-js/mpack@1.0.27
|
|
29
|
+
- @granite-js/native@1.0.27
|
|
30
|
+
- @granite-js/plugin-core@1.0.27
|
|
31
|
+
- @granite-js/style-utils@1.0.27
|
|
32
|
+
- @granite-js/video@1.0.27
|
|
33
|
+
|
|
3
34
|
## 1.0.26
|
|
4
35
|
|
|
5
36
|
### Patch Changes
|
package/dist/app/Granite.d.ts
CHANGED
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @public
|
|
3
|
-
* @name getSchemeUri
|
|
4
|
-
* @category Environment Check
|
|
5
|
-
* @kind function
|
|
6
|
-
* @description Returns the scheme value when first entering the screen. URI changes due to page navigation are not reflected.
|
|
7
|
-
* @returns {string} Returns the scheme value when first entering the screen.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ### Get initial scheme value
|
|
11
|
-
*
|
|
12
|
-
* ```tsx
|
|
13
|
-
* import { getSchemeUri } from '@granite-js/react-native';
|
|
14
|
-
* import { Text } from 'react-native';
|
|
15
|
-
*
|
|
16
|
-
* function MyPage() {
|
|
17
|
-
* const schemeUri = getSchemeUri();
|
|
18
|
-
*
|
|
19
|
-
* return <Text>Initial scheme value: {schemeUri}</Text>
|
|
20
|
-
* }
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
1
|
declare function getSchemeUri(): string;
|
|
24
2
|
|
|
25
3
|
export { getSchemeUri };
|
package/dist/constant-bridges.js
CHANGED
|
@@ -27,7 +27,11 @@ module.exports = __toCommonJS(constant_bridges_exports);
|
|
|
27
27
|
// src/native-modules/natives/getSchemeUri.ts
|
|
28
28
|
var import_brownfield_module = require("@granite-js/brownfield-module");
|
|
29
29
|
function getSchemeUri() {
|
|
30
|
-
|
|
30
|
+
try {
|
|
31
|
+
return import_brownfield_module.GraniteBrownfieldModule.getSchemeUri();
|
|
32
|
+
} catch {
|
|
33
|
+
return import_brownfield_module.GraniteBrownfieldModule.getConstants().schemeUri;
|
|
34
|
+
}
|
|
31
35
|
}
|
|
32
36
|
// Annotate the CommonJS export names for ESM import in node:
|
|
33
37
|
0 && (module.exports = {
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
// src/native-modules/natives/getSchemeUri.ts
|
|
2
2
|
import { GraniteBrownfieldModule } from "@granite-js/brownfield-module";
|
|
3
3
|
function getSchemeUri() {
|
|
4
|
-
|
|
4
|
+
try {
|
|
5
|
+
return GraniteBrownfieldModule.getSchemeUri();
|
|
6
|
+
} catch {
|
|
7
|
+
return GraniteBrownfieldModule.getConstants().schemeUri;
|
|
8
|
+
}
|
|
5
9
|
}
|
|
6
10
|
export {
|
|
7
11
|
getSchemeUri
|
|
@@ -1,23 +1 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @public
|
|
3
|
-
* @name getSchemeUri
|
|
4
|
-
* @category Environment Check
|
|
5
|
-
* @kind function
|
|
6
|
-
* @description Returns the scheme value when first entering the screen. URI changes due to page navigation are not reflected.
|
|
7
|
-
* @returns {string} Returns the scheme value when first entering the screen.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ### Get initial scheme value
|
|
11
|
-
*
|
|
12
|
-
* ```tsx
|
|
13
|
-
* import { getSchemeUri } from '@granite-js/react-native';
|
|
14
|
-
* import { Text } from 'react-native';
|
|
15
|
-
*
|
|
16
|
-
* function MyPage() {
|
|
17
|
-
* const schemeUri = getSchemeUri();
|
|
18
|
-
*
|
|
19
|
-
* return <Text>Initial scheme value: {schemeUri}</Text>
|
|
20
|
-
* }
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
1
|
export declare function getSchemeUri(): string;
|
|
@@ -17,7 +17,9 @@ export interface RegisterScreenInput {
|
|
|
17
17
|
}
|
|
18
18
|
export interface RegisterScreen {
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
type RegisteredParamList = keyof RegisterScreenInput extends never ? ParamListBase : RegisterScreenInput;
|
|
21
|
+
type NavigationParamsHelpers = Pick<NativeStackNavigationProp<RegisteredParamList, keyof RegisteredParamList>, 'replaceParams' | 'setParams'>;
|
|
22
|
+
export type NavigationProps = Omit<NativeStackNavigationProp<ParamListBase>, keyof NavigationParamsHelpers> & NavigationParamsHelpers;
|
|
21
23
|
export declare function useNavigation(): NavigationProps;
|
|
22
24
|
export type RouteHooksOptions<TScreen extends keyof RegisterScreen> = {
|
|
23
25
|
from: TScreen;
|
|
@@ -61,3 +63,4 @@ export declare function createRoute<T extends Readonly<object | undefined>>(path
|
|
|
61
63
|
_inputType: T;
|
|
62
64
|
_outputType: T;
|
|
63
65
|
};
|
|
66
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@granite-js/react-native",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.28",
|
|
4
4
|
"description": "The Granite Framework",
|
|
5
5
|
"bin": {
|
|
6
6
|
"granite": "./bin/cli.js"
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"@babel/core": "7.28.5",
|
|
92
92
|
"@babel/preset-env": "7.28.5",
|
|
93
93
|
"@babel/preset-typescript": "7.28.5",
|
|
94
|
-
"@granite-js/native": "1.0.
|
|
94
|
+
"@granite-js/native": "1.0.28",
|
|
95
95
|
"@testing-library/dom": "^10.4.0",
|
|
96
96
|
"@testing-library/react": "^16.1.0",
|
|
97
97
|
"@types/babel__core": "^7",
|
|
@@ -113,21 +113,21 @@
|
|
|
113
113
|
"zod": "^4.1.12"
|
|
114
114
|
},
|
|
115
115
|
"peerDependencies": {
|
|
116
|
-
"@granite-js/native": "1.0.
|
|
116
|
+
"@granite-js/native": "1.0.28",
|
|
117
117
|
"@types/react": "*",
|
|
118
118
|
"brick-module": "*",
|
|
119
119
|
"react": "*",
|
|
120
120
|
"react-native": "*"
|
|
121
121
|
},
|
|
122
122
|
"dependencies": {
|
|
123
|
-
"@granite-js/blur-view": "1.0.
|
|
124
|
-
"@granite-js/brownfield-module": "1.0.
|
|
125
|
-
"@granite-js/cli": "1.0.
|
|
126
|
-
"@granite-js/jest": "1.0.
|
|
127
|
-
"@granite-js/mpack": "1.0.
|
|
128
|
-
"@granite-js/plugin-core": "1.0.
|
|
129
|
-
"@granite-js/style-utils": "1.0.
|
|
130
|
-
"@granite-js/video": "1.0.
|
|
123
|
+
"@granite-js/blur-view": "1.0.28",
|
|
124
|
+
"@granite-js/brownfield-module": "1.0.28",
|
|
125
|
+
"@granite-js/cli": "1.0.28",
|
|
126
|
+
"@granite-js/jest": "1.0.28",
|
|
127
|
+
"@granite-js/mpack": "1.0.28",
|
|
128
|
+
"@granite-js/plugin-core": "1.0.28",
|
|
129
|
+
"@granite-js/style-utils": "1.0.28",
|
|
130
|
+
"@granite-js/video": "1.0.28",
|
|
131
131
|
"@standard-schema/spec": "^1.0.0",
|
|
132
132
|
"es-toolkit": "^1.39.8",
|
|
133
133
|
"react-native-url-polyfill": "3.0.0"
|
package/src/app/Granite.tsx
CHANGED
|
@@ -31,7 +31,7 @@ export interface GraniteProps {
|
|
|
31
31
|
* @description
|
|
32
32
|
* The initial scheme of the app.
|
|
33
33
|
*/
|
|
34
|
-
initialScheme?: string;
|
|
34
|
+
initialScheme?: string | (() => string);
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* @description
|
|
@@ -63,7 +63,7 @@ const createApp = () => {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
return {
|
|
66
|
-
registerApp(
|
|
66
|
+
registerApp(
|
|
67
67
|
AppContainer: ComponentType<PropsWithChildren<InitialProps>>,
|
|
68
68
|
{ appName, context, router, initialScheme, setIosSwipeGestureEnabled, getInitialUrl }: GraniteProps
|
|
69
69
|
): (initialProps: InitialProps) => JSX.Element {
|
|
@@ -72,11 +72,13 @@ const createApp = () => {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
function Root(initialProps: InitialProps) {
|
|
75
|
+
const initialSchemeValue = (typeof initialScheme === 'function' ? initialScheme() : initialScheme) ?? getSchemeUri();
|
|
76
|
+
|
|
75
77
|
return (
|
|
76
78
|
<AppRoot
|
|
77
79
|
container={AppContainer}
|
|
78
80
|
initialProps={initialProps}
|
|
79
|
-
initialScheme={
|
|
81
|
+
initialScheme={initialSchemeValue}
|
|
80
82
|
setIosSwipeGestureEnabled={setIosSwipeGestureEnabled}
|
|
81
83
|
getInitialUrl={getInitialUrl}
|
|
82
84
|
appName={appName}
|
|
@@ -1,27 +1,10 @@
|
|
|
1
|
-
import { GraniteBrownfieldModule } from
|
|
1
|
+
import { GraniteBrownfieldModule } from "@granite-js/brownfield-module";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* @public
|
|
5
|
-
* @name getSchemeUri
|
|
6
|
-
* @category Environment Check
|
|
7
|
-
* @kind function
|
|
8
|
-
* @description Returns the scheme value when first entering the screen. URI changes due to page navigation are not reflected.
|
|
9
|
-
* @returns {string} Returns the scheme value when first entering the screen.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ### Get initial scheme value
|
|
13
|
-
*
|
|
14
|
-
* ```tsx
|
|
15
|
-
* import { getSchemeUri } from '@granite-js/react-native';
|
|
16
|
-
* import { Text } from 'react-native';
|
|
17
|
-
*
|
|
18
|
-
* function MyPage() {
|
|
19
|
-
* const schemeUri = getSchemeUri();
|
|
20
|
-
*
|
|
21
|
-
* return <Text>Initial scheme value: {schemeUri}</Text>
|
|
22
|
-
* }
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
3
|
export function getSchemeUri() {
|
|
26
|
-
|
|
27
|
-
|
|
4
|
+
try {
|
|
5
|
+
return GraniteBrownfieldModule.getSchemeUri();
|
|
6
|
+
} catch {
|
|
7
|
+
// Fallback to the deprecated `schemeUri` constant for older versions of the native module
|
|
8
|
+
return GraniteBrownfieldModule.getConstants().schemeUri;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -29,11 +29,17 @@ export interface RegisterScreenInput {}
|
|
|
29
29
|
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
30
30
|
export interface RegisterScreen {}
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
type RegisteredParamList = keyof RegisterScreenInput extends never ? ParamListBase : RegisterScreenInput;
|
|
33
|
+
|
|
34
|
+
type NavigationParamsHelpers = Pick<
|
|
33
35
|
// @ts-expect-error - override type
|
|
34
|
-
keyof
|
|
36
|
+
NativeStackNavigationProp<RegisteredParamList, keyof RegisteredParamList>,
|
|
37
|
+
'replaceParams' | 'setParams'
|
|
35
38
|
>;
|
|
36
39
|
|
|
40
|
+
export type NavigationProps = Omit<NativeStackNavigationProp<ParamListBase>, keyof NavigationParamsHelpers> &
|
|
41
|
+
NavigationParamsHelpers;
|
|
42
|
+
|
|
37
43
|
export function useNavigation() {
|
|
38
44
|
return useNavigationNative<NavigationProps>();
|
|
39
45
|
}
|