@symbiote-native/react 0.1.1 → 0.2.1
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/README.md +13 -0
- package/build/bootstrap.d.ts +7 -0
- package/build/bootstrap.js +17 -0
- package/metro-css-parser.cjs +4 -1
- package/package.json +8 -4
package/README.md
CHANGED
|
@@ -20,6 +20,19 @@ adapter, not the core.
|
|
|
20
20
|
|
|
21
21
|
---
|
|
22
22
|
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install @symbiote-native/react react-native react
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`react-native` and `react` stay your app's own top-level dependencies — SymbioteNative doesn't hide
|
|
30
|
+
them, it only replaces the JS renderer that drives them. There's no `create-symbiote` scaffolder
|
|
31
|
+
yet, so the Metro config and the `index.js` entry seam below come from
|
|
32
|
+
[`examples/react`](../../examples/react) rather than a generator.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
23
36
|
## Use it
|
|
24
37
|
|
|
25
38
|
The app is ordinary React — it imports primitives from `@symbiote-native/react`, not `react-native`:
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
import { type IBootstrapHostOptions } from '@symbiote-native/components/bootstrap';
|
|
3
|
+
export type { IBootstrapHostOptions } from '@symbiote-native/components/bootstrap';
|
|
4
|
+
export type IRegisterAppOptions = IBootstrapHostOptions & {
|
|
5
|
+
appName: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function registerApp(App: ComponentType<object>, options: IRegisterAppOptions): void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Zero-config app entry: wires the four RN-backed host seams (via @symbiote-native/components'
|
|
2
|
+
// bootstrapHost) plus this adapter's own AppRegistry host-registrar bridge, then registers the
|
|
3
|
+
// root component — collapsing the canary's manual sequence into one call. Lives OUTSIDE the
|
|
4
|
+
// package's main barrel (see package.json's "./bootstrap" export): it imports react-native
|
|
5
|
+
// directly, which Vitest's Flow-unaware transform can't parse (see
|
|
6
|
+
// @symbiote-native/components/bootstrap for the full reason).
|
|
7
|
+
import { AppRegistry as RNAppRegistry } from 'react-native';
|
|
8
|
+
import { bootstrapHost } from '@symbiote-native/components/bootstrap';
|
|
9
|
+
import { AppRegistry, setHostRegistrar } from './modules/app-registry';
|
|
10
|
+
// Mirrors bare RN's own `AppRegistry.registerComponent(appName, () => App)` idiom, minus the
|
|
11
|
+
// manual host wiring in front of it.
|
|
12
|
+
export function registerApp(App, options) {
|
|
13
|
+
const { appName, ...bootstrapOptions } = options;
|
|
14
|
+
bootstrapHost(bootstrapOptions);
|
|
15
|
+
setHostRegistrar(RNAppRegistry);
|
|
16
|
+
AppRegistry.registerComponent(appName, () => App);
|
|
17
|
+
}
|
package/metro-css-parser.cjs
CHANGED
|
@@ -8,4 +8,7 @@
|
|
|
8
8
|
// the way a flat classic node_modules would). .cjs, not .js: this package is "type": "module",
|
|
9
9
|
// and Metro's babelTransformerPath loading expects a require()-able module. See the
|
|
10
10
|
// symbiote-sfc-style-compiler skill.
|
|
11
|
-
|
|
11
|
+
// createCssMetroTransformer is a factory, not a ready transformer — Metro's
|
|
12
|
+
// babelTransformerPath needs the actual {transform, getCacheKey} object it returns,
|
|
13
|
+
// not the css-parser package barrel.
|
|
14
|
+
module.exports = require('@symbiote-native/css-parser').createCssMetroTransformer();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbiote-native/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "SymbioteNative's React adapter — a react-reconciler host config (mutation mode) driving real native iOS/Android views through stock React Native Fabric.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
"types": "./build/index.d.ts",
|
|
22
22
|
"default": "./build/index.js"
|
|
23
23
|
},
|
|
24
|
+
"./bootstrap": {
|
|
25
|
+
"types": "./build/bootstrap.d.ts",
|
|
26
|
+
"default": "./build/bootstrap.js"
|
|
27
|
+
},
|
|
24
28
|
"./metro-css-parser": "./metro-css-parser.cjs"
|
|
25
29
|
},
|
|
26
30
|
"files": [
|
|
@@ -32,8 +36,8 @@
|
|
|
32
36
|
},
|
|
33
37
|
"dependencies": {
|
|
34
38
|
"react-reconciler": "^0.33.0",
|
|
35
|
-
"@symbiote-native/components": "0.
|
|
36
|
-
"@symbiote-native/css-parser": "0.
|
|
39
|
+
"@symbiote-native/components": "0.2.0",
|
|
40
|
+
"@symbiote-native/css-parser": "0.2.0",
|
|
37
41
|
"@symbiote-native/engine": "0.1.1"
|
|
38
42
|
},
|
|
39
43
|
"peerDependencies": {
|
|
@@ -44,7 +48,7 @@
|
|
|
44
48
|
"@types/react": "^19.2.0",
|
|
45
49
|
"@types/react-reconciler": "^0.32.2",
|
|
46
50
|
"react": "19.2.3",
|
|
47
|
-
"@symbiote-native/test-utils": "0.
|
|
51
|
+
"@symbiote-native/test-utils": "0.1.1"
|
|
48
52
|
},
|
|
49
53
|
"scripts": {
|
|
50
54
|
"typecheck": "tsc --build",
|