Skip to content

Commit

Permalink
add 'clearContainer' to reconciler. react-reconciler moved from peer …
Browse files Browse the repository at this point in the history
…dependency to regular dependency.
  • Loading branch information
brianzinn committed Oct 29, 2020
1 parent 34f0553 commit ded90d9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"@types/lodash.camelcase": "^4.3.6",
"@types/node": "^8.0.0",
"@types/react": "^16.7.20",
"@types/react-reconciler": "^0.16.0",
"@types/react-reconciler": "^0.18.0",
"babel-loader": "^8.1.0",
"cannon": "^0.6.2",
"chroma-js": "^2.1.0",
Expand All @@ -83,7 +83,6 @@
"react": "^16.13.1",
"react-babylon-spring": "^1.0.2",
"react-dom": "^16.13.1",
"react-reconciler": "^0.25.1",
"react-three-gui": "^0.3.1",
"rimraf": "^2.6.1",
"rollup": "^2.0.6",
Expand All @@ -104,8 +103,10 @@
"@babylonjs/gui": "4.x",
"@babylonjs/inspector": "4.x",
"@babylonjs/loaders": "4.x",
"react": "16.x",
"react-dom": "16.x",
"react-reconciler": "0.x"
"react": ">=16",
"react-dom": ">=16"
},
"dependencies": {
"react-reconciler": "^0.26.1"
}
}
5 changes: 5 additions & 0 deletions src/ReactBabylonJSHostConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ const ReactBabylonJSHostConfig: HostConfig<
> & {
hideInstance: (instance: HostCreatedInstance<any>) => void;
unhideInstance: (instance: HostCreatedInstance<any>, props:Props) => void;
clearContainer: (container: Container) => void;
} = {
// This has the reconciler include in call chain ie: appendChild, removeChild
get supportsMutation(): boolean {
Expand Down Expand Up @@ -219,6 +220,10 @@ const ReactBabylonJSHostConfig: HostConfig<
return updatePayload.length === 0 ? null : updatePayload
},

clearContainer(container: Container): void {
container.rootInstance.children.splice(0);
},

insertBefore(parentInstance: HostCreatedInstance<any>, child: CreatedInstance<any> | undefined, beforeChild: {} | CreatedInstance<any> | undefined): void {
let index: number = 0;
if (parentInstance && beforeChild !== undefined) {
Expand Down

0 comments on commit ded90d9

Please sign in to comment.