@granite-js/react-native 1.0.42 → 1.0.43

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 CHANGED
@@ -1,5 +1,20 @@
1
1
  # @granite-js/react-native
2
2
 
3
+ ## 1.0.43
4
+
5
+ ### Patch Changes
6
+
7
+ - afd4e50: feat(react-native): export InitialPropsProvider
8
+ - @granite-js/blur-view@1.0.43
9
+ - @granite-js/brownfield-module@1.0.43
10
+ - @granite-js/cli@1.0.43
11
+ - @granite-js/jest@1.0.43
12
+ - @granite-js/mpack@1.0.43
13
+ - @granite-js/native@1.0.43
14
+ - @granite-js/plugin-core@1.0.43
15
+ - @granite-js/style-utils@1.0.43
16
+ - @granite-js/video@1.0.43
17
+
3
18
  ## 1.0.42
4
19
 
5
20
  ### Patch Changes
@@ -1,6 +1,33 @@
1
1
  import { type PropsWithChildren } from 'react';
2
2
  import { InitialProps } from '../../initial-props';
3
3
  export declare const InitialPropsContext: import("react").Context<InitialProps | null>;
4
+ /**
5
+ * @public
6
+ * @name InitialPropsProvider
7
+ * @category Core
8
+ * @description Provides the initial data passed from the native platform (Android or iOS) to `useInitialProps` and `useInitialSearchParams`. `Granite.registerApp` already renders this provider, so you only need it when you register the root component yourself instead of going through the router.
9
+ * @param {InitialProps} initialProps - Initial data the native platform passed to the root component.
10
+ * @param {ReactNode | undefined} children - Child components that read the initial data.
11
+ * @returns {ReactElement} A React Provider component.
12
+ * @example
13
+ *
14
+ * ### Registering a root component without the router
15
+ *
16
+ * ```tsx
17
+ * import { AppRegistry } from 'react-native';
18
+ * import { InitialPropsProvider, type InitialProps } from '@granite-js/react-native';
19
+ *
20
+ * function App(initialProps: InitialProps) {
21
+ * return (
22
+ * <InitialPropsProvider initialProps={initialProps}>
23
+ * <MyApp />
24
+ * </InitialPropsProvider>
25
+ * );
26
+ * }
27
+ *
28
+ * AppRegistry.registerComponent('my-app', () => App);
29
+ * ```
30
+ */
4
31
  export declare function InitialPropsProvider({ children, initialProps }: PropsWithChildren<{
5
32
  initialProps: InitialProps;
6
33
  }>): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- export { useInitialProps } from './context/InitialPropsContext';
1
+ export { InitialPropsProvider, useInitialProps } from './context/InitialPropsContext';
2
2
  export { useInitialSearchParams } from './context/useInitialSearchParams';
3
3
  export { Granite } from './Granite';
4
4
  export type { GraniteProps } from './Granite';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import './types/global';
2
- export { Granite, useInitialSearchParams, useInitialProps } from './app';
2
+ export { Granite, InitialPropsProvider, useInitialSearchParams, useInitialProps } from './app';
3
3
  export * from '@granite-js/style-utils';
4
4
  export { type GraniteImageSource, type GraniteImageStatic, type ResizeMode, type CachePolicy, type Priority, type OnLoadEvent, type OnProgressEvent, } from '@granite-js/native/react-native-fast-image';
5
5
  export * from './image';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@granite-js/react-native",
3
- "version": "1.0.42",
3
+ "version": "1.0.43",
4
4
  "description": "The Granite Framework",
5
5
  "bin": {
6
6
  "granite": "./bin/cli.js"
@@ -91,8 +91,8 @@
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.42",
95
- "@granite-js/vitest": "1.0.42",
94
+ "@granite-js/native": "1.0.43",
95
+ "@granite-js/vitest": "1.0.43",
96
96
  "@testing-library/dom": "^10.4.0",
97
97
  "@testing-library/react": "^16.1.0",
98
98
  "@types/babel__core": "^7",
@@ -114,21 +114,21 @@
114
114
  "zod": "^4.1.12"
115
115
  },
116
116
  "peerDependencies": {
117
- "@granite-js/native": "1.0.42",
117
+ "@granite-js/native": "1.0.43",
118
118
  "@types/react": "*",
119
119
  "brick-module": "*",
120
120
  "react": "*",
121
121
  "react-native": "*"
122
122
  },
123
123
  "dependencies": {
124
- "@granite-js/blur-view": "1.0.42",
125
- "@granite-js/brownfield-module": "1.0.42",
126
- "@granite-js/cli": "1.0.42",
127
- "@granite-js/jest": "1.0.42",
128
- "@granite-js/mpack": "1.0.42",
129
- "@granite-js/plugin-core": "1.0.42",
130
- "@granite-js/style-utils": "1.0.42",
131
- "@granite-js/video": "1.0.42",
124
+ "@granite-js/blur-view": "1.0.43",
125
+ "@granite-js/brownfield-module": "1.0.43",
126
+ "@granite-js/cli": "1.0.43",
127
+ "@granite-js/jest": "1.0.43",
128
+ "@granite-js/mpack": "1.0.43",
129
+ "@granite-js/plugin-core": "1.0.43",
130
+ "@granite-js/style-utils": "1.0.43",
131
+ "@granite-js/video": "1.0.43",
132
132
  "@standard-schema/spec": "^1.0.0",
133
133
  "es-toolkit": "^1.39.8",
134
134
  "react-native-url-polyfill": "3.0.0"
@@ -3,6 +3,33 @@ import { InitialProps } from '../../initial-props';
3
3
 
4
4
  export const InitialPropsContext = createContext<InitialProps | null>(null);
5
5
 
6
+ /**
7
+ * @public
8
+ * @name InitialPropsProvider
9
+ * @category Core
10
+ * @description Provides the initial data passed from the native platform (Android or iOS) to `useInitialProps` and `useInitialSearchParams`. `Granite.registerApp` already renders this provider, so you only need it when you register the root component yourself instead of going through the router.
11
+ * @param {InitialProps} initialProps - Initial data the native platform passed to the root component.
12
+ * @param {ReactNode | undefined} children - Child components that read the initial data.
13
+ * @returns {ReactElement} A React Provider component.
14
+ * @example
15
+ *
16
+ * ### Registering a root component without the router
17
+ *
18
+ * ```tsx
19
+ * import { AppRegistry } from 'react-native';
20
+ * import { InitialPropsProvider, type InitialProps } from '@granite-js/react-native';
21
+ *
22
+ * function App(initialProps: InitialProps) {
23
+ * return (
24
+ * <InitialPropsProvider initialProps={initialProps}>
25
+ * <MyApp />
26
+ * </InitialPropsProvider>
27
+ * );
28
+ * }
29
+ *
30
+ * AppRegistry.registerComponent('my-app', () => App);
31
+ * ```
32
+ */
6
33
  export function InitialPropsProvider({ children, initialProps }: PropsWithChildren<{ initialProps: InitialProps }>) {
7
34
  return <InitialPropsContext.Provider value={initialProps}>{children}</InitialPropsContext.Provider>;
8
35
  }
package/src/app/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { useInitialProps } from './context/InitialPropsContext';
1
+ export { InitialPropsProvider, useInitialProps } from './context/InitialPropsContext';
2
2
  export { useInitialSearchParams } from './context/useInitialSearchParams';
3
3
  export { Granite } from './Granite';
4
4
  export type { GraniteProps } from './Granite';
package/src/index.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import './types/global';
2
2
 
3
- export { Granite, useInitialSearchParams, useInitialProps } from './app';
3
+ export { Granite, InitialPropsProvider, useInitialSearchParams, useInitialProps } from './app';
4
4
  export * from '@granite-js/style-utils';
5
5
  export {
6
6
  type GraniteImageSource,