@granite-js/react-native 0.1.25 → 0.1.27
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 +33 -0
- package/dist/index.d.ts +1 -0
- package/dist/polyfills/index.d.ts +1 -0
- package/dist/router/hooks/useIsInitialScreen.d.ts +5 -0
- package/package.json +20 -11
- package/src/app/Granite.tsx +3 -0
- package/src/dev-entrypoint/index.tsx +0 -3
- package/src/index.ts +1 -0
- package/src/polyfills/index.ts +5 -0
- package/src/router/createRoute.ts +3 -2
- package/src/router/hooks/useIsInitialScreen.ts +5 -0
- package/dist/rn-polyfills/index.d.ts +0 -1
- package/dist/rn-polyfills/symbol-asynciterator/index.d.ts +0 -9
- package/dist/rn-polyfills/url/index.d.ts +0 -1
- package/src/rn-polyfills/index.ts +0 -7
- package/src/rn-polyfills/symbol-asynciterator/index.ts +0 -15
- package/src/rn-polyfills/url/index.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @granite-js/react-native
|
|
2
2
|
|
|
3
|
+
## 0.1.27
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 664f2a1: add useIsInitialScreen export in index(for user's import)
|
|
8
|
+
- d13ddeb: fix(router): useParams used from is strict: true
|
|
9
|
+
- e32b020: ci: oidc
|
|
10
|
+
- Updated dependencies [e32b020]
|
|
11
|
+
- Updated dependencies [1dd9179]
|
|
12
|
+
- @granite-js/cli@0.1.27
|
|
13
|
+
- @granite-js/image@0.1.27
|
|
14
|
+
- @granite-js/jest@0.1.27
|
|
15
|
+
- @granite-js/lottie@0.1.27
|
|
16
|
+
- @granite-js/mpack@0.1.27
|
|
17
|
+
- @granite-js/native@0.1.27
|
|
18
|
+
- @granite-js/plugin-core@0.1.27
|
|
19
|
+
- @granite-js/style-utils@0.1.27
|
|
20
|
+
|
|
21
|
+
## 0.1.26
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- 41f9ab3: ensure polyfill setup during initialization and update package.json config for improve tree shaking
|
|
26
|
+
- Updated dependencies [41f9ab3]
|
|
27
|
+
- @granite-js/style-utils@0.1.26
|
|
28
|
+
- @granite-js/lottie@0.1.26
|
|
29
|
+
- @granite-js/image@0.1.26
|
|
30
|
+
- @granite-js/jest@0.1.26
|
|
31
|
+
- @granite-js/cli@0.1.26
|
|
32
|
+
- @granite-js/mpack@0.1.26
|
|
33
|
+
- @granite-js/native@0.1.26
|
|
34
|
+
- @granite-js/plugin-core@0.1.26
|
|
35
|
+
|
|
3
36
|
## 0.1.25
|
|
4
37
|
|
|
5
38
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export * from './intersection-observer';
|
|
|
12
12
|
export * from './impression-area';
|
|
13
13
|
export * from './scroll-view-inertial-background';
|
|
14
14
|
export * from './router/createRoute';
|
|
15
|
+
export * from './router/hooks/useIsInitialScreen';
|
|
15
16
|
export * from './event';
|
|
16
17
|
export * from './video';
|
|
17
18
|
export * from './status-bar';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function setupPolyfills(): void;
|
|
@@ -1 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook that determines if the current screen is the initial screen in the navigation stack.
|
|
3
|
+
*
|
|
4
|
+
* @returns {boolean} True if the current screen is the initial (first) screen in the stack, false otherwise.
|
|
5
|
+
*/
|
|
1
6
|
export declare function useIsInitialScreen(): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@granite-js/react-native",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.27",
|
|
4
4
|
"description": "The Granite Framework",
|
|
5
5
|
"bin": {
|
|
6
6
|
"granite": "./bin/cli.js"
|
|
@@ -14,6 +14,11 @@
|
|
|
14
14
|
},
|
|
15
15
|
"main": "./dist/index.js",
|
|
16
16
|
"types": "./dist/index.d.ts",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/toss/granite.git",
|
|
20
|
+
"directory": "packages/react-native"
|
|
21
|
+
},
|
|
17
22
|
"exports": {
|
|
18
23
|
".": {
|
|
19
24
|
"types": "./dist/index.d.ts",
|
|
@@ -86,7 +91,7 @@
|
|
|
86
91
|
"@babel/core": "^7.24.9",
|
|
87
92
|
"@babel/preset-env": "^7.24.8",
|
|
88
93
|
"@babel/preset-typescript": "^7.24.7",
|
|
89
|
-
"@granite-js/native": "0.1.
|
|
94
|
+
"@granite-js/native": "0.1.27",
|
|
90
95
|
"@testing-library/dom": "^10.4.0",
|
|
91
96
|
"@testing-library/react": "^16.1.0",
|
|
92
97
|
"@types/babel__core": "^7",
|
|
@@ -112,14 +117,18 @@
|
|
|
112
117
|
"react-native": "*"
|
|
113
118
|
},
|
|
114
119
|
"dependencies": {
|
|
115
|
-
"@granite-js/cli": "0.1.
|
|
116
|
-
"@granite-js/image": "0.1.
|
|
117
|
-
"@granite-js/jest": "0.1.
|
|
118
|
-
"@granite-js/lottie": "0.1.
|
|
119
|
-
"@granite-js/mpack": "0.1.
|
|
120
|
-
"@granite-js/plugin-core": "0.1.
|
|
121
|
-
"@granite-js/style-utils": "0.1.
|
|
120
|
+
"@granite-js/cli": "0.1.27",
|
|
121
|
+
"@granite-js/image": "0.1.27",
|
|
122
|
+
"@granite-js/jest": "0.1.27",
|
|
123
|
+
"@granite-js/lottie": "0.1.27",
|
|
124
|
+
"@granite-js/mpack": "0.1.27",
|
|
125
|
+
"@granite-js/plugin-core": "0.1.27",
|
|
126
|
+
"@granite-js/style-utils": "0.1.27",
|
|
122
127
|
"es-toolkit": "^1.39.8",
|
|
123
|
-
"react-native-url-polyfill": "
|
|
124
|
-
}
|
|
128
|
+
"react-native-url-polyfill": "3.0.0"
|
|
129
|
+
},
|
|
130
|
+
"sideEffects": [
|
|
131
|
+
"dist/async-bridges.*",
|
|
132
|
+
"dist/constant-bridges.*"
|
|
133
|
+
]
|
|
125
134
|
}
|
package/src/app/Granite.tsx
CHANGED
|
@@ -6,6 +6,7 @@ import type { RouterProps, RequireContext } from '../router';
|
|
|
6
6
|
import { AppRoot } from './AppRoot';
|
|
7
7
|
import { HostAppRoot } from './HostAppRoot';
|
|
8
8
|
import { getSchemeUri } from '../constant-bridges';
|
|
9
|
+
import { setupPolyfills } from '../polyfills';
|
|
9
10
|
|
|
10
11
|
export interface GraniteProps {
|
|
11
12
|
/**
|
|
@@ -50,6 +51,8 @@ export interface GraniteProps {
|
|
|
50
51
|
const createApp = () => {
|
|
51
52
|
let _appName: string | null = null;
|
|
52
53
|
|
|
54
|
+
setupPolyfills();
|
|
55
|
+
|
|
53
56
|
function registerComponent(appKey: string, component: React.ComponentType<any>): string {
|
|
54
57
|
if (AppRegistry.getAppKeys().includes(appKey)) {
|
|
55
58
|
// `AppRegistry.registerComponent` returns the app key.
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
2
|
import { AppRegistry } from 'react-native';
|
|
3
3
|
import { ENTRY_BUNDLE_NAME } from '../constants';
|
|
4
|
-
import { setup } from '../rn-polyfills';
|
|
5
|
-
|
|
6
|
-
setup();
|
|
7
4
|
|
|
8
5
|
export function register(Component: ComponentType<any>) {
|
|
9
6
|
if (AppRegistry.getAppKeys().includes(ENTRY_BUNDLE_NAME)) {
|
package/src/index.ts
CHANGED
|
@@ -14,6 +14,7 @@ export * from './intersection-observer';
|
|
|
14
14
|
export * from './impression-area';
|
|
15
15
|
export * from './scroll-view-inertial-background';
|
|
16
16
|
export * from './router/createRoute';
|
|
17
|
+
export * from './router/hooks/useIsInitialScreen';
|
|
17
18
|
export * from './event';
|
|
18
19
|
export * from './video';
|
|
19
20
|
export * from './status-bar';
|
|
@@ -133,14 +133,15 @@ export function useParams<TScreen extends keyof RegisterScreen>(
|
|
|
133
133
|
const routeOptions = useMatchOptions(options);
|
|
134
134
|
const route = useRoute();
|
|
135
135
|
|
|
136
|
+
const isStrict = typeof options.from === 'string' ? true : options.strict;
|
|
136
137
|
const params = useMemo(() => {
|
|
137
138
|
if (!routeOptions) {
|
|
138
139
|
return (route.params ?? {}) as Readonly<object | undefined>;
|
|
139
140
|
}
|
|
140
141
|
|
|
141
142
|
const parsedParams = routeOptions.parserParams(route.params as Record<string, string>);
|
|
142
|
-
return
|
|
143
|
-
}, [routeOptions, route.params,
|
|
143
|
+
return isStrict && routeOptions.validateParams ? routeOptions.validateParams(parsedParams) : parsedParams;
|
|
144
|
+
}, [routeOptions, route.params, isStrict]);
|
|
144
145
|
|
|
145
146
|
return params;
|
|
146
147
|
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { useNavigationState } from '@granite-js/native/@react-navigation/native';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Hook that determines if the current screen is the initial screen in the navigation stack.
|
|
5
|
+
*
|
|
6
|
+
* @returns {boolean} True if the current screen is the initial (first) screen in the stack, false otherwise.
|
|
7
|
+
*/
|
|
3
8
|
export function useIsInitialScreen() {
|
|
4
9
|
const index = useNavigationState((state) => state?.index ?? 0);
|
|
5
10
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function setup(): void;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Polyfill for @swc/helpers build compatibility
|
|
3
|
-
*
|
|
4
|
-
* @see https://github.com/swc-project/swc/blob/v1.4.15/packages/helpers/esm/_async_iterator.js#L3
|
|
5
|
-
*
|
|
6
|
-
* - babel: No runtime issues after build as there is a fallback for `Symbol.asyncIterator`
|
|
7
|
-
* - swc: No fallback for `Symbol.asyncIterator`, so it needs to be defined in advance
|
|
8
|
-
*/
|
|
9
|
-
export declare function setup(): void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { setupURLPolyfill as setup } from 'react-native-url-polyfill';
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Polyfill for @swc/helpers build compatibility
|
|
3
|
-
*
|
|
4
|
-
* @see https://github.com/swc-project/swc/blob/v1.4.15/packages/helpers/esm/_async_iterator.js#L3
|
|
5
|
-
*
|
|
6
|
-
* - babel: No runtime issues after build as there is a fallback for `Symbol.asyncIterator`
|
|
7
|
-
* - swc: No fallback for `Symbol.asyncIterator`, so it needs to be defined in advance
|
|
8
|
-
*/
|
|
9
|
-
export function setup() {
|
|
10
|
-
if (typeof Symbol !== 'undefined' && !Symbol.asyncIterator) {
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
12
|
-
// @ts-ignore
|
|
13
|
-
Symbol.asyncIterator = Symbol.for('@@asyncIterator');
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { setupURLPolyfill as setup } from 'react-native-url-polyfill';
|