@reactunity/renderer 0.8.0 → 0.8.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.
|
@@ -28,7 +28,7 @@ export function createDictionaryWatcher(dictionary, displayName) {
|
|
|
28
28
|
});
|
|
29
29
|
if (!remove) {
|
|
30
30
|
if (displayName)
|
|
31
|
-
console.warn(displayName
|
|
31
|
+
console.warn("".concat(displayName, " dictionary does not provide a change listener"));
|
|
32
32
|
else
|
|
33
33
|
console.warn('The dictionary does not provide a change listener');
|
|
34
34
|
}
|
|
@@ -42,7 +42,7 @@ export function createDictionaryWatcher(dictionary, displayName) {
|
|
|
42
42
|
var context = React.useContext(ctx);
|
|
43
43
|
if (context === undefined) {
|
|
44
44
|
if (displayName)
|
|
45
|
-
throw new Error(displayName
|
|
45
|
+
throw new Error("".concat(displayName, ".useContext must be used within a ").concat(displayName, ".Provider"));
|
|
46
46
|
else
|
|
47
47
|
throw new Error('useContext must be used within a provider');
|
|
48
48
|
}
|
|
@@ -97,11 +97,14 @@ var hostConfig = {
|
|
|
97
97
|
queueMicrotask: function (callback) { return setTimeout(callback, 0); },
|
|
98
98
|
};
|
|
99
99
|
var ReactUnityReconciler = Reconciler(hostConfig);
|
|
100
|
+
var containerMap = new Map();
|
|
100
101
|
export var Renderer = {
|
|
101
102
|
render: function (element, hostContainer, renderWithoutHelpers) {
|
|
102
103
|
if (!hostContainer)
|
|
103
104
|
hostContainer = HostContainer;
|
|
104
|
-
var hostRoot =
|
|
105
|
+
var hostRoot = containerMap.get(hostContainer);
|
|
106
|
+
if (!hostRoot)
|
|
107
|
+
containerMap.set(hostContainer, hostRoot = ReactUnityReconciler.createContainer(hostContainer, 0, false, {}));
|
|
105
108
|
if (!renderWithoutHelpers)
|
|
106
109
|
element = createElement(DefaultView, null, element);
|
|
107
110
|
return ReactUnityReconciler.updateContainer(element, hostRoot, null);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactunity/renderer",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "React renderer for Unity3D",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
|
-
"preinstall": "npx only-allow@1.0.0 yarn",
|
|
34
33
|
"build:clean": "rimraf dist",
|
|
35
34
|
"build:base": "tsc",
|
|
36
35
|
"build:editor": "tsc -p tsconfig.editor.json",
|