@reactunity/renderer 0.9.1 → 0.9.2

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.
@@ -1,7 +1,13 @@
1
1
  import * as React from 'react';
2
2
  import { NativeContainerInstance } from '../models/renderer';
3
+ interface RenderOptions {
4
+ hostContainer?: NativeContainerInstance;
5
+ disableHelpers?: boolean;
6
+ mode?: 'legacy' | 'concurrent';
7
+ }
3
8
  export declare const Renderer: {
4
- render(element: React.ReactNode, hostContainer?: NativeContainerInstance, renderWithoutHelpers?: boolean): void;
9
+ render(element: React.ReactNode, options?: RenderOptions): void;
5
10
  };
6
11
  export declare const batchedUpdates: <A, R>(fn: (a: A) => R, a: A) => R;
7
12
  export declare const flushSync: <A, R>(fn: (a: A) => R, a: A) => R;
13
+ export {};
@@ -13,7 +13,7 @@ import { createElement } from 'react';
13
13
  import * as Reconciler from 'react-reconciler';
14
14
  import { DefaultView } from '../views/default-view';
15
15
  import { diffProperties, styleStringSymbol } from './diffing';
16
- var LegacyRoot = 1;
16
+ var LegacyRoot = 0;
17
17
  var ConcurrentRoot = 1;
18
18
  var hostContext = {};
19
19
  var childContext = {};
@@ -33,7 +33,7 @@ var textTypes = {
33
33
  };
34
34
  function getAllowedProps(props, type) {
35
35
  var children = props.children, tag = props.tag, rest = __rest(props, ["children", "tag"]);
36
- if (textTypes[type]) {
36
+ if (textTypes[type] && 'children' in props) {
37
37
  rest.children = (!children || typeof children === 'boolean') ? null : Array.isArray(children) ? children.join('') : children + '';
38
38
  }
39
39
  if (typeof props.style === 'string')
@@ -105,15 +105,15 @@ var hostConfig = {
105
105
  var reconciler = Reconciler(hostConfig);
106
106
  var containerMap = new Map();
107
107
  export var Renderer = {
108
- render: function (element, hostContainer, renderWithoutHelpers) {
109
- if (!hostContainer)
110
- hostContainer = HostContainer;
108
+ render: function (element, options) {
109
+ if (options === void 0) { options = {}; }
110
+ var hostContainer = (options === null || options === void 0 ? void 0 : options.hostContainer) || HostContainer;
111
111
  var hostRoot = containerMap.get(hostContainer);
112
112
  if (!hostRoot) {
113
- hostRoot = reconciler.createContainer(hostContainer, LegacyRoot, false, null);
113
+ hostRoot = reconciler.createContainer(hostContainer, (options === null || options === void 0 ? void 0 : options.mode) === 'legacy' ? LegacyRoot : ConcurrentRoot, false, null);
114
114
  containerMap.set(hostContainer, hostRoot);
115
115
  }
116
- if (!renderWithoutHelpers)
116
+ if (!(options === null || options === void 0 ? void 0 : options.disableHelpers))
117
117
  element = createElement(DefaultView, null, element);
118
118
  reconciler.updateContainer(element, hostRoot, null);
119
119
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactunity/renderer",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "description": "React renderer for Unity3D",
5
5
  "types": "dist/index.d.ts",
6
6
  "typings": "dist/index.d.ts",
@@ -58,7 +58,7 @@
58
58
  "react-reconciler": "^0.26.2"
59
59
  },
60
60
  "peerDependencies": {
61
- "react": "^17.0.2"
61
+ "react": ">=17"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@reactunity/scripts": "^0.9.0",